diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-04-28 08:06:25 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-04-28 08:06:43 +0200 |
commit | edf679503c55f4a119e6c64b76ba20e71a46d27a (patch) | |
tree | 4000079b78109ad883471ed90b49161742cf4e54 | |
parent | bce09da1228a34b924b25864a5c814da77d2b3d0 (diff) | |
parent | 363df758a9e0b5e0aa5ab401de2de820fc362c19 (diff) |
Merge bitcoin/bitcoin#21783: refactor: Make MempoolAcceptResult members const
363df758a9e0b5e0aa5ab401de2de820fc362c19 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 (https://github.com/bitcoin/bitcoin/pull/21062#discussion_r573659273)
- List fee units (https://github.com/bitcoin/bitcoin/pull/21062#discussion_r569329362)
- Use default value for `TxValidationState` in the success case (https://github.com/bitcoin/bitcoin/pull/21062#discussion_r573659801).
ACKs for top commit:
jnewbery:
ACK 363df758a9e0b5e0aa5ab401de2de820fc362c19
practicalswift:
cr ACK 363df758a9e0b5e0aa5ab401de2de820fc362c19: patch looks correct and `const` is better than non-`const` (where possible :))
ariard:
Code Review ACK 363df75
Tree-SHA512: 0ff1a0279e08e03204e48d0f4c92428d7f39c32f52c1d20fe6a0283d605839898297344be82ca69640ba9f878ca4ebd5da2d717e26d719a183b211d709334082
-rw-r--r-- | src/validation.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/validation.h b/src/validation.h index a5e6892aa9..ed1ba4310c 100644 --- a/src/validation.h +++ b/src/validation.h @@ -195,14 +195,14 @@ struct MempoolAcceptResult { VALID, //!> Fully validated, valid. INVALID, //!> Invalid. }; - ResultType m_result_type; - TxValidationState m_state; + const ResultType m_result_type; + const TxValidationState m_state; // The following fields are only present when m_result_type = ResultType::VALID /** Mempool transactions replaced by the tx per BIP 125 rules. */ - std::optional<std::list<CTransactionRef>> m_replaced_transactions; - /** Raw base fees. */ - std::optional<CAmount> m_base_fees; + const std::optional<std::list<CTransactionRef>> m_replaced_transactions; + /** Raw base fees in satoshis. */ + const std::optional<CAmount> m_base_fees; /** Constructor for failure case */ explicit MempoolAcceptResult(TxValidationState state) @@ -212,7 +212,7 @@ struct MempoolAcceptResult { /** Constructor for success case */ explicit MempoolAcceptResult(std::list<CTransactionRef>&& replaced_txns, CAmount fees) - : m_result_type(ResultType::VALID), m_state(TxValidationState{}), + : m_result_type(ResultType::VALID), m_replaced_transactions(std::move(replaced_txns)), m_base_fees(fees) {} }; |