[validation] return wtxids of other transactions whose fees were used

This commit is contained in:
glozow
2022-12-09 13:13:49 +00:00
parent 1605886380
commit d6c7b78ef2
3 changed files with 55 additions and 11 deletions

View File

@@ -137,8 +137,16 @@ struct MempoolAcceptResult {
/** 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. */
* ancestors (see m_wtxids_fee_calculations below).
* Only present when m_result_type = ResultType::VALID.
*/
const std::optional<CFeeRate> m_effective_feerate;
/** Contains the wtxids of the transactions used for fee-related checks. Includes this
* transaction's wtxid and may include others if this transaction was validated as part of a
* package. This is not necessarily equivalent to the list of transactions passed to
* ProcessNewPackage().
* Only present when m_result_type = ResultType::VALID. */
const std::optional<std::vector<uint256>> m_wtxids_fee_calculations;
// 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. */
@@ -151,8 +159,10 @@ struct MempoolAcceptResult {
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);
CFeeRate effective_feerate,
const std::vector<uint256>& wtxids_fee_calculations) {
return MempoolAcceptResult(std::move(replaced_txns), vsize, fees,
effective_feerate, wtxids_fee_calculations);
}
static MempoolAcceptResult MempoolTx(int64_t vsize, CAmount fees) {
@@ -175,12 +185,14 @@ private:
explicit MempoolAcceptResult(std::list<CTransactionRef>&& replaced_txns,
int64_t vsize,
CAmount fees,
CFeeRate effective_feerate)
CFeeRate effective_feerate,
const std::vector<uint256>& wtxids_fee_calculations)
: m_result_type(ResultType::VALID),
m_replaced_transactions(std::move(replaced_txns)),
m_vsize{vsize},
m_base_fees(fees),
m_effective_feerate(effective_feerate) {}
m_effective_feerate(effective_feerate),
m_wtxids_fee_calculations(wtxids_fee_calculations) {}
/** Constructor for already-in-mempool case. It wouldn't replace any transactions. */
explicit MempoolAcceptResult(int64_t vsize, CAmount fees)