mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
[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)
This commit is contained in:
parent
e25e42f20a
commit
dc1da48dc5
2 changed files with 6 additions and 4 deletions
|
@ -1978,7 +1978,8 @@ void CWallet::ResendWalletTransactions()
|
|||
// that these are our transactions.
|
||||
if (GetTime() < nNextResend || !fBroadcastTransactions) return;
|
||||
bool fFirst = (nNextResend == 0);
|
||||
nNextResend = GetTime() + GetRand(30 * 60);
|
||||
// resend 12-36 hours from now, ~1 day on average.
|
||||
nNextResend = GetTime() + (12 * 60 * 60) + GetRand(24 * 60 * 60);
|
||||
if (fFirst) return;
|
||||
|
||||
// Only do it if there's been a new block since last time
|
||||
|
|
|
@ -69,9 +69,10 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
|
|||
node.p2ps[1].sync_with_ping()
|
||||
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
|
||||
|
||||
self.log.info("Transaction should be rebroadcast after 30 minutes")
|
||||
# Use mocktime and give an extra 5 minutes to be sure.
|
||||
rebroadcast_time = int(time.time()) + 41 * 60
|
||||
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.
|
||||
rebroadcast_time = int(time.time()) + 36 * 60 * 60
|
||||
node.setmocktime(rebroadcast_time)
|
||||
wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue