Skip to content

Commit

Permalink
wallet: remove last cs_main locks from every signal handler function …
Browse files Browse the repository at this point in the history
…:) .

TransactionAddedToMempool, BlockConnected, BlockDisconnected don't longer need cs_main lock.
  • Loading branch information
furszy committed Mar 10, 2021
1 parent 9720579 commit 208a292
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ void CWallet::SyncTransaction(const CTransactionRef& ptx, const CWalletTx::Confi

void CWallet::TransactionAddedToMempool(const CTransactionRef& ptx)
{
LOCK2(cs_main, cs_wallet);
LOCK(cs_wallet);
CWalletTx::Confirmation confirm(CWalletTx::Status::UNCONFIRMED, /* block_height */ 0, {}, /* nIndex */ 0);
SyncTransaction(ptx, confirm);

Expand All @@ -1290,7 +1290,7 @@ void CWallet::TransactionRemovedFromMempool(const CTransactionRef &ptx) {

void CWallet::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted)
{
LOCK2(cs_main, cs_wallet);
LOCK(cs_wallet);

m_last_block_processed = pindex->GetBlockHash();
m_last_block_processed_time = pindex->GetBlockTime();
Expand Down Expand Up @@ -1329,7 +1329,7 @@ void CWallet::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const

void CWallet::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const uint256& blockHash, int nBlockHeight, int64_t blockTime)
{
LOCK2(cs_main, cs_wallet);
LOCK(cs_wallet);

// At block disconnection, this will change an abandoned transaction to
// be unconfirmed, whether or not the transaction is added back to the mempool.
Expand Down Expand Up @@ -3848,7 +3848,7 @@ bool CWallet::LoadDestData(const CTxDestination& dest, const std::string& key, c

void CWallet::AutoCombineDust(CConnman* connman)
{
LOCK(cs_wallet);
AssertLockHeld(cs_wallet);
if (m_last_block_processed.IsNull() ||
m_last_block_processed_time < (GetAdjustedTime() - 300) ||
IsLocked()) {
Expand Down

0 comments on commit 208a292

Please sign in to comment.