if (tx_resultm_result_type == MempoolAcceptResult::ResultType::VALID &&
This is a very side comment that does not point to be an annoying comment, just It is just a side note also because I noted that you use this in testmempoolaccept, I think it is just a historical reason?
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index 6f08ac5e4..bc30b9a20 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -871,27 +871,28 @@ static RPCHelpMan submitpackage()
auto it = package_result.m_tx_results.find(tx->GetWitnessHash());
CHECK_NONFATAL(it != package_result.m_tx_results.end());
UniValue result_inner{UniValue::VOBJ};
+ const auto& tx_result = it->second;
result_inner.pushKV("txid", tx->GetHash().GetHex());
- if (it->second.m_result_type == MempoolAcceptResult::ResultType::DIFFERENT_WITNESS) {
- result_inner.pushKV("other-wtxid", it->second.m_other_wtxid.value().GetHex());
+ if (tx_result.m_result_type == MempoolAcceptResult::ResultType::DIFFERENT_WITNESS) {
+ result_inner.pushKV("other-wtxid", tx_result.m_other_wtxid.value().GetHex());
}
- if (it->second.m_result_type == MempoolAcceptResult::ResultType::VALID ||
- it->second.m_result_type == MempoolAcceptResult::ResultType::MEMPOOL_ENTRY) {
- result_inner.pushKV("vsize", int64_t{it->second.m_vsize.value()});
+ if (tx_result.m_result_type == MempoolAcceptResult::ResultType::VALID ||
+ tx_result.m_result_type == MempoolAcceptResult::ResultType::MEMPOOL_ENTRY) {
+ result_inner.pushKV("vsize", int64_t{tx_result.m_vsize.value()});
UniValue fees(UniValue::VOBJ);
- fees.pushKV("base", ValueFromAmount(it->second.m_base_fees.value()));
- if (it->second.m_result_type == MempoolAcceptResult::ResultType::VALID &&
- it->second.m_effective_feerate.value().GetFee(it->second.m_vsize.value()) != it->second.m_base_fees.value()) {
- fees.pushKV("effective-feerate", ValueFromAmount(it->second.m_effective_feerate.value().GetFeePerK()));
+ fees.pushKV("base", ValueFromAmount(tx_result.m_base_fees.value()));
+ if (tx_result.m_result_type == MempoolAcceptResult::ResultType::VALID &&
+ tx_result.m_effective_feerate.value().GetFee(tx_result.m_vsize.value()) != tx_result.m_base_fees.value()) {
+ fees.pushKV("effective-feerate", ValueFromAmount(tx_result.m_effective_feerate.value().GetFeePerK()));
UniValue effective_includes_res(UniValue::VARR);
- for (const auto& wtxid : it->second.m_wtxids_fee_calculations.value()) {
+ for (const auto& wtxid : tx_result.m_wtxids_fee_calculations.value()) {
effective_includes_res.push_back(wtxid.ToString());
}
fees.pushKV("effective-includes", effective_includes_res);
}
result_inner.pushKV("fees", fees);
- if (it->second.m_replaced_transactions.has_value()) {
- for (const auto& ptx : it->second.m_replaced_transactions.value()) {
+ if (tx_result.m_replaced_transactions.has_value()) {
+ for (const auto& ptx : tx_result.m_replaced_transactions.value()) {
replaced_txids.insert(ptx->GetHash());
}
}