Merge bitcoin/bitcoin#26091: test: Fix syncwithvalidationinterfacequeue calls

fa1ce96184 test: Add missing syncwithvalidationinterfacequeue (MacroFake)
faa4916529 test/doc: Remove unused syncwithvalidationinterfacequeue (MacroFake)

Pull request description:

  Fixes #26071

ACKs for top commit:
  achow101:
    ACK fa1ce96184
  glozow:
    ACK fa1ce96184
  w0xlt:
    ACK fa1ce96184

Tree-SHA512: d1e101b55477360ead2b99ade5d42b922aabe293ec84fb26764e29161c5be6c534aef6f22d2cc5ea63a4bd6b6e77b701f1a7a2283b8e7e815d343a604cd77656
This commit is contained in:
Andrew Chow 2022-09-15 13:15:55 -04:00
commit 96f1b2d34f
No known key found for this signature in database
GPG key ID: 17565732E08E5E41
2 changed files with 7 additions and 3 deletions

View file

@ -882,7 +882,7 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
wtx.mapValue["replaced_by_txid"] = newHash.ToString(); wtx.mapValue["replaced_by_txid"] = newHash.ToString();
// Refresh mempool status without waiting for transactionRemovedFromMempool // Refresh mempool status without waiting for transactionRemovedFromMempool or transactionAddedToMempool
RefreshMempoolStatus(wtx, chain()); RefreshMempoolStatus(wtx, chain());
WalletBatch batch(GetDatabase()); WalletBatch batch(GetDatabase());
@ -1920,7 +1920,7 @@ std::set<uint256> CWallet::GetTxConflicts(const CWalletTx& wtx) const
// The `force` option results in all unconfirmed transactions being submitted to // The `force` option results in all unconfirmed transactions being submitted to
// the mempool. This does not necessarily result in those transactions being relayed, // the mempool. This does not necessarily result in those transactions being relayed,
// that depends on the `relay` option. Periodic rebroadcast uses the pattern // that depends on the `relay` option. Periodic rebroadcast uses the pattern
// relay=true force=false (also the default values), while loading into the mempool // relay=true force=false, while loading into the mempool
// (on start, or after import) uses relay=false force=true. // (on start, or after import) uses relay=false force=true.
void CWallet::ResubmitWalletTransactions(bool relay, bool force) void CWallet::ResubmitWalletTransactions(bool relay, bool force)
{ {

View file

@ -89,6 +89,10 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
if txids == [child_txid, txid]: if txids == [child_txid, txid]:
break break
bumped = node.bumpfee(child_txid) bumped = node.bumpfee(child_txid)
# The scheduler queue creates a copy of the added tx after
# send/bumpfee and re-adds it to the wallet (undoing the next
# removeprunedfunds). So empty the scheduler queue:
node.syncwithvalidationinterfacequeue()
node.removeprunedfunds(child_txid) node.removeprunedfunds(child_txid)
child_txid = bumped["txid"] child_txid = bumped["txid"]
entry_time = node.getmempoolentry(child_txid)["time"] entry_time = node.getmempoolentry(child_txid)["time"]
@ -98,13 +102,13 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
block = create_block(int(node.getbestblockhash(), 16), create_coinbase(node.getblockcount() + 1), block_time) block = create_block(int(node.getbestblockhash(), 16), create_coinbase(node.getblockcount() + 1), block_time)
block.solve() block.solve()
node.submitblock(block.serialize().hex()) node.submitblock(block.serialize().hex())
# Set correct m_best_block_time, which is used in ResubmitWalletTransactions
node.syncwithvalidationinterfacequeue() node.syncwithvalidationinterfacequeue()
# Evict these txs from the mempool # Evict these txs from the mempool
evict_time = block_time + 60 * 60 * DEFAULT_MEMPOOL_EXPIRY_HOURS + 5 evict_time = block_time + 60 * 60 * DEFAULT_MEMPOOL_EXPIRY_HOURS + 5
node.setmocktime(evict_time) node.setmocktime(evict_time)
indep_send = node.send(outputs=[{node.getnewaddress(): 1}], options={"inputs": [indep_utxo]}) indep_send = node.send(outputs=[{node.getnewaddress(): 1}], options={"inputs": [indep_utxo]})
node.syncwithvalidationinterfacequeue()
node.getmempoolentry(indep_send["txid"]) node.getmempoolentry(indep_send["txid"])
assert_raises_rpc_error(-5, "Transaction not in mempool", node.getmempoolentry, txid) assert_raises_rpc_error(-5, "Transaction not in mempool", node.getmempoolentry, txid)
assert_raises_rpc_error(-5, "Transaction not in mempool", node.getmempoolentry, child_txid) assert_raises_rpc_error(-5, "Transaction not in mempool", node.getmempoolentry, child_txid)