Repository navigation
main: retry submitblock, fall back to a second node, keep the block on disk - #104
Open
asilgulsar1 wants to merge 1 commit into
Open
asilgulsar1 wants to merge 1 commit into
asilgulsar1 wants to merge 1 commit into
Conversation
…n disk A found block was marked 'rejected' after a single submitblock attempt that got no usable answer (connection refused, timeout, non-200/500, RPC error). 'rejected' is final for reconcile, and the block hex is only logged at DEBUG, so an enforcer restart at the moment a share solved a block lost the block. - The block is written to <db dir>/found-blocks/<ms>.hex before submission. - An attempt with no usable answer is retried with backoff for up to 120 s. - Optional submit_fallback_url/_user/_pass: a second node tried on each failed round (e.g. the node behind the enforcer, as a submitblock-only rpcauth user). - "duplicate", "duplicate-inconclusive" and "inconclusive" are not refusals. - Only a node's refusal (BITCOIND_SUBMIT_REFUSED) is filed 'rejected'; a block no node answered for is filed 'pending', and reconcile settles it from the chain like any other. Retries run on the finder's connection thread, holding no lock: only that connection waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
We run simplepool in solo mode for eCash.com (ECX, BIP300/301) behind the CUSF enforcer. These came out of a review of the solo path before we rely on it.
A found block is marked
rejectedafter onesubmitblockattempt that gets no usable answer: connection refused, a timeout, HTTP other than 200/500, or an RPC error.rejectedis final for reconcile, and the block hex is logged only at DEBUG. So an enforcer restart at the moment a share solves a block loses that block.<db dir>/found-blocks/<ms>.hexbefore submission.submit_fallback_url/_user/_passset a second node, tried on each failed round (with the enforcer asbitcoind_url, the node behind it; asubmitblock-only rpcauth user is documented in proxy.conf.example).duplicate,duplicate-inconclusiveandinconclusiveare not treated as refusals.BITCOIND_SUBMIT_REFUSED) is filedrejected. A block no node answered for is filedpending, and reconcile settles it from the chain.Retries run on the finder's connection thread with no lock held (
cb_lockis released beforeon_block, and the job is a counted reference), so only that connection waits.Tests:
test_submit_answers(null, duplicate*, inconclusive, a reject reason, duplicate-invalid, and no server at all). We also ran it end to end against a mock enforcer and node: 503 + fallback →pendingvia the fallback; 503, no fallback →pendingafter 119 s, file saved;duplicate→pending; a reject reason →rejected.Open question for maintainers: filing a block nobody answered for as
pendingchanges whatpendingmeans: it no longer guarantees a node accepted it. If you'd rather keep that, a separate status (e.g.unconfirmed) would do.Tested:
make testpasses on this branch alone, and the new test fails onmainwithout the fix. This PR is independent of the five others opened alongside it, and all six merge together cleanly. Happy to add a CHANGELOG entry if you'd like one.🤖 Generated with Claude Code