Repository navigation
friglet: harden broadcast, peers and Tor (SNB-853) - #88
Open
setavenger wants to merge 66 commits into
Open
setavenger wants to merge 66 commits into
setavenger wants to merge 66 commits into
Conversation
…proxy (SNB-857) A tray from before p2p_proxy drops the unknown field and sent whole configurations without it, so saving any setting turned Tor off. SetConfig and ApplySettings now carry a ConfigUpdate: the same JSON on the wire, plus whether p2p_proxy was present. An omitted proxy keeps the daemon's; only an explicit null clears it, which the current tray always sends for an empty field. The daemon still logs a warning for a clear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n (SNB-855) Sampling fee filters waited for every connection it opened, so one peer that did not answer held the relay fee for its whole connect timeout and Sparrow's request got the 1 sat/vB default after 2 s. Sampling now ends as soon as a quorum of peers has sent filters; the other connections finish and count for the next call. A relay fee request that cannot wait longer answers from the filters known by then (the lowest below the quorum) and only falls back to the default when there are none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SNB-855) Through a proxy, the race for a header connection dropped its winner when the shared connection was busy as it opened, but kept the peer as asked, so the request could run out of peers. The winner now goes to the request, which puts it in the shared slot once that is free. A peer that does not know a header was reported Behind: rested for block downloads too and no longer the preferred block peer, also when the hash was merely newer than its tip. It is now skipped for that request only. With discovered peers a header request asked the pool for a peer and replaced the open connection whenever it picked another one; the peer of the open connection now goes first while that connection is fresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its GetStatus arm locked the config twice in one expression, and the first guard lives to the end of the match arm, so the second lock waited forever and the tray never attached to the fake daemon. It reads the config once per request now. AGENTS.md notes how to screenshot the tray on bare Xvfb without imagemagick and fluxbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Random peers see the computer's IP and the blocks it fetches; the field label now says the own node is recommended, as the hint below it explains. README follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SNB-853) README and AGENTS.md: a peer dropping the connection after receiving a transaction does not prove it invalid and is not reported as a rejection; separate Tor circuits can still share an exit relay; pending rechecks ask two peers that never got the transaction every 10 minutes for up to 14 days, about all pending transactions on one connection each, so those peers can link them; the broadcast error comes after 45 s through Tor; the relay fee is the median of recent feefilters, answered once a quorum is in; an older tray's save keeps p2p_proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(SNB-856) A fee filter above 0.1 BTC/kvB (a peer in its initial block download, or one outside 0..=u32::MAX, read as u64::MAX / 1000) is a peer saying "send me nothing", not a mempool minimum. fee_shortfall now makes no fee claim for it instead of multiplying it by the vsize, which overflowed (a panic in debug builds) for any transaction over 1 kvB. Own node and discovered peers alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-856) A peer asked by txid (no wtxid relay) serves whichever witness its mempool holds; a copy with the same txid and another witness used to count as this transaction being accepted. mempool_has now requires the wtxid too, for the own node, observers and rechecks alike. Recent broadcast outcomes are keyed by wtxid, so a resend with the same txid but another witness (for example one that does not verify) is broadcast instead of getting the first one's answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
state.pending.json names the peers friglet handed the wallet's transactions to; it was written with the default umask (0664 here). It is now 0600 like the state file, also when a leftover temporary file had other permissions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Connections of one broadcast share a ledger. A sender enters a peer there before writing the transaction to it (on request, unasked, or re-requested while it listens), under the lock that ends the broadcast; ending it shuts the gate and every open observer and sender connection down. So: - the list of peers the transaction went to is taken from the ledger when the broadcast decides, and holds every peer that may have it, also one whose hand-over report was still on its way; - no transaction bytes are written after the answer, and a request arriving later goes unanswered; - observers and senders blocked in a wait (a mempool answer, the pong) end at once instead of after their 5 to 15 s timeouts; a connect still under way may finish, but its connection is shut down at once and sends nothing. A broadcast that ends with "no peers reachable to take the transaction" while a sender may have handed it over reports it as not confirmed, with that peer, instead of claiming nothing was sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (SNB-856) The peers an attempt handed a transaction to were only remembered for an accepted one, or for 120 s in memory: after that, or after a restart, a later attempt could take one of them as observer and call the transaction accepted on the strength of the copy friglet itself gave it. - The pending-broadcast file now keeps every discovered peer a transaction went to, whatever the verdict (unconfirmed, dropped, rejected): in the pending entry, or in a new handed_to list for one that is not pending, kept until 14 days (Bitcoin Core's mempool expiry) after the latest hand-over. A replaced or expired pending broadcast keeps its list there; a confirmed one forgets it. Accepting a transaction (also again) merges every earlier list. Files without handed_to still load. - A broadcast never picks those peers as observers or senders, and passes over their network groups while the pool has other peers. - A resend after an inconclusive wait asks a peer outside that list, falling back to peers in its network groups when no other group is left, as rechecks already did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ver (SNB-856) - A pending broadcast's sent_to no longer forgets its oldest peers after 16: a forgotten peer became an eligible "unrelated" checker after a few hours of reannouncements. The list is bounded by the entry's lifetime (at most one peer per recheck every 10 minutes for up to 14 days). - A recheck records (and saves) the peer it hands lost transactions to before anything is sent, so a hand-over that fails halfway (the peer closes before the pong, or partway through a batch) still keeps that peer out of later checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for good (SNB-856) - A sender's peer asking for some transaction after the hand-over counted as "missing inputs" whatever it asked for. Now only a request for one of the transaction's parents (an input's txid) counts. - A parent friglet broadcast itself and still holds (pending) is handed to a peer that asks for it, so a child of an unconfirmed broadcast goes out instead of being rejected; that peer is kept out of the parent's rechecks. - A rejection needs at least two senders giving the same answer (and every sender that got it): one peer may just lack an unconfirmed parent. - "Every sender asked for a parent" keeps Sparrow's bad-txns-inputs-missingorspent prefix, says those peers lack the outputs (spent, or their transaction has not reached them), and is no longer answered as final: a resend looks again. The own node's broadcast keeps its rules and wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SNB-856) Once two senders had the transaction, no further one was started even when neither passed it on: the rest of the 25 s (45 s) budget was spent waiting. Now, when no observer has had it for a quiet spell after the latest hand-over and no sender is still connecting, one more sender gets it, outside every earlier peer and its network group; at most 4 peers in all (2 more than before). The quiet spell is 10 s directly: a peer that takes a transaction passes it on within seconds and an observer announces it to friglet every 5 s on average, and a hand-over about 3 s in still leaves the further sender about 10 s. Through a proxy it is 12 s, as the observers' announcements cross circuits too. Each further sender is one more stranger that sees this address (or a Tor exit) hand the transaction over, hence the quiet spell first and the small cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wake-ups (SNB-856) - When every observer has gone away after the hand-over and none can replace them, the broadcast ends at once with a message that says whether anyone else has it is unknown, instead of waiting out the budget and then claiming no other peer had it. If they all go before anything was handed over, nothing is handed over. - The broadcast loop no longer wakes every 250 ms once the observer window has passed: it sleeps until the next timed step still ahead (observer limit, hedge, rotation, deadline) or the next event. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…action (SNB-856) Every sender dropping the connection after the hand-over was explained as what Bitcoin Core does with a consensus-invalid transaction; Bitcoin Core 30+ no longer disconnects for that, and a peer can also just go away. The message now says older versions do that, newer ones do not, that it does not prove the transaction invalid, and that a resend checks again (it was already kept inconclusive). The module docs say the same, and no longer claim that separate Tor circuits mean separate exit relays. The own node's wording is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing failed when the own-node branch of the pending recheck or of the resend look was broken: the discovered-peer path asked the own node too and got the same answer. New tests check that with an own node a recheck uses one relay connection to it and re-announces there without recording any peer, and that a resend asks the own node even when its version says it relays nothing (-blocksonly), which the discovered-peer path refuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NB-857) Through p2p_proxy, SOCKS reply 0x03 (network unreachable) describes the proxy's network. A broadcast or recheck connection reported it as this computer having no route, which for an IPv6 peer made the pool skip every IPv6 peer for 30 minutes. It now counts as an ordinary unreachable peer; direct connections keep the no-route rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…answers (SNB-857) Every read and write of the SOCKS5 exchange now waits only for the time left until the connection's deadline, so a proxy that drips its reply a byte at a time can no longer stretch a 20 s connect to 30 s or more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A block fetch opens its connection with Dialer::open: a direct connection opens on the async runtime, as before the discovery work, so a stop or a restart abandons a connect to a node that drops packets at once instead of leaving a blocking thread in it for up to the connect timeout. Through the proxy the blocking connect's socket is shut down when the caller stops waiting. Addresses, timeouts, retries and error words are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A discovered-peer fetch now runs connect and handshake as one cancellable unit per peer. Through a proxy a connection that opens while another one downloads completes its handshake at once, instead of idling until that download failed and then being timed from the wrong moment, and every connection still under way closes as soon as the block has come. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…855) After serving a block, a discovered peer gets 3 s to send the addresses it was asked for. Each read now may take all of the time left, so a message that pauses halfway is no longer cut and its addresses lost, and a task owns the connection until then: it shuts it down when the wait is over or the scan stops, so a peer that trickles a message can no longer keep the download thread and its socket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st seed (SNB-857) Asking a seed's node through the proxy is now cancellable and bounded: each read may take all the time left (an answer that pauses halfway is no longer cut), and the asking task shuts the connection down at the deadline even while a message trickles in. Seeding returns as soon as the seeds' nodes have given 20 addresses; the seeds still being asked add theirs to the address book when they answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-857) A connect through the proxy that gets no clear answer (no reply in time, a general failure) is reported as PeerEvent::ProxyUnclear. The address book counts it as unreachable while the proxy works: a connection through it completed a handshake in the last 10 minutes and fewer than 8 connects have failed this way since. Dead addresses in the saved book are evicted again, while a Tor outage still only rests peers and cannot empty it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns (SNB-855) Saving copies the book's records under its lock and writes and syncs the files without it, one save at a time, so a slow disk no longer stalls every connection that asks for a peer. The copy repeats, per record, the successful and failed connections the live table counted, so the files hold what they held before. Loading refuses a file that lists more than twice the records its table has slots for, before reading any. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…B-857) net::is_no_route(error, peer) decides whether a failed connect means this computer has no route to the peer's network. A SOCKS5 "network unreachable" reply is about the proxy's routes (Tor's exit), so it now counts against the peer instead of making the scanner skip every IPv6 peer for 30 minutes. Directly, "host unreachable" and "address not available" for an IPv6 peer count as no route too, as hosts without IPv6 answer that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bitcoin Core announces its own address in a message of its own right after the handshake. Such a message no longer counts as the peer's answer to getaddr: its address still goes in the book, but the download keeps waiting for the real answer after the block, and the peer is asked again next time. One other address, or more, is an answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A completed handshake promotes a discovered peer to "tried" only when its version offers every block with witnesses (NETWORK and WITNESS). Header and fee connections accept any peer, so a pruned node they met no longer takes a tried slot meant for block downloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SNB-856) That a peer relays no transactions is now kept in a set of its own rather than in the peer's address-book entry, which a slot collision in the tried table or repeated failures can drop. A blocks-only peer that leaves the book and comes back through gossip is no longer handed out for relaying again. It is still learnt again after a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y (SNB-857) Tor's connections leave from the internet, so an own node on this computer or the local network (a loopback, private or link-local address, localhost, a .local name) can never be reached through p2p_proxy. Config validation now refuses that combination with a message that says what to do instead, and the tray's setup validation applies the same rule, shared through friglet-ipc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y that reaches it (SNB-857) With p2p_proxy set, the daemon and the tray's setup refused a node on this computer or the local network, as if every SOCKS5 proxy were Tor. A proxy such as ssh -D can reach it, so the combination is accepted again and the connection still goes through the proxy. When the proxy cannot connect to such a node, the block download's error adds that Tor cannot reach this computer or the local network, and what to do with Tor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NB-855) An IPv6 connect that failed with "host unreachable" counted as this computer having no IPv6 route: every IPv6 peer was skipped for 30 minutes and the peer was never blamed. A router on the way says that about one address, so it now counts as the peer being unreachable. "Network unreachable" and, for IPv6, "address not available" still mean no route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only a full node's handshake reset its failures and recorded its services; a header or fee connection to a pruned peer left both as they were, so earlier failures still counted towards forgetting it. Every handshake now resets the failures and updates the services; only moving to the tried table stays reserved for full nodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each save rebuilt the tables by replaying every peer's successful and failed connections, which stamped all of them with the time of the save. The pool's copy of each record now takes the times when the connection happens, as the table's copy does, and is saved as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…never dropped (SNB-857) Through a proxy, seeding returns once some seeds gave enough addresses and the others answer later. Those later addresses did not count towards what the seeding found, so seeds that seemed to give nothing were asked again after 30 s instead of 5 min, and the next seeding replaced the queue of later answers, dropping any still to come. Later answers now count, and each seeding's queue is kept until its last seed answered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rs (SNB-857) The task collecting the answers of seeds still being asked when seeding returned repeated the seeding loop's handling but left out the proxy failing: a proxy that went down meanwhile was only logged at debug level as the seed's failure. Both now take each answer the same way, and a proxy failure among the later answers is noted and logged as during seeding. FakeSocks5 can hold a CONNECT until a test opens a gate, and go down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…block (SNB-857) A raced connection whose handshake completed while another connection downloaded waited for its turn, but its time limit counted from when it opened, so after a long download it was blamed as too slow before the block could arrive. Its limit now counts from when its block request starts, less what its handshake took. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…takes (SNB-857) Four tests relied on sleeps and tight windows that a busy machine can miss: the racer handshake test (500 ms head start, 300 ms window), proxied seeding (800 ms answer, 1.5 s sleep), a stop while a peer trickles (500 ms sleep, then a time difference that could be negative) and the dripping SOCKS5 reply (1.8 s limit). They now hold connections and answers behind gates the test opens once the step before has happened, check the order of two moments before taking their difference, and keep a wide margin between their limits and what a regression would take. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A peer that offers witnesses but not BIP 339 wtxid relay (protocol 70015, own node or discovered) is now asked for a transaction with MSG_WITNESS_TX instead of MSG_TX. Bitcoin Core answers MSG_TX without the witness, whose wtxid then never matched, so such an own node reported a transaction it had accepted as missing: the broadcast failed and rechecks re-announced it. The returned copy must still carry the transaction's wtxid, and announcements still go by txid to such a peer. The test peer now serves MSG_TX without witnesses, as Bitcoin Core does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…over (SNB-856) Every peer a broadcast to discovered peers hands the transaction (or a pending parent) to now goes into the pending store, and the file, right before the bytes are written to it. Before, a round's recipients were saved only once the broadcast returned normally, so a settings restart or a stop that dropped it after a hand-over forgot them, and the next attempt could take one of them for an unrelated peer confirming it. The save after the round is gone; the store is shared with the round's connections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nwhile (SNB-856) A pending recheck runs on its own timer, so it can hand a transaction to an observer of a resend of that transaction under way (or a broadcast can hand it to a peer a recheck has just picked to ask). That peer's copy was then counted as an unrelated peer having it. Now an observer's copy, and a recheck's or resend's mempool answer, counts only when the pending store does not list the peer as a recipient of that transaction, looked up after the answer arrived: every hand-over is written there before its bytes go out, so a copy friglet gave the peer is always caught. Such an observer is dropped and replaced. Client broadcasts are not held up by rechecks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(SNB-856) Two senders asking for a parent friglet does not hold used to end the broadcast at once with the missing-inputs error, before any other peer was tried. Those peers may only lack an unconfirmed parent while the transaction spreads from elsewhere. Now observers keep watching and a further sender still gets it after the quiet spell, within the budget; the missing-inputs wording comes only at the end, when no observer had it and every sender that got it asked for a parent. Every sender dropping the connection still ends the broadcast at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (SNB-856) The further sender after a quiet spell waited until no sender was connecting. Through a proxy a hedged sender to a dead address stays connecting for the whole 20 s connect timeout, so the rotation came that much later or not within the budget. Now it comes a quiet spell after the latest hand-over, and after the latest rotation, whatever is still connecting; hand-over slots still cap who gets the transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ents (SNB-856) A sender's peer that lacks a parent friglet still holds as pending gets it, but when that parent spends another pending transaction of the wallet, the peer's request for that one went unanswered and the child could never be accepted. Now every pending ancestor (parents, their parents, and so on) is handed over when asked for, each written to the pending store first, and a request for an input of one of them that friglet does not hold counts as missing inputs like a parent's. The test peer asks for each missing ancestor in turn, and knows which inputs are confirmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Observer and sender connections, and those of a pending recheck's mempool check, now open asynchronously (Dialer::open, then the handshake on a blocking thread whose socket is shut down when nobody waits any more). When a broadcast ends, connects and handshakes still under way are abandoned at once, as the connections already up were shut down before. Through Tor a dead address used to keep its connect running for 20 s after the broadcast, and a peer that never answered the handshake as long; a mempool check's surplus racers likewise. Abandoned connections are not counted against their peers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cold header request through the proxy connects to three peers at once and uses the first one up. When that peer lacked the header, the other two were passed over as if asked, although they never got the request: with only those peers known the request failed while they could serve it. Now the racers are asked in the order they connect, before any other peer, and the ones still connecting or unused are abandoned when the request ends instead of running out their 20 s connect timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-856) The tests that end a broadcast while an observer waits for an answer, or a sender for its pong, required the connection to end within 1 s of the end, while the wait they guard against was over after 5 s, so a loaded machine could fail them. Those waits now last the job's whole minute in the tests (the observer's answer wait is a Timing setting, 5 s as before), and "at once" means within 10 s. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts written first (SNB-856) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lood (SNB-855) A peer could answer one getheaders with headers message after headers message until the request timed out (15 s), and every header was kept: a discovered peer could fill memory that way. Now only a header whose hash is the one asked for is kept, and a peer that sends more than 100 messages before its pong is given up on (the header connection is dropped and the next peer asked). The test peer can flood a header request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SNB-856) A broadcast or recheck writes every peer it hands a transaction to into the pending file before the bytes go out, but a failed write was only logged and the transaction went out anyway: after a restart that peer was missing from the file and could later confirm the transaction as an unrelated peer. Now the write's result decides. When it fails a broadcast sends nothing to that peer and ends with a local storage error naming the file; a recheck hands the lost transactions to nobody and logs that error. The file is also synced before it replaces the old one, and its directory after the rename (Unix), so the recipients survive a crash or power loss, not only a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A recheck that hands lost pending transactions over wrote each asked peer down as having them before connecting to it. A peer that then could not be reached was kept as a recipient for good, so every 10 minutes the list could grow by peers that never got anything, until no network group was left to ask. Now the peer is written down once its connection and handshake are up, still before anything of the transactions is sent; a write that fails ends the hand-over with the local storage error. The test peer can report what the pending file says as a transaction arrives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every transaction a sender's peer got, the broadcast one and each held ancestor it asked for, rewrote the whole pending file under the store's lock, so a child with several pending ancestors handed to a few senders rewrote it many times. Now the first hand-over to a peer writes it down for the transaction and every held ancestor at once (the peer may ask for any of them), still before any of them is written to it; what it asks for later needs no further write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(SNB-857) PeerAddr::is_local decides whether a failed connect to the own node through p2p_proxy adds the hint that Tor cannot reach this computer or the local network. It repeated part of the address book's public-address check and left out 100.64.0.0/10, so a node on a Tailscale address got no hint. It now counts every address that is not public by that check, plus localhost and .local names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… test the seed cap (SNB-857) The stop-while-trickling test could see the 3.5 s address wait close the connection before its stop on a slow machine; that wait is now set per fetcher (ten minutes in this test only, unchanged otherwise), so the stop always comes first. The test of connections still opening when a broadcast ends now holds the live peers back until the stalled SOCKS request and the silent peer's handshake are under way, and requires the silent connection to close while the runtime still runs (runtime shutdown alone used to close it, so the test passed without the cleanup). The hedge test holds the live peers until a hedge has started and gives the broadcast less time than a dead connect waits, so it no longer depends on which peers are picked first or on a 19 s margin. A seed answer of 1,500 addresses keeps the first 1,000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion (SNB-855) On the own-node path the shared header connection's lock was taken on the runtime, so the 2 s limit of blockchain.relayfee could not fire while a header request held it (up to 20 s through a proxy). The lock is now waited for in a blocking task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… sent (SNB-857) Seeding through a proxy returned once the seeds' nodes had sent 20 addresses, before the book refused non-public ones, bad ports, duplicates and slot collisions, so it could return with none usable while other seeds were still being asked. The seeds' answers now go to the pool as they come, and it waits while fewer than 20 were added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er as missing inputs (SNB-856) When every observer went away before the budget ended, the broadcast ended with the final verdict, which reports missing inputs when every sender asked for a parent. Missing inputs need the whole budget with no observer having the transaction; with the observers lost early the outcome is now the lost-observers one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wered getaddr (SNB-855) A message of one address counted as a getaddr answer unless it was the peer's own IP address, so a node announcing its onion address was not asked for addresses again. A single address now answers only when it is an IP address other than the peer's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k (SNB-857) When one racing connection delivered the block, the racers that had already finished (a failed connect or handshake, a completed handshake) were dropped without telling the peer source, so a dead address was not rested and a live one not moved to tried. Their outcomes are now reported before the set is dropped; racers still under way are not waited for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…slower racers in turn (SNB-853) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardens the peer pool, multi-peer broadcast and Tor support of SNB-853. Stacked on #87 (SNB-857).
Broadcast without an own node
MSG_WITNESS_TX) (own node too).Peers and block fetching
getaddr; only full nodes (NETWORK and WITNESS) move to the tried table, while every completed handshake ends a peer's run of failures; a blocks-only peer stays out of relaying for the whole session; "host unreachable" counts against the peer and leaves IPv6 on.blockchain.relayfeeanswers as soon as a quorum of fee filters is in, and within 2 s also when a header request holds the connection (own node too).getaddr; racers that already finished are reported when another delivers the block.Tor / SOCKS5
localhost,.local) stays allowed withp2p_proxy, since a SOCKS5 proxy other than Tor may reach it; when the connect through the proxy fails, the error adds that Tor cannot reach the local network.p2p_proxy(an older tray) keeps the daemon's proxy; only an explicitnullclears it.Tray and docs
GetStatusagain.Tests
check_blockcheck (oracle hash, merkle root, witness commitment); deterministic failover order; handshake fields through the proxy; the daemon's own-node wiring; timeouts on discovery tests that could otherwise hang. Timing-sensitive tests order their steps with gates instead of sleeps.cargo test --workspace: blindbit-lib 159, thread soak 1, friglet 160, console 1, friglet-ipc 31+1, friglet-tray 69+7; all pass. CI clippy line andcargo fmt --checkclean.straceshowed connects only to the node, the oracle and the local resolver; a mempool transaction re-broadcast with no node set was confirmed by a peer it was not handed to, and an old confirmed one was rejected as missing inputs; through Tor (in Docker), seeding, block fetches and the same broadcast worked with connects only to the proxy and the oracle.Known limits
bitcoin-p2p(its reader allocates the announced length before reading); it follows in a separate commit that pins the patched crate.