mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Remove locked_chain from GetDepthInMainChain and its callers
We don't remove yet Chain locks as we need to preserve lock order with CWallet one until swapping at once to avoid deadlock failures (spotted by --enable-debug)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Check whether transaction has descendant in wallet or mempool, or has been
|
||||
//! mined, or conflicts with a mined transaction. Return a feebumper::Result.
|
||||
static feebumper::Result PreconditionChecks(interfaces::Chain::Lock& locked_chain, const CWallet& wallet, const CWalletTx& wtx, std::vector<std::string>& errors) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
|
||||
static feebumper::Result PreconditionChecks(const CWallet& wallet, const CWalletTx& wtx, std::vector<std::string>& errors) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
|
||||
{
|
||||
if (wallet.HasWalletSpend(wtx.GetHash())) {
|
||||
errors.push_back("Transaction has descendants in the wallet");
|
||||
@@ -30,7 +30,7 @@ static feebumper::Result PreconditionChecks(interfaces::Chain::Lock& locked_chai
|
||||
}
|
||||
}
|
||||
|
||||
if (wtx.GetDepthInMainChain(locked_chain) != 0) {
|
||||
if (wtx.GetDepthInMainChain() != 0) {
|
||||
errors.push_back("Transaction has been mined, or is conflicted with a mined transaction");
|
||||
return feebumper::Result::WALLET_ERROR;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ bool TransactionCanBeBumped(const CWallet& wallet, const uint256& txid)
|
||||
if (wtx == nullptr) return false;
|
||||
|
||||
std::vector<std::string> errors_dummy;
|
||||
feebumper::Result res = PreconditionChecks(*locked_chain, wallet, *wtx, errors_dummy);
|
||||
feebumper::Result res = PreconditionChecks(wallet, *wtx, errors_dummy);
|
||||
return res == feebumper::Result::OK;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ Result CreateTotalBumpTransaction(const CWallet* wallet, const uint256& txid, co
|
||||
}
|
||||
const CWalletTx& wtx = it->second;
|
||||
|
||||
Result result = PreconditionChecks(*locked_chain, *wallet, wtx, errors);
|
||||
Result result = PreconditionChecks(*wallet, wtx, errors);
|
||||
if (result != Result::OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
|
||||
}
|
||||
const CWalletTx& wtx = it->second;
|
||||
|
||||
Result result = PreconditionChecks(*locked_chain, wallet, wtx, errors);
|
||||
Result result = PreconditionChecks(wallet, wtx, errors);
|
||||
if (result != Result::OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransacti
|
||||
CWalletTx& oldWtx = it->second;
|
||||
|
||||
// make sure the transaction still has no descendants and hasn't been mined in the meantime
|
||||
Result result = PreconditionChecks(*locked_chain, wallet, oldWtx, errors);
|
||||
Result result = PreconditionChecks(wallet, oldWtx, errors);
|
||||
if (result != Result::OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user