Mark CheckTxInputs [[nodiscard]] (out-param txfee only set if call is successful). Avoid UUM in fuzzing harness coins_view.
This commit is contained in:
1 parent
8600934018
commit
37371268d1
2 files changed
+4
-3
No files matched your search
@@ -24,7 +24,7 @@ namespace Consensus {
|
|||||||
* @param[out] txfee Set to the transaction fee if successful.
|
* @param[out] txfee Set to the transaction fee if successful.
|
||||||
* Preconditions: tx.IsCoinBase() is false.
|
* Preconditions: tx.IsCoinBase() is false.
|
||||||
*/
|
*/
|
||||||
bool CheckTxInputs(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee);
|
[[nodiscard]] bool CheckTxInputs(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee);
|
||||||
} // namespace Consensus
|
} // namespace Consensus
|
||||||
|
|
||||||
/** Auxiliary functions for transaction validation (ideally should not be exposed) */
|
/** Auxiliary functions for transaction validation (ideally should not be exposed) */
|
||||||
|
|||||||
@@ -236,8 +236,9 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view)
|
|||||||
// It is not allowed to call CheckTxInputs if CheckTransaction failed
|
// It is not allowed to call CheckTxInputs if CheckTransaction failed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void)Consensus::CheckTxInputs(transaction, state, coins_view_cache, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, std::numeric_limits<int>::max()), tx_fee_out);
|
if (Consensus::CheckTxInputs(transaction, state, coins_view_cache, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, std::numeric_limits<int>::max()), tx_fee_out)) {
|
||||||
assert(MoneyRange(tx_fee_out));
|
assert(MoneyRange(tx_fee_out));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[&] {
|
[&] {
|
||||||
const CTransaction transaction{random_mutable_transaction};
|
const CTransaction transaction{random_mutable_transaction};
|
||||||
|
|||||||
Reference in new issue
Block a user