mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
[validation] return effective feerate from mempool validation
This commit is contained in:
@@ -134,6 +134,11 @@ struct MempoolAcceptResult {
|
||||
const std::optional<int64_t> m_vsize;
|
||||
/** Raw base fees in satoshis. */
|
||||
const std::optional<CAmount> m_base_fees;
|
||||
/** The feerate at which this transaction was considered. This includes any fee delta added
|
||||
* using prioritisetransaction (i.e. modified fees). If this transaction was submitted as a
|
||||
* package, this is the package feerate, which may also include its descendants and/or
|
||||
* ancestors. Only present when m_result_type = ResultType::VALID. */
|
||||
const std::optional<CFeeRate> m_effective_feerate;
|
||||
|
||||
// The following field is only present when m_result_type = ResultType::DIFFERENT_WITNESS
|
||||
/** The wtxid of the transaction in the mempool which has the same txid but different witness. */
|
||||
@@ -143,8 +148,11 @@ struct MempoolAcceptResult {
|
||||
return MempoolAcceptResult(state);
|
||||
}
|
||||
|
||||
static MempoolAcceptResult Success(std::list<CTransactionRef>&& replaced_txns, int64_t vsize, CAmount fees) {
|
||||
return MempoolAcceptResult(std::move(replaced_txns), vsize, fees);
|
||||
static MempoolAcceptResult Success(std::list<CTransactionRef>&& replaced_txns,
|
||||
int64_t vsize,
|
||||
CAmount fees,
|
||||
CFeeRate effective_feerate) {
|
||||
return MempoolAcceptResult(std::move(replaced_txns), vsize, fees, effective_feerate);
|
||||
}
|
||||
|
||||
static MempoolAcceptResult MempoolTx(int64_t vsize, CAmount fees) {
|
||||
@@ -164,9 +172,15 @@ private:
|
||||
}
|
||||
|
||||
/** Constructor for success case */
|
||||
explicit MempoolAcceptResult(std::list<CTransactionRef>&& replaced_txns, int64_t vsize, CAmount fees)
|
||||
explicit MempoolAcceptResult(std::list<CTransactionRef>&& replaced_txns,
|
||||
int64_t vsize,
|
||||
CAmount fees,
|
||||
CFeeRate effective_feerate)
|
||||
: m_result_type(ResultType::VALID),
|
||||
m_replaced_transactions(std::move(replaced_txns)), m_vsize{vsize}, m_base_fees(fees) {}
|
||||
m_replaced_transactions(std::move(replaced_txns)),
|
||||
m_vsize{vsize},
|
||||
m_base_fees(fees),
|
||||
m_effective_feerate(effective_feerate) {}
|
||||
|
||||
/** Constructor for already-in-mempool case. It wouldn't replace any transactions. */
|
||||
explicit MempoolAcceptResult(int64_t vsize, CAmount fees)
|
||||
|
||||
Reference in New Issue
Block a user