mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge dd5f5713bc into merged_master (Bitcoin PR bitcoin/bitcoin#28391)
This commit is contained in:
commit
d55f2b27cb
14 changed files with 113 additions and 94 deletions
|
|
@ -366,7 +366,7 @@ void Chainstate::MaybeUpdateMempoolForReorg(
|
|||
const std::optional<LockPoints> new_lock_points{CalculateLockPointsAtTip(m_chain.Tip(), view_mempool, tx)};
|
||||
if (new_lock_points.has_value() && CheckSequenceLocksAtTip(m_chain.Tip(), *new_lock_points)) {
|
||||
// Now update the mempool entry lockpoints as well.
|
||||
m_mempool->mapTx.modify(it, [&new_lock_points](CTxMemPoolEntry& e) { e.UpdateLockPoints(*new_lock_points); });
|
||||
it->UpdateLockPoints(*new_lock_points);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -375,9 +375,7 @@ void Chainstate::MaybeUpdateMempoolForReorg(
|
|||
// If the transaction spends any coinbase outputs, it must be mature.
|
||||
if (it->GetSpendsCoinbase()) {
|
||||
for (const CTxIn& txin : tx.vin) {
|
||||
auto it2 = m_mempool->mapTx.find(txin.prevout.hash);
|
||||
if (it2 != m_mempool->mapTx.end())
|
||||
continue;
|
||||
if (m_mempool->exists(GenTxid::Txid(txin.prevout.hash))) continue;
|
||||
const Coin& coin{CoinsTip().AccessCoin(txin.prevout)};
|
||||
assert(!coin.IsSpent());
|
||||
const auto mempool_spend_height{m_chain.Tip()->nHeight + 1};
|
||||
|
|
@ -1607,9 +1605,8 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
|
|||
// transactions that are already in the mempool, and only call AcceptMultipleTransactions() with
|
||||
// the new transactions. This ensures we don't double-count transaction counts and sizes when
|
||||
// checking ancestor/descendant limits, or double-count transaction fees for fee-related policy.
|
||||
auto iter = m_pool.GetIter(txid);
|
||||
assert(iter != std::nullopt);
|
||||
results_final.emplace(wtxid, MempoolAcceptResult::MempoolTx(iter.value()->GetTxSize(), iter.value()->GetFee()));
|
||||
const auto& entry{*Assert(m_pool.GetEntry(txid))};
|
||||
results_final.emplace(wtxid, MempoolAcceptResult::MempoolTx(entry.GetTxSize(), entry.GetFee()));
|
||||
} else if (m_pool.exists(GenTxid::Txid(txid))) {
|
||||
// Transaction with the same non-witness data but different witness (same txid,
|
||||
// different wtxid) already exists in the mempool.
|
||||
|
|
@ -1618,10 +1615,9 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
|
|||
// transaction for the mempool one. Note that we are ignoring the validity of the
|
||||
// package transaction passed in.
|
||||
// TODO: allow witness replacement in packages.
|
||||
auto iter = m_pool.GetIter(txid);
|
||||
assert(iter != std::nullopt);
|
||||
const auto& entry{*Assert(m_pool.GetEntry(txid))};
|
||||
// Provide the wtxid of the mempool tx so that the caller can look it up in the mempool.
|
||||
results_final.emplace(wtxid, MempoolAcceptResult::MempoolTxDifferentWitness(iter.value()->GetTx().GetWitnessHash()));
|
||||
results_final.emplace(wtxid, MempoolAcceptResult::MempoolTxDifferentWitness(entry.GetTx().GetWitnessHash()));
|
||||
} else {
|
||||
// Transaction does not already exist in the mempool.
|
||||
// Try submitting the transaction on its own.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue