You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin/bitcoin#20833: rpc/validation: enable packages through testmempoolaccept
13650fe [policy] detect unsorted packages (glozow)
9ef643e [doc] add release note for package testmempoolaccept (glozow)
c4259f4 [test] functional test for packages in RPCs (glozow)
9ede34a [rpc] allow multiple txns in testmempoolaccept (glozow)
ae8e6df [policy] limit package sizes (glozow)
c9e1a26 [fuzz] add ProcessNewPackage call in tx_pool fuzzer (glozow)
363e3d9 [test] unit tests for ProcessNewPackage (glozow)
cd9a11a [test] make submit optional in CreateValidMempoolTransaction (glozow)
2ef1879 [validation] package validation for test accepts (glozow)
578148d [validation] explicit Success/Failure ctors for MempoolAcceptResult (glozow)
b88d77a [policy] Define packages (glozow)
249f43f [refactor] add option to disable RBF (glozow)
897e348 [coins/mempool] extend CCoinsViewMemPool to track temporary coins (glozow)
42cf8b2 [validation] make CheckSequenceLocks context-free (glozow)
Pull request description:
This PR enables validation dry-runs of packages through the `testmempoolaccept` RPC. The expectation is that the results returned from `testmempoolaccept` are what you'd get from test-then-submitting each transaction individually, in that order (this means the package is expected to be sorted in topological order, for now at least). The validation is also atomic: in the case of failure, it immediately halts and may return "unfinished" `MempoolAcceptResult`s for transactions that weren't fully validated. The API for 1 transaction stays the same.
**Motivation:**
- This allows you to test validity for transaction chains (e.g. with multiple spending paths and where you don't want to broadcast yet); closes #18480.
- It's also a first step towards package validation in a minimally invasive way.
- The RPC commit happens to close #21074 by clarifying the "allowed" key.
There are a few added restrictions on the packages, mostly to simplify the logic for areas that aren't critical to main package use cases:
- No package can have conflicts, i.e. none of them can spend the same inputs, even if it would be a valid BIP125 replacement.
- The package cannot conflict with the mempool, i.e. RBF is disabled.
- The total count of the package cannot exceed 25 (the default descendant count limit), and total size cannot exceed 101KvB (the default descendant size limit).
If you're looking for review comments and github isn't loading them, I have a gist compiling some topics of discussion [here](https://gist.github.com/glozow/c3acaf161c95bba491fce31585b2aaf7)
ACKs for top commit:
laanwj:
Code review re-ACK 13650fe
jnewbery:
Code review ACK 13650fe
ariard:
ACK 13650fe
Tree-SHA512: 8c5cbfa91a6c714e1c8710bb281d5ff1c5af36741872a7c5df6b24874d6272b4a09f816cb8a4c7de33ef8e1c2a2c252c0df5105b7802f70bc6ff821ed7cc1a2f
"\nReturns result of mempool acceptance tests indicating if raw transaction (serialized, hex-encoded) would be accepted by mempool.\n"
889
-
"\nThis checks if the transaction violates the consensus or policy rules.\n"
889
+
"\nReturns result of mempool acceptance tests indicating if raw transaction(s) (serialized, hex-encoded) would be accepted by mempool.\n"
890
+
"\nIf multiple transactions are passed in, parents must come before children and package policies apply: the transactions cannot conflict with any mempool transactions or each other.\n"
891
+
"\nIf one transaction fails, other transactions may not be fully validated (the 'allowed' key will be blank).\n"
892
+
"\nThe maximum number of transactions allowed is 25 (MAX_PACKAGE_COUNT)\n"
893
+
"\nThis checks if transactions violate the consensus or policy rules.\n"
890
894
"\nSee sendrawtransaction call.\n",
891
895
{
892
896
{"rawtxs", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array of hex strings of raw transactions.\n"
"Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kvB\n"},
899
904
},
900
905
RPCResult{
901
906
RPCResult::Type::ARR, "", "The result of the mempool acceptance test for each raw transaction in the input array.\n"
902
-
"Length is exactly one for now.",
907
+
"Returns results for each transaction in the same order they were passed in.\n"
908
+
"It is possible for transactions to not be fully validated ('allowed' unset) if an earlier transaction failed.\n",
903
909
{
904
910
{RPCResult::Type::OBJ, "", "",
905
911
{
906
912
{RPCResult::Type::STR_HEX, "txid", "The transaction hash in hex"},
907
913
{RPCResult::Type::STR_HEX, "wtxid", "The transaction witness hash in hex"},
908
-
{RPCResult::Type::BOOL, "allowed", "If the mempool allows this tx to be inserted"},
914
+
{RPCResult::Type::STR, "package-error", "Package validation error, if any (only possible if rawtxs had more than 1 transaction)."},
915
+
{RPCResult::Type::BOOL, "allowed", "Whether this tx would be accepted to the mempool and pass client-specified maxfeerate."
916
+
"If not present, the tx was not fully validated due to a failure in another tx in the list."},
909
917
{RPCResult::Type::NUM, "vsize", "Virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted (only present when 'allowed' is true)"},
910
918
{RPCResult::Type::OBJ, "fees", "Transaction fees (only present if 'allowed' is true)",
0 commit comments