mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge bitcoin/bitcoin#21892: fuzz: Avoid excessively large min fee rate in tx_pool
99993f066405863c66ccaec0a8427129f4515768 fuzz: Avoid excessively large min fee rate in tx_pool (MarcoFalke) Pull request description: Any fee rate above 1 BTC / kvB is clearly nonsense, so no need to fuzz this. Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34078 ACKs for top commit: practicalswift: cr ACK 99993f066405863c66ccaec0a8427129f4515768: patch looks correct despite no `fa` prefix in commit hash Tree-SHA512: bd3651d354b13d889ad1708d2b385ad0479de036de74a237346eefad5dbfb1df76ec02b55ec00487ec598657ef6102f992302b14c4e47f913a9962f81f4157e6
This commit is contained in:
parent
4dd36f603a
commit
813993d44a
@ -84,7 +84,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, con
|
||||
{
|
||||
BlockAssembler::Options options;
|
||||
options.nBlockMaxSize = fuzzed_data_provider.ConsumeIntegralInRange(0U, MaxBlockSize(true));
|
||||
options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider)};
|
||||
options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /* max */ COIN)};
|
||||
|
||||
auto assembler = BlockAssembler{chainstate, node, *static_cast<CTxMemPool*>(&tx_pool), ::Params(), options};
|
||||
auto block_template = assembler.CreateNewBlock(CScript{} << OP_TRUE);
|
||||
|
@ -293,6 +293,11 @@ void FillNode(FuzzedDataProvider& fuzzed_data_provider, ConnmanTestMsg& connman,
|
||||
/*relay_txs=*/fuzzed_data_provider.ConsumeBool());
|
||||
}
|
||||
|
||||
CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider, const std::optional<CAmount>& max) noexcept
|
||||
{
|
||||
return fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(0, max.value_or(MAX_MONEY));
|
||||
}
|
||||
|
||||
int64_t ConsumeTime(FuzzedDataProvider& fuzzed_data_provider, const std::optional<int64_t>& min, const std::optional<int64_t>& max) noexcept
|
||||
{
|
||||
// Avoid t=0 (1970-01-01T00:00:00Z) since SetMockTime(0) disables mocktime.
|
||||
|
@ -179,10 +179,7 @@ template <typename WeakEnumType, size_t size>
|
||||
return static_cast<opcodetype>(fuzzed_data_provider.ConsumeIntegralInRange<uint32_t>(0, MAX_OPCODE));
|
||||
}
|
||||
|
||||
[[nodiscard]] inline CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider) noexcept
|
||||
{
|
||||
return fuzzed_data_provider.ConsumeIntegralInRange<CAmount>(0, MAX_MONEY);
|
||||
}
|
||||
[[nodiscard]] CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider, const std::optional<CAmount>& max = std::nullopt) noexcept;
|
||||
|
||||
[[nodiscard]] int64_t ConsumeTime(FuzzedDataProvider& fuzzed_data_provider, const std::optional<int64_t>& min = std::nullopt, const std::optional<int64_t>& max = std::nullopt) noexcept;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user