Skip to content

btc: guard both broadcast_block_with_fallback legs vs throwing sink - #474

Merged
frstrtr merged 1 commit into
masterfrom
btc/broadcast-leg-guard
Jun 25, 2026
Merged

btc: guard both broadcast_block_with_fallback legs vs throwing sink#474
frstrtr merged 1 commit into
masterfrom
btc/broadcast-leg-guard

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 25, 2026

Copy link
Copy Markdown
Owner

What

Guards BOTH legs of btc::coin::broadcast_block_with_fallback against a throwing sink (mirror of NMC #468).

Why (real silent-drop defect)

A throwing relay_p2p() sink unwound PAST the function, bypassing the submitblock RPC fallback entirely and silently dropping a won block -- the exact P2P-unavailable/relay-failed hole the fallback exists to close, and a violation of the doc-comment promise that a won block is never silent-dropped.

Fix

  • Throwing primary relay -> treated as relay-failed, falls through to the submitblock fallback.
  • Throwing last-resort submit_rpc -> collapses to a definite false so the callers documented scream / lost-subsidy path fires instead of an exception escaping the won-block handler.

Tests

6 KATs in block_broadcast_guard_test.cpp, riding the already-allowlisted btc_share_test exe (no build.yml allowlist change, no #137 NOT_BUILT risk). Local: 6/6 pass, full btc_share_test 27/27 green. The throw-guard KATs bite (EXPECT_NO_THROW fails on the pre-fix impl).

v36 standardization (bucket 2)

Same un-guarded-leg claim-vs-impl gap exists in DGB/BCH dual-path broadcasters -- a v36-native shared-structure standardization opportunity, flagged for those stewards.

A throwing relay_p2p() sink unwound past broadcast_block_with_fallback,
bypassing the submitblock RPC fallback entirely and silently dropping a
won block -- the exact hole the fallback exists to close, and a violation
of the doc-comment contract that a won block is never silent-dropped.

Guard both legs: a throwing primary relay is treated as relay-failed and
falls through to the submitblock fallback; a throwing last-resort
submit_rpc collapses to a definite false so the caller scream path fires
instead of an exception escaping the won-block handler. Mirror of the NMC
broadcast leg-guard fix (#468). 6 KATs ride the already-allowlisted
btc_share_test exe (no build.yml allowlist change, no #137 NOT_BUILT risk).
@frstrtr
frstrtr merged commit c67e7b9 into master Jun 25, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant