Skip to content

Commit edf6795

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#21783: refactor: Make MempoolAcceptResult members const
363df75 doc/style followups in MempoolAcceptResult (glozow) Pull request description: Follow up to #21062. Was going to be a part of #20833 but I'm trying to break it down as much as possible. - Make members const (bitcoin/bitcoin#21062 (comment)) - List fee units (bitcoin/bitcoin#21062 (comment)) - Use default value for `TxValidationState` in the success case (bitcoin/bitcoin#21062 (comment)). ACKs for top commit: jnewbery: ACK 363df75 practicalswift: cr ACK 363df75: patch looks correct and `const` is better than non-`const` (where possible :)) ariard: Code Review ACK 363df75 Tree-SHA512: 0ff1a0279e08e03204e48d0f4c92428d7f39c32f52c1d20fe6a0283d605839898297344be82ca69640ba9f878ca4ebd5da2d717e26d719a183b211d709334082
2 parents bce09da + 363df75 commit edf6795

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/validation.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ struct MempoolAcceptResult {
195195
VALID, //!> Fully validated, valid.
196196
INVALID, //!> Invalid.
197197
};
198-
ResultType m_result_type;
199-
TxValidationState m_state;
198+
const ResultType m_result_type;
199+
const TxValidationState m_state;
200200

201201
// The following fields are only present when m_result_type = ResultType::VALID
202202
/** Mempool transactions replaced by the tx per BIP 125 rules. */
203-
std::optional<std::list<CTransactionRef>> m_replaced_transactions;
204-
/** Raw base fees. */
205-
std::optional<CAmount> m_base_fees;
203+
const std::optional<std::list<CTransactionRef>> m_replaced_transactions;
204+
/** Raw base fees in satoshis. */
205+
const std::optional<CAmount> m_base_fees;
206206

207207
/** Constructor for failure case */
208208
explicit MempoolAcceptResult(TxValidationState state)
@@ -212,7 +212,7 @@ struct MempoolAcceptResult {
212212

213213
/** Constructor for success case */
214214
explicit MempoolAcceptResult(std::list<CTransactionRef>&& replaced_txns, CAmount fees)
215-
: m_result_type(ResultType::VALID), m_state(TxValidationState{}),
215+
: m_result_type(ResultType::VALID),
216216
m_replaced_transactions(std::move(replaced_txns)), m_base_fees(fees) {}
217217
};
218218

0 commit comments

Comments
 (0)