btc(#744): wire sharechain won-block dispatch (make_on_block_found) - #820
Merged
Conversation
ShareTracker::m_on_block_found fires when a verified sharechain share crosses the BTC network target (share_tracker.hpp L385/L540), but main_btc.cpp never assigned it -- a peer-relayed won share was detected then silently dropped, the full subsidy lost. This adds btc::coin::make_on_block_found: reconstruct the won block (injected reconstructor) then dispatch connect-authoritative dual-path via broadcast_block_for_connect (P2P relay best-effort + submitblock RPC always). Reconstructor injected as std::function so the dispatch is build+run tested now; the faithful share->block reassembly (data.py Share.as_block) is the next slice. Adds won_share_dualpath_test.cpp (3 KATs: both-arms byte-identity, unassemblable -> broadcast-nothing, P2P-fail-still-connects) riding the allowlisted btc_share_test. Per-coin isolation: src/impl/btc/ only.
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.
Gate #744 — BTC won-block dispatch seam.
Problem
main_btcnever assigned the sharechain\x27sm_on_block_foundcallback, so a won share that met the parent target was recorded in the sharechain and then silently dropped: neither the P2Pbroadcast_block_for_connectpath nor thesubmitblockRPC fallback was ever invoked. DGB (#174/#176) already has this seam; BTC did not.Change
src/impl/btc/coin/won_block_dispatch.hpp—btc::coin::make_on_block_found()builds the dispatch callback wiring sharechainm_on_block_foundintobroadcast_block_for_connect, mirroring the DGB shape.won_share_dualpath_test.cpp— KAT covering both arms (P2P announce + RPC fallback) so a regression that drops one arm fails the suite.Evidence this is load-bearing
G3b tuned-net rig (.121) shows won solutions at height 131 submitted and every one going STALE with the parent chain never advancing past 130. The reject-cause visibility half of that landed in #752; this PR is the dispatch half.
Scope
Additive: one new header + one new test, plus the test registration line. No existing BTC path is modified. Rebased onto master; CMakeLists conflict resolved as a union (kept
rpc_conf_test.cpp/genesis_check_test.cppfrom master, addedwon_share_dualpath_test.cpp).I do not self-merge.