diff options
author | Matt Corallo <git@bluematt.me> | 2017-03-08 12:55:33 -0500 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-04-07 11:53:43 +0200 |
commit | e6d5e6cbbef3dca1bc9dce095124f7b79d01a54a (patch) | |
tree | 26673121295c8302cdd75f5e9d9be0f42a7c0595 /src/wallet | |
parent | 461e49fee2935b1eb4d4ea7bae3023e655c0a6d8 (diff) |
Hold cs_wallet for whole block [dis]connection processing
This simplifies fixing the wallet-returns-stale-info issue as we
now hold cs_wallet across an entire block instead of only per-tx.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 2b66faf687..b04037774d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1138,6 +1138,7 @@ void CWallet::TransactionAddedToMempool(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); // TODO: Tempoarily ensure that mempool removals are notified before // connected transactions. This shouldn't matter, but the abandoned // state of transactions in our wallet is currently cleared when we @@ -1147,18 +1148,17 @@ void CWallet::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const // the notification that the conflicted transaction was evicted. for (const CTransactionRef& ptx : vtxConflicted) { - LOCK2(cs_main, cs_wallet); SyncTransaction(ptx, NULL, -1); } for (size_t i = 0; i < pblock->vtx.size(); i++) { - LOCK2(cs_main, cs_wallet); SyncTransaction(pblock->vtx[i], pindex, i); } } void CWallet::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock) { + LOCK2(cs_main, cs_wallet); + for (const CTransactionRef& ptx : pblock->vtx) { - LOCK2(cs_main, cs_wallet); SyncTransaction(ptx, NULL, -1); } } |