mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge bitcoin/bitcoin#28785: validation: return more helpful results for reconsiderable fee failures and skipped transactions
1147e00e59[validation] change package-fee-too-low, return wtxid(s) and effective feerate (glozow)10dd9f2441[test] use CheckPackageMempoolAcceptResult in previous tests (glozow)3979f1afcb[validation] add TxValidationResult::TX_RECONSIDERABLE, TX_UNKNOWN (glozow)5c786a026a[refactor] use Wtxid for m_wtxids_fee_calculations (glozow) Pull request description: Split off from #26711 (suggested in https://github.com/bitcoin/bitcoin/pull/26711#issuecomment-1786392253). This is part of #27463. - Add 2 new TxValidationResults - `TX_RECONSIDERABLE` helps us encode transactions who have failed fee checks that can be bypassed using package validation. This is distinguished from `TX_MEMPOOL_POLICY` so that we re-validate a transaction if and only if it is eligible for package CPFP. In the future, we will have a separate cache for reconsiderable rejects so these transactions don't go in `m_recent_rejects`. - `TX_UNKNOWN` helps us communicate that we aborted package validation and didn't finish looking at this transaction: it's not valid but it's also not invalid (i.e. don't cache it as a rejected tx) - Return effective feerate and the wtxids of transactions used to calculate that effective feerate when the error is `TX_SINGLE_FAILURE`. Previously, we would only provide this information if the transaction passed. Now that we have package validation, it's much more helpful to the caller to know how the failing feerate was calculated. This can also be used to improve our submitpackage RPC result (which is currently a bit unhelpful when things fail). - Use the newly added `CheckPackageMempoolAcceptResult` for existing package validation tests. This increases test coverage and helps test the changes made in this PR. ACKs for top commit: instagibbs: reACK1147e00e59achow101: ACK1147e00e59murchandamus: reACK1147e00e59ismaelsadeeq: ACK1147e00e59Tree-SHA512: ac1cd73c2b487a1b99d329875d39d8107c91345a5b0b241d54a6a4de67faf11be69a2721cc732c503024a9cca381dac33d61e187957279e3c82653bea118ba91
This commit is contained in:
@@ -154,12 +154,15 @@ void CheckATMPInvariants(const MempoolAcceptResult& res, bool txid_in_mempool, b
|
||||
// It may be already in the mempool since in ATMP cases we don't set MEMPOOL_ENTRY or DIFFERENT_WITNESS
|
||||
Assert(!res.m_state.IsValid());
|
||||
Assert(res.m_state.IsInvalid());
|
||||
|
||||
const bool is_reconsiderable{res.m_state.GetResult() == TxValidationResult::TX_RECONSIDERABLE};
|
||||
Assert(!res.m_replaced_transactions);
|
||||
Assert(!res.m_vsize);
|
||||
Assert(!res.m_base_fees);
|
||||
// Unable or unwilling to calculate fees
|
||||
Assert(!res.m_effective_feerate);
|
||||
Assert(!res.m_wtxids_fee_calculations);
|
||||
// Fee information is provided if the failure is TX_RECONSIDERABLE.
|
||||
// In other cases, validation may be unable or unwilling to calculate the fees.
|
||||
Assert(res.m_effective_feerate.has_value() == is_reconsiderable);
|
||||
Assert(res.m_wtxids_fee_calculations.has_value() == is_reconsiderable);
|
||||
Assert(!res.m_other_wtxid);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user