upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-08-09 12:41:44 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-08-19 22:48:26 +0000
commitb75ddafb68ba60902a96b1f11f722b991f21d549 (patch)
tree8c7e975fbad589af3d4bcc140a2806cc8d20c40f
parent44849e619fc66d3345ad675f0128bf5443194db0 (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)
-rw-r--r--src/nostr.cpp16
-rw-r--r--src/rpc.cpp6
2 files changed, 17 insertions, 5 deletions
diff --git a/src/nostr.cpp b/src/nostr.cpp
index fbae1a6..b3e4a7c 100644
--- a/src/nostr.cpp
+++ b/src/nostr.cpp
@@ -78,9 +78,20 @@ static CCriticalSection cs_btfPeers;
78// independent relays. Kept only one Cloudflare-fronted relay (damus.io, the 78// independent relays. Kept only one Cloudflare-fronted relay (damus.io, the
79// most established) and filled the rest with relays on different hosts 79// most established) and filled the rest with relays on different hosts
80// (Hetzner, various independents) so no single upstream provider is a 80// (Hetzner, various independents) so no single upstream provider is a
81// single point of failure for peer discovery. 7 relays lands inside the 81// single point of failure for peer discovery. 8 relays lands inside the
82// commonly recommended 5-10 range for redundancy without keeping an 82// commonly recommended 5-10 range for redundancy without keeping an
83// excessive number of persistent sockets open per node. 83// excessive number of persistent sockets open per node.
84//
85// Four entries were removed after probing all twelve from two independent
86// networks (a residential line and the pool's VPS, over both v4 and v6):
87// relay.current.fyi, relay.nostr.bg -- no A record, and the AAAA for both
88// lands on the same parked host (2a04:c300:1000::381) serving a
89// certificate that fails verification. The domains are gone.
90// relay.nostr.band, nostr.fmt.wiz.biz -- TCP connects, TLS handshake never
91// completes, from both networks. Whether they are down or refusing
92// non-browser clients, this node cannot use them.
93// A dead relay is not free: each one holds a connect/retry slot and delays
94// discovery, so carrying it costs latency for no redundancy.
84const char* pszNostrRelays[] = { 95const char* pszNostrRelays[] = {
85 "wss://relay.damus.io", 96 "wss://relay.damus.io",
86 "wss://nos.lol", 97 "wss://nos.lol",
@@ -95,9 +106,6 @@ const char* pszNostrRelays[] = {
95 "wss://relay.primal.net", 106 "wss://relay.primal.net",
96 "wss://nostr.oxtr.dev", 107 "wss://nostr.oxtr.dev",
97 "wss://relay.nos.social", 108 "wss://relay.nos.social",
98 "wss://nostr.fmt.wiz.biz",
99 "wss://relay.current.fyi",
100 "wss://relay.nostr.bg",
101}; 109};
102const int nNostrRelays = ARRAYLEN(pszNostrRelays); 110const int nNostrRelays = ARRAYLEN(pszNostrRelays);
103 111
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