[packages/policy] use package feerate in package validation

This allows CPFP within a package prior to submission to mempool.
This commit is contained in:
glozow
2021-07-20 13:26:26 +01:00
parent 09f32cffa6
commit 17a8ffd802
3 changed files with 52 additions and 15 deletions

View File

@@ -234,11 +234,19 @@ struct PackageMempoolAcceptResult
* was a package-wide error (see result in m_state), m_tx_results will be empty.
*/
std::map<const uint256, const MempoolAcceptResult> m_tx_results;
/** Package feerate, defined as the aggregated modified fees divided by the total virtual size
* of all transactions in the package. May be unavailable if some inputs were not available or
* a transaction failure caused validation to terminate early. */
std::optional<CFeeRate> m_package_feerate;
explicit PackageMempoolAcceptResult(PackageValidationState state,
std::map<const uint256, const MempoolAcceptResult>&& results)
: m_state{state}, m_tx_results(std::move(results)) {}
explicit PackageMempoolAcceptResult(PackageValidationState state, CFeeRate feerate,
std::map<const uint256, const MempoolAcceptResult>&& results)
: m_state{state}, m_tx_results(std::move(results)), m_package_feerate{feerate} {}
/** Constructor to create a PackageMempoolAcceptResult from a single MempoolAcceptResult */
explicit PackageMempoolAcceptResult(const uint256& wtxid, const MempoolAcceptResult& result)
: m_tx_results{ {wtxid, result} } {}