|
|
|
@ -94,6 +94,16 @@ static void UpdateWalletSetting(interfaces::Chain& chain,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Refresh mempool status so the wallet is in an internally consistent state and
|
|
|
|
|
* immediately knows the transaction's status: Whether it can be considered
|
|
|
|
|
* trusted and is eligible to be abandoned ...
|
|
|
|
|
*/
|
|
|
|
|
static void RefreshMempoolStatus(CWalletTx& tx, interfaces::Chain& chain)
|
|
|
|
|
{
|
|
|
|
|
tx.fInMempool = chain.isInMempool(tx.GetHash());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AddWallet(const std::shared_ptr<CWallet>& wallet)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_wallets);
|
|
|
|
@ -788,10 +798,7 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
|
|
|
|
|
wtx.mapValue["replaced_by_txid"] = newHash.ToString();
|
|
|
|
|
|
|
|
|
|
// Refresh mempool status without waiting for transactionRemovedFromMempool
|
|
|
|
|
// notification so the wallet is in an internally consistent state and
|
|
|
|
|
// immediately knows the old transaction should not be considered trusted
|
|
|
|
|
// and is eligible to be abandoned
|
|
|
|
|
wtx.fInMempool = chain().isInMempool(originalHash);
|
|
|
|
|
RefreshMempoolStatus(wtx, chain());
|
|
|
|
|
|
|
|
|
|
WalletBatch batch(GetDatabase());
|
|
|
|
|
|
|
|
|
@ -1191,7 +1198,7 @@ void CWallet::transactionAddedToMempool(const CTransactionRef& tx, uint64_t memp
|
|
|
|
|
|
|
|
|
|
auto it = mapWallet.find(tx->GetHash());
|
|
|
|
|
if (it != mapWallet.end()) {
|
|
|
|
|
it->second.fInMempool = true;
|
|
|
|
|
RefreshMempoolStatus(it->second, chain());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1199,7 +1206,7 @@ void CWallet::transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRe
|
|
|
|
|
LOCK(cs_wallet);
|
|
|
|
|
auto it = mapWallet.find(tx->GetHash());
|
|
|
|
|
if (it != mapWallet.end()) {
|
|
|
|
|
it->second.fInMempool = false;
|
|
|
|
|
RefreshMempoolStatus(it->second, chain());
|
|
|
|
|
}
|
|
|
|
|
// Handle transactions that were removed from the mempool because they
|
|
|
|
|
// conflict with transactions in a newly connected block.
|
|
|
|
|