upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-08-09 12:41:44 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-08-23 04:37:36 +0000
commitea520850023baf5ce7b9afb67ece574a6be64498 (patch)
treed654847b52527b0155110d305db1c6b8f9e00a27 /src/rpc.cpp
parent05e871b3053b0e697820b295d59ab54c7423a7e5 (diff)
payout: zero-initialise blockHash; nostr: drop four dead relays
Two fixes. uint256's default constructor is empty (uint256.h:514), so the blockHash field added in 6963862 was uninitialised garbage on every PendingPayout built without an explicit hash -- which is every entry loaded from a ledger written before that commit. Those entries were meant to be grandfathered past the orphan check on a zero hash; instead each carried a random value that matched no block in mapBlockIndex, and the first maturity sweep after deploy voided the whole loaded ledger: 100 entries, 4950 BTF. Only one "was orphaned -- voiding" line reached the log because LogPrint collapsed the other 99 as duplicates, so the destruction was nearly silent. Nothing had been paid at that point and the file was restored from a pre-deploy backup, so no obligation was lost. Assigning 0 explicitly is all that was missing. Separately, four of the twelve relays are dead. Probed all twelve from two independent networks (a residential line and the pool's VPS) over v4 and v6, with DNS confirmed against 1.1.1.1: relay.current.fyi, relay.nostr.bg -- NXDOMAIN, no A and no AAAA. The domains are gone. (A getaddrinfo call on the VPS reports an address for them, but that is the VPS's own IPv6 handed back by its local resolver, not a real host.) relay.nostr.band, nostr.fmt.wiz.biz -- DNS resolves and TCP connects, but the TLS handshake never completes, from either network. Whether they are down or refusing non-browser clients, this node cannot use them. The remaining eight all complete a WebSocket upgrade. A dead relay is not free: each holds a connect/retry slot and delays discovery for no added redundancy. (cherry picked from commit 144bc96f150d23507d57d29cb339f177dcd6b092)
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index b12dc2f..11020d8 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -237,7 +237,11 @@ struct PendingPayout {
237 // owed against blocks that no longer existed, which then drained the 237 // owed against blocks that no longer existed, which then drained the
238 // wallet paying fork-era miners out of real-chain coin. 238 // wallet paying fork-era miners out of real-chain coin.
239 int blockHeight = 0; 239 int blockHeight = 0;
240 uint256 blockHash; // zero = entry predates hash keying 240 // Must be explicitly zeroed: uint256's default constructor is empty
241 // (uint256.h:514), so leaving this unassigned gives every ledger entry
242 // loaded from an older file a garbage hash, which then matches no block
243 // and gets voided as "orphaned". That mistake voided a live payout.
244 uint256 blockHash = 0; // zero = entry predates hash keying
241 int matureAtHeight; 245 int matureAtHeight;
242 std::map<std::string, int64> amounts; // address -> satoshis 246 std::map<std::string, int64> amounts; // address -> satoshis
243 int retries = 0; // exec-thread only: SendMoney attempts so far 247 int retries = 0; // exec-thread only: SendMoney attempts so far