Skip to content

Commit f8d6dc4

Browse files
committed
Merge #12860: Add testmempoolaccept to release-notes, Add missing const
fafcad3 doc: Add testmempoolaccept to release-notes (MarcoFalke) Pull request description: Some fixups for #11742: * Add release notes for the new rpc * Fix a typo in the original pull * Make the mempool reference passed to `CheckInputsFromMempoolAndCache` const, since that function is called before we return from ATMP and we must not modify the mempool. Tree-SHA512: 72c459ba69f7698a69c91d2592f10f7fb1864846c7d8c525050d48286f92ba5ec5fe554c54235b52fbd9a8f00226c526ad84584641ec39084e1a1310a261510d
2 parents 319991d + fafcad3 commit f8d6dc4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

doc/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ RPC changes
7474
add `label` fields to returned JSON objects that previously only had
7575
`account` fields.
7676
- `sendmany` now shuffles outputs to improve privacy, so any previously expected behavior with regards to output ordering can no longer be relied upon.
77+
- The new RPC `testmempoolaccept` can be used to test acceptance of a transaction to the mempool without adding it.
7778

7879
External wallet files
7980
---------------------

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ UniValue testmempoolaccept(const JSONRPCRequest& request)
11981198
{
11991199
LOCK(cs_main);
12001200
test_accept_res = AcceptToMemoryPool(mempool, state, std::move(tx), &missing_inputs,
1201-
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_raw_tx_fee, /* test_accpet */ true);
1201+
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_raw_tx_fee, /* test_accept */ true);
12021202
}
12031203
result_0.pushKV("allowed", test_accept_res);
12041204
if (!test_accept_res) {

src/validation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool f
507507

508508
// Used to avoid mempool polluting consensus critical paths if CCoinsViewMempool
509509
// were somehow broken and returning the wrong scriptPubKeys
510-
static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &view, CTxMemPool& pool,
510+
static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& view, const CTxMemPool& pool,
511511
unsigned int flags, bool cacheSigStore, PrecomputedTransactionData& txdata) {
512512
AssertLockHeld(cs_main);
513513

@@ -917,8 +917,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
917917
// invalid blocks (using TestBlockValidity), however allowing such
918918
// transactions into the mempool can be exploited as a DoS attack.
919919
unsigned int currentBlockScriptVerifyFlags = GetBlockScriptFlags(chainActive.Tip(), Params().GetConsensus());
920-
if (!CheckInputsFromMempoolAndCache(tx, state, view, pool, currentBlockScriptVerifyFlags, true, txdata))
921-
{
920+
if (!CheckInputsFromMempoolAndCache(tx, state, view, pool, currentBlockScriptVerifyFlags, true, txdata)) {
922921
// If we're using promiscuousmempoolflags, we may hit this normally
923922
// Check if current block has some flags that scriptVerifyFlags
924923
// does not before printing an ominous warning

0 commit comments

Comments
 (0)