btc(v36): advertise raw head at handshake + re-advertise on best-change (root-2) - #105
Merged
Merged
Conversation
…ge (root-2) On a --genesis node the verified share set is empty at the version handshake, so send_version advertised best_share_hash()==ZERO and the connecting peer never issued download_shares() for our chain. Add advertised_best_share(): returns think()s current best, else the tallest raw chain head, else ZERO only at true genesis. Wire it into send_version so a peer always learns we have a chain and pulls it, while work/template selection stays on the verified-only best_share_hash(). Re-advertise the head via readvertise_best() on every successful think IO-phase work refresh and on clean_tracker best-change, so a peer that handshook during the verified-empty window still gets our head. Guarded on non-empty peers and non-ZERO head; broadcast_share keeps its try_to_lock so this cannot reintroduce the think/broadcast livelock. BTC mirror of LTC b56bfb2 (ltc-doge/root2-genesis-null-advert).
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.
BTC mirror of the Root-2 genesis-null-advert fix (LTC source: b56bfb2 on ltc-doge/root2-genesis-null-advert).
Problem: send_version advertised best_share_hash() (verified-only), which collapses to 0x000 once any peers exist. On a fresh --genesis node the verified set is empty at handshake, so the peer never issues download_shares() and broadcast cannot backfill (head shares already de-dup-marked) -> sync deadlock.
Fix (src/impl/btc/node.cpp, node.hpp):
Livelock-safe: no new exclusive lock; broadcast_share keeps try_to_lock. Mirrors the LTC diff shape exactly (+114/-1 equivalent, content-verified against b56bfb2).
Verification: ctest 100% (590 passed, 0 failed) at 659b95c. GPG-signed, no attribution.
Note: supersedes branch btc/root2-advert-readvert (b3c0bbec), which mirrored the earlier LTC variant e01c160. That branch should NOT also be opened as a PR.