@@ -2123,7 +2123,7 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const
2123
2123
// and so is probably just sitting in the mempool waiting to be confirmed.
2124
2124
// Rebroadcasting does nothing to speed up confirmation and only damages
2125
2125
// privacy.
2126
- void CWallet::ResendWalletTransactions (interfaces::Chain::Lock& locked_chain )
2126
+ void CWallet::ResendWalletTransactions ()
2127
2127
{
2128
2128
// During reindex, importing and IBD, old wallet transactions become
2129
2129
// unconfirmed. Don't resend them as that would spam other nodes.
@@ -2142,7 +2142,8 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain)
2142
2142
2143
2143
int relayed_tx_count = 0 ;
2144
2144
2145
- { // cs_wallet scope
2145
+ { // locked_chain and cs_wallet scope
2146
+ auto locked_chain = chain ().lock ();
2146
2147
LOCK (cs_wallet);
2147
2148
2148
2149
// Relay transactions
@@ -2151,9 +2152,9 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain)
2151
2152
// only rebroadcast unconfirmed txes older than 5 minutes before the
2152
2153
// last block was found
2153
2154
if (wtx.nTimeReceived > m_best_block_time - 5 * 60 ) continue ;
2154
- relayed_tx_count += wtx.RelayWalletTransaction (locked_chain) ? 1 : 0 ;
2155
+ if ( wtx.RelayWalletTransaction (* locked_chain)) ++relayed_tx_count ;
2155
2156
}
2156
- } // cs_wallet
2157
+ } // locked_chain and cs_wallet
2157
2158
2158
2159
if (relayed_tx_count > 0 ) {
2159
2160
WalletLogPrintf (" %s: rebroadcast %u unconfirmed transactions\n " , __func__, relayed_tx_count);
@@ -2165,8 +2166,7 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain)
2165
2166
void MaybeResendWalletTxs ()
2166
2167
{
2167
2168
for (const std::shared_ptr<CWallet>& pwallet : GetWallets ()) {
2168
- auto locked_chain = pwallet->chain ().lock ();
2169
- pwallet->ResendWalletTransactions (*locked_chain);
2169
+ pwallet->ResendWalletTransactions ();
2170
2170
}
2171
2171
}
2172
2172
0 commit comments