mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 10:30:08 +01:00
refactor: Replace uint256 type with Wtxid in PackageMempoolAcceptResult struct
This commit is contained in:
parent
795cfcfa10
commit
7ac6ab4d1a
2 changed files with 12 additions and 12 deletions
|
@ -696,7 +696,7 @@ private:
|
||||||
// cache - should only be called after successful validation of all transactions in the package.
|
// cache - should only be called after successful validation of all transactions in the package.
|
||||||
// Does not call LimitMempoolSize(), so mempool max_size_bytes may be temporarily exceeded.
|
// Does not call LimitMempoolSize(), so mempool max_size_bytes may be temporarily exceeded.
|
||||||
bool SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& workspaces, PackageValidationState& package_state,
|
bool SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& workspaces, PackageValidationState& package_state,
|
||||||
std::map<uint256, MempoolAcceptResult>& results)
|
std::map<Wtxid, MempoolAcceptResult>& results)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
|
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
|
||||||
|
|
||||||
// Compare a package's feerate against minimum allowed.
|
// Compare a package's feerate against minimum allowed.
|
||||||
|
@ -1338,7 +1338,7 @@ void MemPoolAccept::FinalizeSubpackage(const ATMPArgs& args)
|
||||||
|
|
||||||
bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& workspaces,
|
bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& workspaces,
|
||||||
PackageValidationState& package_state,
|
PackageValidationState& package_state,
|
||||||
std::map<uint256, MempoolAcceptResult>& results)
|
std::map<Wtxid, MempoolAcceptResult>& results)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
AssertLockHeld(m_pool.cs);
|
AssertLockHeld(m_pool.cs);
|
||||||
|
@ -1512,7 +1512,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactions(const std::
|
||||||
workspaces.reserve(txns.size());
|
workspaces.reserve(txns.size());
|
||||||
std::transform(txns.cbegin(), txns.cend(), std::back_inserter(workspaces),
|
std::transform(txns.cbegin(), txns.cend(), std::back_inserter(workspaces),
|
||||||
[](const auto& tx) { return Workspace(tx); });
|
[](const auto& tx) { return Workspace(tx); });
|
||||||
std::map<uint256, MempoolAcceptResult> results;
|
std::map<Wtxid, MempoolAcceptResult> results;
|
||||||
|
|
||||||
LOCK(m_pool.cs);
|
LOCK(m_pool.cs);
|
||||||
|
|
||||||
|
@ -1751,11 +1751,11 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
|
||||||
LOCK(m_pool.cs);
|
LOCK(m_pool.cs);
|
||||||
// Stores results from which we will create the returned PackageMempoolAcceptResult.
|
// Stores results from which we will create the returned PackageMempoolAcceptResult.
|
||||||
// A result may be changed if a mempool transaction is evicted later due to LimitMempoolSize().
|
// A result may be changed if a mempool transaction is evicted later due to LimitMempoolSize().
|
||||||
std::map<uint256, MempoolAcceptResult> results_final;
|
std::map<Wtxid, MempoolAcceptResult> results_final;
|
||||||
// Results from individual validation which will be returned if no other result is available for
|
// Results from individual validation which will be returned if no other result is available for
|
||||||
// this transaction. "Nonfinal" because if a transaction fails by itself but succeeds later
|
// this transaction. "Nonfinal" because if a transaction fails by itself but succeeds later
|
||||||
// (i.e. when evaluated with a fee-bumping child), the result in this map may be discarded.
|
// (i.e. when evaluated with a fee-bumping child), the result in this map may be discarded.
|
||||||
std::map<uint256, MempoolAcceptResult> individual_results_nonfinal;
|
std::map<Wtxid, MempoolAcceptResult> individual_results_nonfinal;
|
||||||
// Tracks whether we think package submission could result in successful entry to the mempool
|
// Tracks whether we think package submission could result in successful entry to the mempool
|
||||||
bool quit_early{false};
|
bool quit_early{false};
|
||||||
std::vector<CTransactionRef> txns_package_eval;
|
std::vector<CTransactionRef> txns_package_eval;
|
||||||
|
|
|
@ -154,7 +154,7 @@ struct MempoolAcceptResult {
|
||||||
const std::optional<std::vector<Wtxid>> m_wtxids_fee_calculations;
|
const std::optional<std::vector<Wtxid>> m_wtxids_fee_calculations;
|
||||||
|
|
||||||
/** The wtxid of the transaction in the mempool which has the same txid but different witness. */
|
/** The wtxid of the transaction in the mempool which has the same txid but different witness. */
|
||||||
const std::optional<uint256> m_other_wtxid;
|
const std::optional<Wtxid> m_other_wtxid;
|
||||||
|
|
||||||
static MempoolAcceptResult Failure(TxValidationState state) {
|
static MempoolAcceptResult Failure(TxValidationState state) {
|
||||||
return MempoolAcceptResult(state);
|
return MempoolAcceptResult(state);
|
||||||
|
@ -179,7 +179,7 @@ struct MempoolAcceptResult {
|
||||||
return MempoolAcceptResult(vsize, fees);
|
return MempoolAcceptResult(vsize, fees);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MempoolAcceptResult MempoolTxDifferentWitness(const uint256& other_wtxid) {
|
static MempoolAcceptResult MempoolTxDifferentWitness(const Wtxid& other_wtxid) {
|
||||||
return MempoolAcceptResult(other_wtxid);
|
return MempoolAcceptResult(other_wtxid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ private:
|
||||||
: m_result_type(ResultType::MEMPOOL_ENTRY), m_vsize{vsize}, m_base_fees(fees) {}
|
: m_result_type(ResultType::MEMPOOL_ENTRY), m_vsize{vsize}, m_base_fees(fees) {}
|
||||||
|
|
||||||
/** Constructor for witness-swapped case. */
|
/** Constructor for witness-swapped case. */
|
||||||
explicit MempoolAcceptResult(const uint256& other_wtxid)
|
explicit MempoolAcceptResult(const Wtxid& other_wtxid)
|
||||||
: m_result_type(ResultType::DIFFERENT_WITNESS), m_other_wtxid(other_wtxid) {}
|
: m_result_type(ResultType::DIFFERENT_WITNESS), m_other_wtxid(other_wtxid) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -234,18 +234,18 @@ struct PackageMempoolAcceptResult
|
||||||
* present, it means validation was unfinished for that transaction. If there
|
* present, it means validation was unfinished for that transaction. If there
|
||||||
* was a package-wide error (see result in m_state), m_tx_results will be empty.
|
* was a package-wide error (see result in m_state), m_tx_results will be empty.
|
||||||
*/
|
*/
|
||||||
std::map<uint256, MempoolAcceptResult> m_tx_results;
|
std::map<Wtxid, MempoolAcceptResult> m_tx_results;
|
||||||
|
|
||||||
explicit PackageMempoolAcceptResult(PackageValidationState state,
|
explicit PackageMempoolAcceptResult(PackageValidationState state,
|
||||||
std::map<uint256, MempoolAcceptResult>&& results)
|
std::map<Wtxid, MempoolAcceptResult>&& results)
|
||||||
: m_state{state}, m_tx_results(std::move(results)) {}
|
: m_state{state}, m_tx_results(std::move(results)) {}
|
||||||
|
|
||||||
explicit PackageMempoolAcceptResult(PackageValidationState state, CFeeRate feerate,
|
explicit PackageMempoolAcceptResult(PackageValidationState state, CFeeRate feerate,
|
||||||
std::map<uint256, MempoolAcceptResult>&& results)
|
std::map<Wtxid, MempoolAcceptResult>&& results)
|
||||||
: m_state{state}, m_tx_results(std::move(results)) {}
|
: m_state{state}, m_tx_results(std::move(results)) {}
|
||||||
|
|
||||||
/** Constructor to create a PackageMempoolAcceptResult from a single MempoolAcceptResult */
|
/** Constructor to create a PackageMempoolAcceptResult from a single MempoolAcceptResult */
|
||||||
explicit PackageMempoolAcceptResult(const uint256& wtxid, const MempoolAcceptResult& result)
|
explicit PackageMempoolAcceptResult(const Wtxid& wtxid, const MempoolAcceptResult& result)
|
||||||
: m_tx_results{ {wtxid, result} } {}
|
: m_tx_results{ {wtxid, result} } {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue