mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge bitcoin/bitcoin#22065: Mark CheckTxInputs
[[nodiscard]]
. Avoid UUM in fuzzing harness coins_view
.
37371268d14ed6d5739af5b65d8bdb38b0e8dda2 Mark `CheckTxInputs` `[[nodiscard]]` (out-param `txfee` only set if call is successful). Avoid UUM in fuzzing harness `coins_view`. (practicalswift) Pull request description: Mark `CheckTxInputs` `[[nodiscard]]` (out-param `txfee` only set if call is successful). Avoid use of uninitialised memory (UUM) in fuzzing harness `coins_view`. ACKs for top commit: MarcoFalke: review ACK 37371268d14ed6d5739af5b65d8bdb38b0e8dda2 Tree-SHA512: edada5b2e80ce9ad3bd57b4c445bedefffa0a2d1cc880957d6848e4b7d9fc1ce036cd17f8b18bc03a36fbf84fc29c166cd6ac3dfbfe03e69d6fdbda13697754d
This commit is contained in:
parent
3520ac271e
commit
3550fff5a4
@ -24,7 +24,7 @@ namespace Consensus {
|
||||
* @param[out] txfee Set to the transaction fee if successful.
|
||||
* 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
|
||||
|
||||
/** Auxiliary functions for transaction validation (ideally should not be exposed) */
|
||||
|
@ -235,8 +235,9 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view)
|
||||
// It is not allowed to call CheckTxInputs if CheckTransaction failed
|
||||
return;
|
||||
}
|
||||
(void)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));
|
||||
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));
|
||||
}
|
||||
},
|
||||
[&] {
|
||||
const CTransaction transaction{random_mutable_transaction};
|
||||
|
Loading…
Reference in New Issue
Block a user