Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: bitcoin#25992, 25955, 25963 #6558

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wallet/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void StartWallets(CScheduler& scheduler, const ArgsManager& args)
if (args.GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) {
scheduler.scheduleEvery(MaybeCompactWalletDB, std::chrono::milliseconds{500});
}
scheduler.scheduleEvery(MaybeResendWalletTxs, std::chrono::milliseconds{1000});
scheduler.scheduleEvery(MaybeResendWalletTxs, 1min);
}

void FlushWallets()
Expand Down
4 changes: 2 additions & 2 deletions test/functional/rpc_fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def test_many_inputs_fee(self):
self.log.info("Test fundrawtxn fee with many inputs")

# Empty node1, send some small coins from node0 to node1.
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
self.nodes[1].sendall(recipients=[self.nodes[0].getnewaddress()])
self.generate(self.nodes[1], 1)

for _ in range(20):
Expand All @@ -595,7 +595,7 @@ def test_many_inputs_send(self):
self.log.info("Test fundrawtxn sign+send with many inputs")

# Again, empty node1, send some small coins from node0 to node1.
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
self.nodes[1].sendall(recipients=[self.nodes[0].getnewaddress()])
self.generate(self.nodes[1], 1)

for _ in range(20):
Expand Down
10 changes: 2 additions & 8 deletions test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,9 @@ def run_test(self):

# ==Check that wallet prefers to use coins that don't exceed mempool limits =====

# Get all non-zero utxos together
# Get all non-zero utxos together and split into two chains
chain_addrs = [self.nodes[0].getnewaddress(), self.nodes[0].getnewaddress()]
singletxid = self.nodes[0].sendtoaddress(chain_addrs[0], self.nodes[0].getbalance(), "", "", True)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
node0_balance = self.nodes[0].getbalance()
# Split into two chains
rawtx = self.nodes[0].createrawtransaction([{"txid": singletxid, "vout": 0}], {chain_addrs[0]: node0_balance // 2 - Decimal('0.01'), chain_addrs[1]: node0_balance // 2 - Decimal('0.01')})
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
singletxid = self.nodes[0].sendrawtransaction(hexstring=signedtx["hex"], maxfeerate=0)
self.nodes[0].sendall(recipients=chain_addrs)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)

# Make a long chain of unconfirmed payments without hitting mempool limit
Expand Down
2 changes: 1 addition & 1 deletion test/functional/wallet_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def run_test(self):
assert_equal(2, len(tx6["vout"]))

# Empty out node2's wallet
self.nodes[2].sendtoaddress(address=self.nodes[0].getnewaddress(), amount=self.nodes[2].getbalance(), subtractfeefromamount=True)
self.nodes[2].sendall(recipients=[self.nodes[0].getnewaddress()])
self.sync_all()
self.generate(self.nodes[0], 1)

Expand Down
10 changes: 5 additions & 5 deletions test/functional/wallet_resendwallettransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def run_test(self):
self.log.info("Create a new transaction and wait until it's broadcast")
txid = node.sendtoaddress(node.getnewaddress(), 1)

# Wallet rebroadcast is first scheduled 1 sec after startup (see
# Wallet rebroadcast is first scheduled 1 min sec after startup (see
# nNextResend in ResendWalletTransactions()). Tell scheduler to call
# MaybeResendWalletTxn now to initialize nNextResend before the first
# MaybeResendWalletTxs now to initialize nNextResend before the first
# setmocktime call below.
node.mockscheduler(1)
node.mockscheduler(60)

# Can take a few seconds due to transaction trickling
def wait_p2p():
Expand Down Expand Up @@ -61,15 +61,15 @@ def wait_p2p():
twelve_hrs = 12 * 60 * 60
two_min = 2 * 60
node.setmocktime(self.mocktime + twelve_hrs - two_min)
node.mockscheduler(1) # Tell scheduler to call MaybeResendWalletTxn now
node.mockscheduler(1) # Tell scheduler to call MaybeResendWalletTxs now
assert_equal(int(txid, 16) in peer_second.get_invs(), False)

self.log.info("Bump time & check that transaction is rebroadcast")
# Transaction should be rebroadcast approximately 24 hours in the future,
# but can range from 12-36. So bump 36 hours to be sure.
with node.assert_debug_log(['ResendWalletTransactions: resubmit 1 unconfirmed transactions']):
node.setmocktime(self.mocktime + 36 * 60 * 60)
# Tell scheduler to call MaybeResendWalletTxn now.
# Tell scheduler to call MaybeResendWalletTxs now.
node.mockscheduler(1)
# Give some time for trickle to occur
node.setmocktime(self.mocktime + 36 * 60 * 60 + 600)
Expand Down
Loading