diff options
author | John Newbery <john@johnnewbery.com> | 2019-03-20 18:07:52 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2019-04-09 10:38:28 -0400 |
commit | 833d98ae073daf0f25f786f043f2ffa85155c8ff (patch) | |
tree | 3c2ed9b9244af112b3e09613f08a19be0a144693 /src/wallet/wallet.cpp | |
parent | 52b760fc6a9b26e405a0553ee8285b0f03ca1604 (diff) |
[wallet] Remove unnecessary Chain::Lock parameter from ResendWalletTransactions
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cf477982ca..9f89cbefa0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2123,7 +2123,7 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const // and so is probably just sitting in the mempool waiting to be confirmed. // Rebroadcasting does nothing to speed up confirmation and only damages // privacy. -void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) +void CWallet::ResendWalletTransactions() { // During reindex, importing and IBD, old wallet transactions become // unconfirmed. Don't resend them as that would spam other nodes. @@ -2142,7 +2142,8 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) int relayed_tx_count = 0; - { // cs_wallet scope + { // locked_chain and cs_wallet scope + auto locked_chain = chain().lock(); LOCK(cs_wallet); // Relay transactions @@ -2151,9 +2152,9 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) // only rebroadcast unconfirmed txes older than 5 minutes before the // last block was found if (wtx.nTimeReceived > m_best_block_time - 5 * 60) continue; - relayed_tx_count += wtx.RelayWalletTransaction(locked_chain) ? 1 : 0; + if (wtx.RelayWalletTransaction(*locked_chain)) ++relayed_tx_count; } - } // cs_wallet + } // locked_chain and cs_wallet if (relayed_tx_count > 0) { WalletLogPrintf("%s: rebroadcast %u unconfirmed transactions\n", __func__, relayed_tx_count); @@ -2165,8 +2166,7 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) void MaybeResendWalletTxs() { for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) { - auto locked_chain = pwallet->chain().lock(); - pwallet->ResendWalletTransactions(*locked_chain); + pwallet->ResendWalletTransactions(); } } |