mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge bc49650b7c into merged_master (Bitcoin PR bitcoin/bitcoin#24310)
This commit is contained in:
commit
a7beef6e4a
3 changed files with 36 additions and 7 deletions
|
|
@ -999,12 +999,15 @@ bool MemPoolAccept::ReplacementChecks(Workspace& ws)
|
|||
TxValidationState& state = ws.m_state;
|
||||
|
||||
CFeeRate newFeeRate(ws.m_modified_fees, ws.m_vsize);
|
||||
// It's possible that the replacement pays more fees than its direct conflicts but not more
|
||||
// than all conflicts (i.e. the direct conflicts have high-fee descendants). However, if the
|
||||
// replacement doesn't pay more fees than its direct conflicts, then we can be sure it's not
|
||||
// more economically rational to mine. Before we go digging through the mempool for all
|
||||
// transactions that would need to be removed (direct conflicts and all descendants), check
|
||||
// that the replacement transaction pays more than its direct conflicts.
|
||||
// The replacement transaction must have a higher feerate than its direct conflicts.
|
||||
// - The motivation for this check is to ensure that the replacement transaction is preferable for
|
||||
// block-inclusion, compared to what would be removed from the mempool.
|
||||
// - This logic predates ancestor feerate-based transaction selection, which is why it doesn't
|
||||
// consider feerates of descendants.
|
||||
// - Note: Ancestor feerate-based transaction selection has made this comparison insufficient to
|
||||
// guarantee that this is incentive-compatible for miners, because it is possible for a
|
||||
// descendant transaction of a direct conflict to pay a higher feerate than the transaction that
|
||||
// might replace them, under these rules.
|
||||
if (const auto err_string{PaysMoreThanConflicts(ws.m_iters_conflicting, newFeeRate, hash)}) {
|
||||
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee", *err_string);
|
||||
}
|
||||
|
|
@ -1409,7 +1412,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
|
|||
// we know is that the inputs aren't available.
|
||||
if (m_pool.exists(GenTxid::Wtxid(wtxid))) {
|
||||
// Exact transaction already exists in the mempool.
|
||||
auto iter = m_pool.GetIter(wtxid);
|
||||
auto iter = m_pool.GetIter(txid);
|
||||
assert(iter != std::nullopt);
|
||||
results.emplace(wtxid, MempoolAcceptResult::MempoolTx(iter.value()->GetTxSize(), iter.value()->GetFee()));
|
||||
} else if (m_pool.exists(GenTxid::Txid(txid))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue