Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,501 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CWallet::BlockConnected( | void CWallet::BlockConnected( | ||||
const CBlock &block, const std::vector<CTransactionRef> &vtxConflicted) { | const CBlock &block, const std::vector<CTransactionRef> &vtxConflicted) { | ||||
const BlockHash &block_hash = block.GetHash(); | const BlockHash &block_hash = block.GetHash(); | ||||
auto locked_chain = chain().lock(); | auto locked_chain = chain().lock(); | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
// TODO: Temporarily 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 receive another | |||||
// notification and there is a race condition where notification of a | |||||
// connected conflict might cause an outside process to abandon a | |||||
// transaction and then have it inadvertently cleared by the notification | |||||
// that the conflicted transaction was evicted. | |||||
for (const CTransactionRef &ptx : vtxConflicted) { | |||||
SyncTransaction(ptx, CWalletTx::Status::CONFLICTED, | |||||
BlockHash() /* block hash */, | |||||
0 /* position in block */); | |||||
TransactionRemovedFromMempool(ptx); | |||||
} | |||||
for (size_t i = 0; i < block.vtx.size(); i++) { | for (size_t i = 0; i < block.vtx.size(); i++) { | ||||
SyncTransaction(block.vtx[i], CWalletTx::Status::CONFIRMED, block_hash, | SyncTransaction(block.vtx[i], CWalletTx::Status::CONFIRMED, block_hash, | ||||
i); | i); | ||||
TransactionRemovedFromMempool(block.vtx[i]); | TransactionRemovedFromMempool(block.vtx[i]); | ||||
} | } | ||||
for (const CTransactionRef &ptx : vtxConflicted) { | |||||
TransactionRemovedFromMempool(ptx); | |||||
} | |||||
m_last_block_processed = block_hash; | m_last_block_processed = block_hash; | ||||
} | } | ||||
void CWallet::BlockDisconnected(const CBlock &block) { | void CWallet::BlockDisconnected(const CBlock &block) { | ||||
auto locked_chain = chain().lock(); | auto locked_chain = chain().lock(); | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
▲ Show 20 Lines • Show All 3,938 Lines • Show Last 20 Lines |