Skip to content

Commit ca2852d

Browse files
author
WillItMod
committed
AxeDGB: revert to DGB 8.22.2, reduce RPC load
1 parent 400ba0e commit ca2852d

4 files changed

Lines changed: 58 additions & 10 deletions

File tree

willitmod-dev-dgb/docker-compose.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,16 @@ services:
130130
# and Miningcore currently assumes notifications exists).
131131
if command -v jq >/dev/null 2>&1 && jq -e '.' >/dev/null 2>&1 < /data/pool/config/miningcore.json; then
132132
tmp="/data/pool/config/miningcore.json.tmp"
133-
jq '
133+
jq --argjson rpcport "$$DGB_RPC_PORT" '
134134
.notifications = (.notifications // {"enabled": false})
135-
| (.pools |= (if type=="array" then map(if type=="object" then (.paymentProcessing = (.paymentProcessing // {"enabled": false})) else . end) else . end))
136135
| (.banning |= (if type=="object" then del(.manager) else . end))
136+
| (.pools |= (if type=="array" then map(
137+
if type=="object" then
138+
(.paymentProcessing = (.paymentProcessing // {"enabled": false}))
139+
| (.blockRefreshInterval = ((.blockRefreshInterval // 500) | if . < 2000 then 2000 else . end))
140+
| (.daemons = ((.daemons // []) | (if type=="array" then map(if type=="object" then (.port=$rpcport) else . end) else . end)))
141+
else . end
142+
) else . end))
137143
' /data/pool/config/miningcore.json > "$$tmp" && mv "$$tmp" /data/pool/config/miningcore.json
138144
139145
# Ensure the Scrypt pool exists when upgrading from SHA256-only configs.
@@ -292,7 +298,7 @@ services:
292298
fi
293299
294300
dgbd:
295-
image: ghcr.io/willitmod/digibyte:8.26.1
301+
image: ghcr.io/willitmod/digibyte:8.22.2
296302
user: "1000:1000"
297303
restart: unless-stopped
298304
stop_grace_period: 15m30s
@@ -345,7 +351,7 @@ services:
345351
- ${APP_DATA_DIR}/data/pool/config/coins.json:/app/coins.json:ro
346352

347353
app:
348-
image: ghcr.io/willitmod/axedgb-app-umbrel-dev:0.7.65-alpha
354+
image: ghcr.io/willitmod/axedgb-app-umbrel-dev:0.7.66-alpha
349355
user: "1000:1000"
350356
restart: on-failure
351357
stop_grace_period: 30s
@@ -367,7 +373,7 @@ services:
367373
STRATUM_PORTS: "sha256:5678,scrypt:5679"
368374
MININGCORE_CONF_PATH: "/data/pool/config/miningcore.json"
369375
APP_CHANNEL: "ALPHA"
370-
DGB_IMAGE: "ghcr.io/willitmod/digibyte:8.26.1"
376+
DGB_IMAGE: "ghcr.io/willitmod/digibyte:8.22.2"
371377
MININGCORE_IMAGE: "ghcr.io/willitmod/miningcore:a553f62301f44c6df80891e408b6526d1dd98692"
372378
POSTGRES_IMAGE: "postgres:16-alpine"
373379
STATIC_DIR: "/app/static"

willitmod-dev-dgb/images/axedgb-app/app.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _env_or_default(name: str, default: str) -> str:
5454
SUPPORT_TICKET_URL = _env_or_default("SUPPORT_TICKET_URL", f"{DEFAULT_SUPPORT_BASE_URL}/api/support/upload")
5555

5656
APP_ID = "willitmod-dev-dgb"
57-
APP_VERSION = "0.7.65-alpha"
57+
APP_VERSION = "0.7.66-alpha"
5858

5959
DGB_RPC_HOST = os.getenv("DGB_RPC_HOST", "dgbd")
6060
DGB_RPC_PORT = int(os.getenv("DGB_RPC_PORT", "14022"))
@@ -247,6 +247,9 @@ def _rpc_call(method: str, params=None):
247247
return data.get("result")
248248

249249

250+
NODE_STATUS_LOCK = threading.Lock()
251+
252+
250253
def _read_conf_kv_in_section(path: Path, section: str) -> dict:
251254
if not path.exists():
252255
return {}
@@ -544,8 +547,6 @@ def _update_miningcore_daemon_port(network: str):
544547
for pool in pools:
545548
if not isinstance(pool, dict):
546549
continue
547-
if str(pool.get("id") or "") != MININGCORE_POOL_ID:
548-
continue
549550
daemons = pool.get("daemons") or []
550551
if not isinstance(daemons, list):
551552
continue
@@ -1880,6 +1881,35 @@ def do_GET(self):
18801881
if self.path == "/api/node":
18811882
reindex_requested = NODE_REINDEX_FLAG_PATH.exists()
18821883
reindex_required = _detect_reindex_required()
1884+
cached = _read_node_cache()
1885+
if cached and (int(time.time()) - int(cached["t"])) <= 4:
1886+
payload = dict(cached["status"])
1887+
payload.update(
1888+
{
1889+
"cached": True,
1890+
"lastSeen": int(cached["t"]),
1891+
"reindexRequested": reindex_requested,
1892+
"reindexRequired": reindex_required,
1893+
}
1894+
)
1895+
return self._send(*_json(payload))
1896+
1897+
acquired = NODE_STATUS_LOCK.acquire(blocking=False)
1898+
if not acquired:
1899+
if cached:
1900+
payload = dict(cached["status"])
1901+
payload.update(
1902+
{
1903+
"cached": True,
1904+
"lastSeen": int(cached["t"]),
1905+
"error": "busy",
1906+
"reindexRequested": reindex_requested,
1907+
"reindexRequired": reindex_required,
1908+
}
1909+
)
1910+
return self._send(*_json(payload))
1911+
return self._send(*_json({"error": "busy"}, status=503))
1912+
18831913
try:
18841914
s = _node_status()
18851915
payload = dict(s)
@@ -1903,7 +1933,7 @@ def do_GET(self):
19031933
"reindexRequired": reindex_required,
19041934
}
19051935
return self._send(*_json(payload))
1906-
cached = _read_node_cache()
1936+
cached = cached or _read_node_cache()
19071937
if cached:
19081938
payload = dict(cached["status"])
19091939
payload.update(
@@ -1928,6 +1958,12 @@ def do_GET(self):
19281958
status=503,
19291959
)
19301960
)
1961+
finally:
1962+
if acquired:
1963+
try:
1964+
NODE_STATUS_LOCK.release()
1965+
except Exception:
1966+
pass
19311967

19321968
if path == "/api/pool":
19331969
algo = _algo_from_query(raw_path)

willitmod-dev-dgb/images/axedgb-app/static/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ function getStratumPort(algo) {
393393
}
394394

395395
async function refresh() {
396+
if (window.__refreshInFlight) return;
397+
window.__refreshInFlight = true;
398+
try {
396399
try {
397400
const res = await fetch('/api/node', { cache: 'no-store' });
398401
const node = await res.json().catch(() => ({}));
@@ -545,6 +548,9 @@ async function refresh() {
545548
renderWorkerDetails([]);
546549
}
547550

551+
} finally {
552+
window.__refreshInFlight = false;
553+
}
548554
}
549555

550556
function setStratumUrl() {

willitmod-dev-dgb/umbrel-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ manifestVersion: 1
22
id: willitmod-dev-dgb
33
category: altcoin
44
name: AxeDGB
5-
version: "0.7.65-alpha"
5+
version: "0.7.66-alpha"
66
tagline: DGB node + solo pool
77
description: >-
88
Run a DigiByte full node (DigiByte Core) and a solo Stratum v1 pool (Miningcore) as a single Umbrel app installation.

0 commit comments

Comments
 (0)