File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ FUZZ_TARGETS = \
34
34
test/fuzz/eval_script \
35
35
test/fuzz/fee_rate \
36
36
test/fuzz/fee_rate_deserialize \
37
+ test/fuzz/fees \
37
38
test/fuzz/flat_file_pos_deserialize \
38
39
test/fuzz/flatfile \
39
40
test/fuzz/float \
@@ -465,6 +466,12 @@ test_fuzz_fee_rate_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
465
466
test_fuzz_fee_rate_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
466
467
test_fuzz_fee_rate_deserialize_SOURCES = test/fuzz/deserialize.cpp
467
468
469
+ test_fuzz_fees_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
470
+ test_fuzz_fees_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
471
+ test_fuzz_fees_LDADD = $(FUZZ_SUITE_LD_COMMON)
472
+ test_fuzz_fees_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
473
+ test_fuzz_fees_SOURCES = test/fuzz/fees.cpp
474
+
468
475
test_fuzz_flat_file_pos_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DFLAT_FILE_POS_DESERIALIZE=1
469
476
test_fuzz_flat_file_pos_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
470
477
test_fuzz_flat_file_pos_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2020 The Bitcoin Core developers
2
+ // Distributed under the MIT software license, see the accompanying
3
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
+
5
+ #include < amount.h>
6
+ #include < optional.h>
7
+ #include < policy/fees.h>
8
+ #include < test/fuzz/FuzzedDataProvider.h>
9
+ #include < test/fuzz/fuzz.h>
10
+ #include < test/fuzz/util.h>
11
+
12
+ #include < cstdint>
13
+ #include < string>
14
+ #include < vector>
15
+
16
+ void test_one_input (const std::vector<uint8_t >& buffer)
17
+ {
18
+ FuzzedDataProvider fuzzed_data_provider (buffer.data (), buffer.size ());
19
+ const CFeeRate minimal_incremental_fee{ConsumeMoney (fuzzed_data_provider)};
20
+ FeeFilterRounder fee_filter_rounder{minimal_incremental_fee};
21
+ while (fuzzed_data_provider.ConsumeBool ()) {
22
+ const CAmount current_minimum_fee = ConsumeMoney (fuzzed_data_provider);
23
+ const CAmount rounded_fee = fee_filter_rounder.round (current_minimum_fee);
24
+ assert (MoneyRange (rounded_fee));
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments