diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2013-07-28 17:21:21 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2013-07-28 17:21:21 -0700 |
commit | 4bb77b49632b47465216adcd1009b6c4b3825386 (patch) | |
tree | 7cf0bac9d587583461c506e916198270b7c9f9ff | |
parent | 83a3597071def757731544f8f1adf89a9aeee219 (diff) | |
parent | 203d1ae69b1b606c0216d0dc35de567c591720ae (diff) |
Merge pull request #2541 from luke-jr/bugfix_wallet_resend
Bugfix: Store last/next wallet resend times unique per CWallet object
-rw-r--r-- | src/wallet.cpp | 12 | ||||
-rw-r--r-- | src/wallet.h | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index 488787f967..0b4c866f81 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -892,19 +892,17 @@ void CWallet::ResendWalletTransactions() { // Do this infrequently and randomly to avoid giving away // that these are our transactions. - static int64 nNextTime; - if (GetTime() < nNextTime) + if (GetTime() < nNextResend) return; - bool fFirst = (nNextTime == 0); - nNextTime = GetTime() + GetRand(30 * 60); + bool fFirst = (nNextResend == 0); + nNextResend = GetTime() + GetRand(30 * 60); if (fFirst) return; // Only do it if there's been a new block since last time - static int64 nLastTime; - if (nTimeBestReceived < nLastTime) + if (nTimeBestReceived < nLastResend) return; - nLastTime = GetTime(); + nLastResend = GetTime(); // Rebroadcast any of our txes that aren't in a block yet printf("ResendWalletTransactions()\n"); diff --git a/src/wallet.h b/src/wallet.h index 36b3608fb0..92f893c6b0 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -80,6 +80,9 @@ private: // the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded int nWalletMaxVersion; + int64 nNextResend; + int64 nLastResend; + public: mutable CCriticalSection cs_wallet; |