wallet: trigger MaybeResendWalletTxs() every minute

ResendWalletTransactions() only executes every 12-36h (24h average).
Triggering it every second is excessive, once per minute should be
plenty.
This commit is contained in:
stickies-v 2022-08-24 19:17:40 +01:00
parent 6057e7e2b9
commit fbba4a1316
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757
2 changed files with 5 additions and 5 deletions

View file

@ -151,7 +151,7 @@ void StartWallets(WalletContext& context, CScheduler& scheduler)
if (context.args->GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) { if (context.args->GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) {
scheduler.scheduleEvery([&context] { MaybeCompactWalletDB(context); }, std::chrono::milliseconds{500}); scheduler.scheduleEvery([&context] { MaybeCompactWalletDB(context); }, std::chrono::milliseconds{500});
} }
scheduler.scheduleEvery([&context] { MaybeResendWalletTxs(context); }, std::chrono::milliseconds{1000}); scheduler.scheduleEvery([&context] { MaybeResendWalletTxs(context); }, 1min);
} }
void FlushWallets(WalletContext& context) void FlushWallets(WalletContext& context)

View file

@ -29,11 +29,11 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
self.log.info("Create a new transaction and wait until it's broadcast") self.log.info("Create a new transaction and wait until it's broadcast")
txid = node.sendtoaddress(node.getnewaddress(), 1) 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 # nNextResend in ResendWalletTransactions()). Tell scheduler to call
# MaybeResendWalletTxn now to initialize nNextResend before the first # MaybeResendWalletTxn now to initialize nNextResend before the first
# setmocktime call below. # setmocktime call below.
node.mockscheduler(1) node.mockscheduler(60)
# Can take a few seconds due to transaction trickling # Can take a few seconds due to transaction trickling
peer_first.wait_for_broadcast([txid]) peer_first.wait_for_broadcast([txid])
@ -60,7 +60,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
twelve_hrs = 12 * 60 * 60 twelve_hrs = 12 * 60 * 60
two_min = 2 * 60 two_min = 2 * 60
node.setmocktime(now + twelve_hrs - two_min) node.setmocktime(now + twelve_hrs - two_min)
node.mockscheduler(1) # Tell scheduler to call MaybeResendWalletTxn now node.mockscheduler(60) # Tell scheduler to call MaybeResendWalletTxn now
assert_equal(int(txid, 16) in peer_second.get_invs(), False) assert_equal(int(txid, 16) in peer_second.get_invs(), False)
self.log.info("Bump time & check that transaction is rebroadcast") self.log.info("Bump time & check that transaction is rebroadcast")
@ -69,7 +69,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
with node.assert_debug_log(['ResendWalletTransactions: resubmit 1 unconfirmed transactions']): with node.assert_debug_log(['ResendWalletTransactions: resubmit 1 unconfirmed transactions']):
node.setmocktime(now + 36 * 60 * 60) node.setmocktime(now + 36 * 60 * 60)
# Tell scheduler to call MaybeResendWalletTxn now. # Tell scheduler to call MaybeResendWalletTxn now.
node.mockscheduler(1) node.mockscheduler(60)
# Give some time for trickle to occur # Give some time for trickle to occur
node.setmocktime(now + 36 * 60 * 60 + 600) node.setmocktime(now + 36 * 60 * 60 + 600)
peer_second.wait_for_broadcast([txid]) peer_second.wait_for_broadcast([txid])