From f463cd107361a172a17e4c5510b06eb8a67aade0 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 28 Mar 2019 13:15:47 -0400 Subject: [PATCH 1/3] [wallet] Keep track of the best block time in the wallet Move nTimeBestReceived (which is only used for wallet rebroadcasts) into the wallet. --- src/interfaces/chain.cpp | 8 ++++++-- src/interfaces/chain.h | 3 ++- src/net_processing.cpp | 6 +----- src/validationinterface.cpp | 8 ++++---- src/validationinterface.h | 4 ++-- src/wallet/wallet.cpp | 10 +++++++--- src/wallet/wallet.h | 5 ++++- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index e409ced60..6c918b73f 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -202,8 +202,12 @@ public: { m_notifications->BlockDisconnected(*block); } + void UpdatedBlockTip(const CBlockIndex* index, const CBlockIndex* fork_index, bool is_ibd) override + { + m_notifications->UpdatedBlockTip(); + } void ChainStateFlushed(const CBlockLocator& locator) override { m_notifications->ChainStateFlushed(locator); } - void ResendWalletTransactions(int64_t best_block_time, CConnman*) override + void ResendWalletTransactions(CConnman*) override { // `cs_main` is always held when this method is called, so it is safe to // call `assumeLocked`. This is awkward, and the `assumeLocked` method @@ -211,7 +215,7 @@ public: // is replaced by a wallet timer as suggested in // https://github.com/bitcoin/bitcoin/issues/15619 auto locked_chain = m_chain.assumeLocked(); - m_notifications->ResendWalletTransactions(*locked_chain, best_block_time); + m_notifications->ResendWalletTransactions(*locked_chain); } Chain& m_chain; Chain::Notifications* m_notifications; diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index d11a59241..82e2c7eb2 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -256,8 +256,9 @@ public: virtual void TransactionRemovedFromMempool(const CTransactionRef& ptx) {} virtual void BlockConnected(const CBlock& block, const std::vector& tx_conflicted) {} virtual void BlockDisconnected(const CBlock& block) {} + virtual void UpdatedBlockTip() {} virtual void ChainStateFlushed(const CBlockLocator& locator) {} - virtual void ResendWalletTransactions(Lock& locked_chain, int64_t best_block_time) {} + virtual void ResendWalletTransactions(Lock& locked_chain) {} }; //! Register handler for notifications. diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 0f13d6e26..3fd3068fb 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -175,8 +175,6 @@ namespace { /** Expiration-time ordered list of (expire time, relay map entry) pairs. */ std::deque> vRelayExpiration GUARDED_BY(cs_main); - std::atomic nTimeBestReceived(0); // Used only to inform the wallet of when we last received a block - struct IteratorComparator { template @@ -1121,8 +1119,6 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CB }); connman->WakeMessageHandler(); } - - nTimeBestReceived = GetTime(); } /** @@ -3555,7 +3551,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto) // transactions become unconfirmed and spams other nodes. if (!fReindex && !fImporting && !IsInitialBlockDownload()) { - GetMainSignals().Broadcast(nTimeBestReceived, connman); + GetMainSignals().Broadcast(connman); } // diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 70c274d20..abd229d56 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -37,7 +37,7 @@ struct MainSignalsInstance { boost::signals2::signal &)> BlockDisconnected; boost::signals2::signal TransactionRemovedFromMempool; boost::signals2::signal ChainStateFlushed; - boost::signals2::signal Broadcast; + boost::signals2::signal Broadcast; boost::signals2::signal BlockChecked; boost::signals2::signal&)> NewPoWValidBlock; @@ -101,7 +101,7 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { conns.BlockDisconnected = g_signals.m_internals->BlockDisconnected.connect(std::bind(&CValidationInterface::BlockDisconnected, pwalletIn, std::placeholders::_1)); conns.TransactionRemovedFromMempool = g_signals.m_internals->TransactionRemovedFromMempool.connect(std::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, std::placeholders::_1)); conns.ChainStateFlushed = g_signals.m_internals->ChainStateFlushed.connect(std::bind(&CValidationInterface::ChainStateFlushed, pwalletIn, std::placeholders::_1)); - conns.Broadcast = g_signals.m_internals->Broadcast.connect(std::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, std::placeholders::_1, std::placeholders::_2)); + conns.Broadcast = g_signals.m_internals->Broadcast.connect(std::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, std::placeholders::_1)); conns.BlockChecked = g_signals.m_internals->BlockChecked.connect(std::bind(&CValidationInterface::BlockChecked, pwalletIn, std::placeholders::_1, std::placeholders::_2)); conns.NewPoWValidBlock = g_signals.m_internals->NewPoWValidBlock.connect(std::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, std::placeholders::_1, std::placeholders::_2)); } @@ -175,8 +175,8 @@ void CMainSignals::ChainStateFlushed(const CBlockLocator &locator) { }); } -void CMainSignals::Broadcast(int64_t nBestBlockTime, CConnman* connman) { - m_internals->Broadcast(nBestBlockTime, connman); +void CMainSignals::Broadcast(CConnman* connman) { + m_internals->Broadcast(connman); } void CMainSignals::BlockChecked(const CBlock& block, const CValidationState& state) { diff --git a/src/validationinterface.h b/src/validationinterface.h index f0374e8e7..0d5bdd60f 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -135,7 +135,7 @@ protected: */ virtual void ChainStateFlushed(const CBlockLocator &locator) {} /** Tells listeners to broadcast their data. */ - virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {} + virtual void ResendWalletTransactions(CConnman* connman) {} /** * Notifies listeners of a block validation result. * If the provided CValidationState IsValid, the provided block @@ -184,7 +184,7 @@ public: void BlockConnected(const std::shared_ptr &, const CBlockIndex *pindex, const std::shared_ptr> &); void BlockDisconnected(const std::shared_ptr &); void ChainStateFlushed(const CBlockLocator &); - void Broadcast(int64_t nBestBlockTime, CConnman* connman); + void Broadcast(CConnman* connman); void BlockChecked(const CBlock&, const CValidationState&); void NewPoWValidBlock(const CBlockIndex *, const std::shared_ptr&); }; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index b62ab0c51..243b51a1e 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 diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index fd274fa37..cef58c641 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -657,6 +657,8 @@ private: int64_t nNextResend = 0; int64_t nLastResend = 0; bool fBroadcastTransactions = false; + // Local time that the tip block was received. Used to schedule wallet rebroadcasts. + std::atomic m_best_block_time {0}; /** * Used to keep track of spent outpoints, and @@ -926,6 +928,7 @@ public: void TransactionAddedToMempool(const CTransactionRef& tx) override; void BlockConnected(const CBlock& block, const std::vector& vtxConflicted) override; void BlockDisconnected(const CBlock& block) override; + void UpdatedBlockTip() override; int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update); struct ScanResult { @@ -946,7 +949,7 @@ public: ScanResult ScanForWalletTransactions(const uint256& first_block, const uint256& last_block, const WalletRescanReserver& reserver, bool fUpdate); void TransactionRemovedFromMempool(const CTransactionRef &ptx) override; void ReacceptWalletTransactions(interfaces::Chain::Lock& locked_chain) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - void ResendWalletTransactions(interfaces::Chain::Lock& locked_chain, int64_t nBestBlockTime) override; + void ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) override; struct Balance { CAmount m_mine_trusted{0}; //!< Trusted, at depth=GetBalance.min_depth or more CAmount m_mine_untrusted_pending{0}; //!< Untrusted, but in mempool (pending) From 52b760fc6a9b26e405a0553ee8285b0f03ca1604 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 20 Mar 2019 17:46:38 -0400 Subject: [PATCH 2/3] [wallet] Schedule tx rebroadcasts in wallet Removes the now-unused Broadcast/ResendWalletTransactions interface from validationinterface. The wallet_resendwallettransactions.py needs a sleep added at the start to make sure that the rebroadcast scheduler is warmed up before the next block is mined. --- src/interfaces/chain.cpp | 11 +--------- src/interfaces/chain.h | 4 +++- src/net_processing.cpp | 8 ------- src/validationinterface.cpp | 7 ------- src/validationinterface.h | 3 --- src/wallet/init.cpp | 3 ++- src/wallet/wallet.cpp | 21 ++++++++++++++++++- src/wallet/wallet.h | 8 ++++++- .../wallet_resendwallettransactions.py | 6 ++++++ 9 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 6c918b73f..f278e5de9 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -207,16 +207,6 @@ public: m_notifications->UpdatedBlockTip(); } void ChainStateFlushed(const CBlockLocator& locator) override { m_notifications->ChainStateFlushed(locator); } - void ResendWalletTransactions(CConnman*) override - { - // `cs_main` is always held when this method is called, so it is safe to - // call `assumeLocked`. This is awkward, and the `assumeLocked` method - // should be able to be removed entirely if `ResendWalletTransactions` - // is replaced by a wallet timer as suggested in - // https://github.com/bitcoin/bitcoin/issues/15619 - auto locked_chain = m_chain.assumeLocked(); - m_notifications->ResendWalletTransactions(*locked_chain); - } Chain& m_chain; Chain::Notifications* m_notifications; }; @@ -351,6 +341,7 @@ public: CAmount maxTxFee() override { return ::maxTxFee; } bool getPruneMode() override { return ::fPruneMode; } bool p2pEnabled() override { return g_connman != nullptr; } + bool isReadyToBroadcast() override { return !::fImporting && !::fReindex && !IsInitialBlockDownload(); } bool isInitialBlockDownload() override { return IsInitialBlockDownload(); } bool shutdownRequested() override { return ShutdownRequested(); } int64_t getAdjustedTime() override { return GetAdjustedTime(); } diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 82e2c7eb2..4e0ef49f6 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -223,6 +223,9 @@ public: //! Check if p2p enabled. virtual bool p2pEnabled() = 0; + //! Check if the node is ready to broadcast transactions. + virtual bool isReadyToBroadcast() = 0; + //! Check if in IBD. virtual bool isInitialBlockDownload() = 0; @@ -258,7 +261,6 @@ public: virtual void BlockDisconnected(const CBlock& block) {} virtual void UpdatedBlockTip() {} virtual void ChainStateFlushed(const CBlockLocator& locator) {} - virtual void ResendWalletTransactions(Lock& locked_chain) {} }; //! Register handler for notifications. diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 3fd3068fb..044fcc90c 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3546,14 +3546,6 @@ bool PeerLogicValidation::SendMessages(CNode* pto) } } - // Resend wallet transactions that haven't gotten in a block yet - // Except during reindex, importing and IBD, when old wallet - // transactions become unconfirmed and spams other nodes. - if (!fReindex && !fImporting && !IsInitialBlockDownload()) - { - GetMainSignals().Broadcast(connman); - } - // // Try sending block announcements via headers // diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index abd229d56..5d0ee1d1f 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -25,7 +25,6 @@ struct ValidationInterfaceConnections { boost::signals2::scoped_connection BlockDisconnected; boost::signals2::scoped_connection TransactionRemovedFromMempool; boost::signals2::scoped_connection ChainStateFlushed; - boost::signals2::scoped_connection Broadcast; boost::signals2::scoped_connection BlockChecked; boost::signals2::scoped_connection NewPoWValidBlock; }; @@ -37,7 +36,6 @@ struct MainSignalsInstance { boost::signals2::signal &)> BlockDisconnected; boost::signals2::signal TransactionRemovedFromMempool; boost::signals2::signal ChainStateFlushed; - boost::signals2::signal Broadcast; boost::signals2::signal BlockChecked; boost::signals2::signal&)> NewPoWValidBlock; @@ -101,7 +99,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { conns.BlockDisconnected = g_signals.m_internals->BlockDisconnected.connect(std::bind(&CValidationInterface::BlockDisconnected, pwalletIn, std::placeholders::_1)); conns.TransactionRemovedFromMempool = g_signals.m_internals->TransactionRemovedFromMempool.connect(std::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, std::placeholders::_1)); conns.ChainStateFlushed = g_signals.m_internals->ChainStateFlushed.connect(std::bind(&CValidationInterface::ChainStateFlushed, pwalletIn, std::placeholders::_1)); - conns.Broadcast = g_signals.m_internals->Broadcast.connect(std::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, std::placeholders::_1)); conns.BlockChecked = g_signals.m_internals->BlockChecked.connect(std::bind(&CValidationInterface::BlockChecked, pwalletIn, std::placeholders::_1, std::placeholders::_2)); conns.NewPoWValidBlock = g_signals.m_internals->NewPoWValidBlock.connect(std::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, std::placeholders::_1, std::placeholders::_2)); } @@ -175,10 +172,6 @@ void CMainSignals::ChainStateFlushed(const CBlockLocator &locator) { }); } -void CMainSignals::Broadcast(CConnman* connman) { - m_internals->Broadcast(connman); -} - void CMainSignals::BlockChecked(const CBlock& block, const CValidationState& state) { m_internals->BlockChecked(block, state); } diff --git a/src/validationinterface.h b/src/validationinterface.h index 0d5bdd60f..78f3026a8 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -134,8 +134,6 @@ protected: * Called on a background thread. */ virtual void ChainStateFlushed(const CBlockLocator &locator) {} - /** Tells listeners to broadcast their data. */ - virtual void ResendWalletTransactions(CConnman* connman) {} /** * Notifies listeners of a block validation result. * If the provided CValidationState IsValid, the provided block @@ -184,7 +182,6 @@ public: void BlockConnected(const std::shared_ptr &, const CBlockIndex *pindex, const std::shared_ptr> &); void BlockDisconnected(const std::shared_ptr &); void ChainStateFlushed(const CBlockLocator &); - void Broadcast(CConnman* connman); void BlockChecked(const CBlock&, const CValidationState&); void NewPoWValidBlock(const CBlockIndex *, const std::shared_ptr&); }; diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 76a7eaa68..a8096dc67 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -211,8 +211,9 @@ void StartWallets(CScheduler& scheduler) pwallet->postInitProcess(); } - // Run a thread to flush wallet periodically + // Schedule periodic wallet flushes and tx rebroadcasts scheduler.scheduleEvery(MaybeCompactWalletDB, 500); + scheduler.scheduleEvery(MaybeResendWalletTxs, 1000); } void FlushWallets() diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 243b51a1e..cf477982c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2114,8 +2114,21 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const return CTransaction(tx1) == CTransaction(tx2); } +// Rebroadcast transactions from the wallet. We do this on a random timer +// to slightly obfuscate which transactions come from our wallet. +// +// Ideally, we'd only resend transactions that we think should have been +// mined in the most recent block. Any transaction that wasn't in the top +// blockweight of transactions in the mempool shouldn't have been mined, +// 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) { + // During reindex, importing and IBD, old wallet transactions become + // unconfirmed. Don't resend them as that would spam other nodes. + if (!chain().isReadyToBroadcast()) return; + // Do this infrequently and randomly to avoid giving away // that these are our transactions. if (GetTime() < nNextResend || !fBroadcastTransactions) return; @@ -2149,7 +2162,13 @@ void CWallet::ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) /** @} */ // end of mapWallet - +void MaybeResendWalletTxs() +{ + for (const std::shared_ptr& pwallet : GetWallets()) { + auto locked_chain = pwallet->chain().lock(); + pwallet->ResendWalletTransactions(*locked_chain); + } +} /** @defgroup Actions diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index cef58c641..a0c5f63ce 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -949,7 +949,7 @@ public: ScanResult ScanForWalletTransactions(const uint256& first_block, const uint256& last_block, const WalletRescanReserver& reserver, bool fUpdate); void TransactionRemovedFromMempool(const CTransactionRef &ptx) override; void ReacceptWalletTransactions(interfaces::Chain::Lock& locked_chain) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - void ResendWalletTransactions(interfaces::Chain::Lock& locked_chain) override; + void ResendWalletTransactions(interfaces::Chain::Lock& locked_chain); struct Balance { CAmount m_mine_trusted{0}; //!< Trusted, at depth=GetBalance.min_depth or more CAmount m_mine_untrusted_pending{0}; //!< Untrusted, but in mempool (pending) @@ -1232,6 +1232,12 @@ public: friend struct WalletTestingSetup; }; +/** + * Called periodically by the schedule thread. Prompts individual wallets to resend + * their transactions. Actual rebroadcast schedule is managed by the wallets themselves. + */ +void MaybeResendWalletTxs(); + /** A key allocated from the key pool. */ class CReserveKey final : public CReserveScript { diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py index 8aafa94c2..ec5e230e5 100755 --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -39,6 +39,12 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): self.log.info("Create a new transaction and wait until it's broadcast") txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16) + # Wallet rebroadcast is first scheduled 1 sec after startup (see + # nNextResend in ResendWalletTransactions()). Sleep for just over a + # second to be certain that it has been called before the first + # setmocktime call below. + time.sleep(1.1) + # Can take a few seconds due to transaction trickling wait_until(lambda: node.p2p.tx_invs_received[txid] >= 1, lock=mininode_lock) From 833d98ae073daf0f25f786f043f2ffa85155c8ff Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 20 Mar 2019 18:07:52 -0400 Subject: [PATCH 3/3] [wallet] Remove unnecessary Chain::Lock parameter from ResendWalletTransactions --- src/wallet/wallet.cpp | 12 ++++++------ src/wallet/wallet.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cf477982c..9f89cbefa 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& pwallet : GetWallets()) { - auto locked_chain = pwallet->chain().lock(); - pwallet->ResendWalletTransactions(*locked_chain); + pwallet->ResendWalletTransactions(); } } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a0c5f63ce..587b2814c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -949,7 +949,7 @@ public: ScanResult ScanForWalletTransactions(const uint256& first_block, const uint256& last_block, const WalletRescanReserver& reserver, bool fUpdate); void TransactionRemovedFromMempool(const CTransactionRef &ptx) override; void ReacceptWalletTransactions(interfaces::Chain::Lock& locked_chain) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - void ResendWalletTransactions(interfaces::Chain::Lock& locked_chain); + void ResendWalletTransactions(); struct Balance { CAmount m_mine_trusted{0}; //!< Trusted, at depth=GetBalance.min_depth or more CAmount m_mine_untrusted_pending{0}; //!< Untrusted, but in mempool (pending)