Skip to content

Commit dc1da48

Browse files
committed
[wallet] Update the rebroadcast frequency to be ~1/day.
Since the mempool unbroadcast mechanism handles the reattempts for initial broadcast, the wallet rebroadcast attempts can be much less frequent (previously ~1/30 min)
1 parent e25e42f commit dc1da48

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,8 @@ void CWallet::ResendWalletTransactions()
19781978
// that these are our transactions.
19791979
if (GetTime() < nNextResend || !fBroadcastTransactions) return;
19801980
bool fFirst = (nNextResend == 0);
1981-
nNextResend = GetTime() + GetRand(30 * 60);
1981+
// resend 12-36 hours from now, ~1 day on average.
1982+
nNextResend = GetTime() + (12 * 60 * 60) + GetRand(24 * 60 * 60);
19821983
if (fFirst) return;
19831984

19841985
// Only do it if there's been a new block since last time

test/functional/wallet_resendwallettransactions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ def run_test(self):
6969
node.p2ps[1].sync_with_ping()
7070
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
7171

72-
self.log.info("Transaction should be rebroadcast after 30 minutes")
73-
# Use mocktime and give an extra 5 minutes to be sure.
74-
rebroadcast_time = int(time.time()) + 41 * 60
72+
self.log.info("Bump time & check that transaction is rebroadcast")
73+
# Transaction should be rebroadcast approximately 24 hours in the future,
74+
# but can range from 12-36. So bump 36 hours to be sure.
75+
rebroadcast_time = int(time.time()) + 36 * 60 * 60
7576
node.setmocktime(rebroadcast_time)
7677
wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock)
7778

0 commit comments

Comments
 (0)