aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2019-03-28 13:15:47 -0400
committerJohn Newbery <john@johnnewbery.com>2019-04-09 10:37:49 -0400
commitf463cd107361a172a17e4c5510b06eb8a67aade0 (patch)
tree713da4c32558cf5acbc57a2805895482a3322a90 /src/wallet/wallet.cpp
parentf3ecf3025f82f84d42ec463990ff787647cc7bf5 (diff)
downloadbitcoin-f463cd107361a172a17e4c5510b06eb8a67aade0.tar.xz
[wallet] Keep track of the best block time in the wallet
Move nTimeBestReceived (which is only used for wallet rebroadcasts) into the wallet.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index b62ab0c514..243b51a1e6 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1276,6 +1276,10 @@ void CWallet::BlockDisconnected(const CBlock& block) {
}
}
+void CWallet::UpdatedBlockTip()
+{
+ m_best_block_time = GetTime();
+}
void CWallet::BlockUntilSyncedToCurrentChain() {
@@ -2110,7 +2114,7 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const
return CTransaction(tx1) == CTransaction(tx2);
}
-void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain, int64_t nBestBlockTime)
+void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain)
{
// Do this infrequently and randomly to avoid giving away
// that these are our transactions.
@@ -2120,7 +2124,7 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain, in
if (fFirst) return;
// Only do it if there's been a new block since last time
- if (nBestBlockTime < nLastResend) return;
+ if (m_best_block_time < nLastResend) return;
nLastResend = GetTime();
int relayed_tx_count = 0;
@@ -2133,7 +2137,7 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain, in
CWalletTx& wtx = item.second;
// only rebroadcast unconfirmed txes older than 5 minutes before the
// last block was found
- if (wtx.nTimeReceived > nBestBlockTime - 5 * 60) continue;
+ if (wtx.nTimeReceived > m_best_block_time - 5 * 60) continue;
relayed_tx_count += wtx.RelayWalletTransaction(locked_chain) ? 1 : 0;
}
} // cs_wallet