Skip to content
Open
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
6 changes: 3 additions & 3 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,10 +1970,10 @@ void CWallet::ResendWalletTransactions()

// Do this infrequently and randomly to avoid giving away
// that these are our transactions.
if (GetTime() < m_next_resend || !fBroadcastTransactions) return;
bool fFirst = (m_next_resend == 0);
if (NodeClock::now() < m_next_resend.load() || !fBroadcastTransactions) return;
bool fFirst = (m_next_resend.load() == NodeClock::time_point{});
// resend 1-3 hours from now, ~2 hours on average.
m_next_resend = GetTime() + (1 * 60 * 60) + GetRand(2 * 60 * 60);
m_next_resend = FastRandomContext{}.rand_uniform_delay(NodeClock::now() + 1h, 2h);
if (fFirst) return;

int submitted_tx_count = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <util/string.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <util/time.h>
#include <util/ui_change_type.h>
#include <validationinterface.h>
#include <wallet/crypter.h>
Expand Down Expand Up @@ -275,7 +276,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
int nWalletVersion GUARDED_BY(cs_wallet){FEATURE_BASE};

/** The next scheduled rebroadcast of wallet transactions. */
std::atomic<int64_t> m_next_resend{};
std::atomic<NodeClock::time_point> m_next_resend{};
/** Whether this wallet will submit newly created transactions to the node's mempool and
* prompt rebroadcasts (see ResendWalletTransactions()). */
bool fBroadcastTransactions = false;
Expand Down