Skip to content

Commit

Permalink
fees fuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelsadeeq committed Jun 13, 2024
1 parent a98cfff commit 8d232a4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/fuzz/fee_rate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <test/fuzz/util/mempool.h>


#include <cstdint>
#include <limits>
Expand Down Expand Up @@ -37,4 +39,17 @@ FUZZ_TARGET(fee_rate)
assert(!(fee_rate >= larger_fee_rate));
assert(fee_rate != larger_fee_rate);
}

bool good_data{true};
LIMITED_WHILE(good_data && fuzzed_data_provider.ConsumeBool(), 10'000)
{
const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider, TX_WITH_WITNESS);
if (!mtx) {
good_data = false;
return;
}
const CTransaction tx{*mtx};
const auto& entry = ConsumeTxMemPoolEntry(fuzzed_data_provider, tx);
CFeeRate(entry.GetFee(), entry.GetTxSize());
}
}

0 comments on commit 8d232a4

Please sign in to comment.