rpc: fix #628 active-chain txn-already-known distinction - #633
Closed
Hero-Gamer wants to merge 7 commits into
Closed
Hero-Gamer wants to merge 7 commits into
Hero-Gamer wants to merge 7 commits into
Conversation
Fixes reardencode#628. Uses tx_fk_by_txid_tip + is_confirmed_strong (active-chain) before mempool duplicate check. Preserves txn-already-in-mempool for live dupes and handles reorg (archive-only tx not treated as known).
Fix silent dead branch unwrap_or(false) per CONTRIBUTING checklist. Query/store failure now returns RPC error instead of being treated as not-confirmed, which could cause incorrect accept/reject. Uses ERR_MISC directly (not crate::server::ERR_MISC).
- Pins txn-already-known for active-chain confirmed - Preserves txn-already-in-mempool for live dupes - Ensures archive-only after invalidate is not reported as known - Fixes fee/test setup to include tx in mined block
Contributor
|
Taken over in the follow-up PR on |
2 tasks
Contributor
|
Takeover PR: #638 |
Contributor
|
Takeover PR is #638 (already required-green). |
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.
Fixes #628
Problem:
testmempoolacceptwas returningtxn-already-knownfor any txid found anywhere (including archive/reorged blocks), not just active chain. That conflates confirmed vs mempool paths.Fix in
crates/rbitcoin-rpc/src/methods/mempool.rs:txn-already-knownmp.test_accept()(preservestxn-already-in-mempoolfor live mempool dups)rpc_error(ERR_MISC, "query failed: {e}")instead of being swallowedTests in
crates/rbitcoin-rpc/src/methods_tests.rs:testmempoolaccept_628_confirmed_is_already_known- active chain tx ->txn-already-knowntestmempoolaccept_628_mempool_duplicate_is_already_in_mempool- live mempool path still workstestmempoolaccept_628_reorged_archive_not_already_known- afterinvalidateblock, tx exists only in archive, must beallowed=true(assertsallowed=trueandreject-reason != txn-already-known)CI on f9ce78e: 14 successful, 2 skipped, 0 failing (ci / codeql / core-functional green)
Scope: 2 files only - mempool.rs + methods_tests.rs