mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:44:38 +00:00
WIP: rpc: add testsubmitpackage for 1p1c test submissions #35286
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!35286
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-05-testsubmitpackage_2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A test-only companion to submitpackage that validates a strict 1p1c [parent, child] bundle without mutating the mempool. Intended as a wallet pre-flight check for CPFP fee-bumping packages.
Enables rbf and sibling eviction evaluation, just like submitpackage.
Diverging behaviors from submitpackage:
Hard rejects packages that aren't exactly 2 txs in a child-with-parents topology, and parents that pass individual acceptance (caller should use testsubmitpackage on parent alone for that).
To do this "properly" without rejecting the self-sufficient parents (and not giving surprising results that don't match reality), we would need fairly extensive changes to mempool acceptance logic, more book-keeping to unroll test-accepted subpackage state (while risking mutating the mempool in brittle ways), and possibly other changes.
This is a partial addressing of https://github.com/bitcoin/bitcoin/issues/32160, hopefully addressing most of the missing functionality people are requesting.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
No conflicts as of last run.
LLM Linter (✨ experimental)
Possible typos and grammar issues:
src/validation.cpp:Used f.e. with testsubmitpackage→Used e.g. with testsubmitpackage[f.e.is not the intended English abbreviation for “for example”]Possible places where comparison-specific test macros should replace generic comparisons:
test/functional/rpc_testsubmitpackage.py:assert parent_A.txid_hex == parent_B.txid_hex→ Preferassert_equal(parent_A.txid_hex, parent_B.txid_hex).test/functional/rpc_testsubmitpackage.py:assert parent_A.wtxid_hex != parent_B.wtxid_hex→ Preferassert_not_equal(parent_A.wtxid_hex, parent_B.wtxid_hex).2026-10-21 21:06:07
cc @ajtowns @ismaelsadeeq as discussed, let's focus on concept / approach ACKs first, name is clearly up for debate, etc etc
🚧 At least one of the CI tasks failed.
Task
Windows native, fuzz, VS: https://github.com/bitcoin/bitcoin/actions/runs/25817910490/job/75851154109LLM reason (✨ experimental): Fuzz RPC tests failed because the RPC command
testsubmitpackagewas not registered inRPC_COMMANDS_SAFE_FOR_FUZZING/RPC_COMMANDS_NOT_SAFE_FOR_FUZZING(persrc/test/fuzz/rpc.cpp).Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
Concept ACK, users normally test run submissions to see whether they will get through; so having
testsubmitpackagerpc to test run 1p1c package is very useful.I will review the approach and correctness.
This is simple to reason about. I suggest some improvements that will make the code easier to reason about.
Also, I think there are still opportunities to dedup things in
rpc/mempool.cppshared code oftestsubmitpackageandsubmitpackage, in the code args collection, help text and the logic.In a723ef365c88c3bcbf1f5c1ff00137d62651d6aa
This is weird to read? why is
allow_sibling_evictiontied totest_accept?In a723ef365c88c3bcbf1f5c1ff00137d62651d6aa
test_acceptsites. A helper likeCollectStagedRemovals()would dedup things(Assume(changeset)). Would be nice to make them consistent ( a helper would solve this too since the two code paths are identical).
In a723ef365c88c3bcbf1f5c1ff00137d62651d6aa
I think this is a good time to split the individual-evaluation dry-run path out of ProcessNewPackage into its own function. This removes the
test_package_feeratesparameter, and the branchingProcessNewPackagenow always goes throughAcceptPackage.In a723ef365c88c3bcbf1f5c1ff00137d62651d6aa
test_package_feeratesis a bit hard to read?Can you use a clearer name for this, maybe
test_accept_as_package?In a723ef365c88c3bcbf1f5c1ff00137d62651d6aa
Seems redundant to have this independent.
Can we fold
test_no_mempool_mutation_on_successintotest_basic_1p1c_cpfpthey build the same 1p1c bundle; the mempool-unchanged check belongs alongside thebasic success assertions rather than in a separate test?
In a723ef365c88c3bcbf1f5c1ff00137d62651d6aa
Side note? It seems like a hack to always generate a block when we want to remove a transaction or restart the node, which is much heavier. I think it's part of the reason why the tests are slow.
It is worth having evict from mempool rpc for this case and others, which could eliminate this.
Another way to do this is to also use unit tests, and remove them directly.
@ismaelsadeeq Interestingly I haven't had a lot of positive feedback yet on this PR. In the LN world, for example, the parent may end up having fees >=minfee, due to trimmed htlcs. Many of these projects don't even use test RPCs.
I think it might make sense to look for more buy-in from prospective users before iterating further.
It seems LND uses testflight as a prerequisite for broadcasting.
@GeorgeTsagk mentioned
See https://github.com/2140-dev/bitcoin/issues/24
Would it be possible to somehow test txs with nSequence relative locktimes spending currently out-of-mempool txs? I guess "Assume utxo
txid vout sPK amt heightexists, and validate this tx against it" might be feasible? Would let you check "does this claim tx actually work with this commitment tx, or is there some subtle policy breakage that's been introduced that I didn't check?" I realise this is probably horrible scope creep :)@ajtowns https://github.com/bitcoin/bitcoin/issues/32142 I think?
Concept ACK
The code looks fine to me, but it'd be helpful for users that want this to say so explicitly here, to help us decide if we should maintain this.
It's been a month since this, any update?
🐙 This pull request conflicts with the target branch and needs rebase.
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
Earlier concerns remain unresolved; see the full report for their current assessments.
🔵 Suggestion · The CPFP preflight is outside package validation
The preflight can report the wrong rejection reason when a parent exceeds the caller’s maxfeerate, and package test mode can report the child as missing inputs when the parent passes alone.
Location:
src/rpc/mempool.cpp:1716(head).🔵 Suggestion · The new test-accept package mode lacks fuzz and unit coverage
Parity with
submitpackageand the no-mutation guarantee are not checked by unit or fuzz tests for this mode.Location:
src/validation.cpp:1846(head).🔵 Suggestion · The parameter documentation contradicts an assertion
A future caller following the documented instruction to ignore
test_package_feerateswhentest_acceptis false would abort the node; no current caller does this.Location:
src/validation.h:283(head).🔵 Suggestion · The constructor comment contradicts the sibling-eviction invariant
The comment says sibling eviction may occur with package feerates, but the following assertions and constructor arguments prohibit it.
Location:
src/validation.cpp:574(head).Review coverage was incomplete.
Reviewed:
98cdef352643· Full review report · Previous reportsI think this is relevant if we want to support private broadcast via
submitpackage. Right now we have no way to test the validity before queuing the package for private broadcast. I'm not sure about consumers of the test RPC though, which is the bulk of the code here. If there is not yet indication of buy-in for the RPC, could we instead split out just the internal dry-run ofProcessNewPackageinto its own change?A bit of a late comment here but wanted to double down on the fact that we rely on the test endpoints to prepare/shape our batch transactions before we actually submit them in LND.