File tree Expand file tree Collapse file tree 3 files changed +7
-46
lines changed Expand file tree Collapse file tree 3 files changed +7
-46
lines changed Original file line number Diff line number Diff line change 8
8
9
9
#include < fs.h>
10
10
#include < net_types.h> // For banmap_t
11
- #include < serialize.h>
12
11
#include < univalue.h>
13
12
14
- #include < string>
15
13
#include < vector>
16
14
17
15
class CAddress ;
@@ -21,21 +19,15 @@ class CDataStream;
21
19
class CBanEntry
22
20
{
23
21
public:
24
- static const int CURRENT_VERSION= 1 ;
25
- int nVersion;
26
- int64_t nCreateTime;
27
- int64_t nBanUntil;
22
+ static constexpr int CURRENT_VERSION{ 1 } ;
23
+ int nVersion{CBanEntry::CURRENT_VERSION} ;
24
+ int64_t nCreateTime{ 0 } ;
25
+ int64_t nBanUntil{ 0 } ;
28
26
29
- CBanEntry ()
30
- {
31
- SetNull ();
32
- }
27
+ CBanEntry () {}
33
28
34
29
explicit CBanEntry (int64_t nCreateTimeIn)
35
- {
36
- SetNull ();
37
- nCreateTime = nCreateTimeIn;
38
- }
30
+ : nCreateTime{nCreateTimeIn} {}
39
31
40
32
/* *
41
33
* Create a ban entry from JSON.
@@ -44,19 +36,6 @@ class CBanEntry
44
36
*/
45
37
explicit CBanEntry (const UniValue& json);
46
38
47
- SERIALIZE_METHODS (CBanEntry, obj)
48
- {
49
- uint8_t ban_reason = 2 ; // ! For backward compatibility
50
- READWRITE (obj.nVersion , obj.nCreateTime , obj.nBanUntil , ban_reason);
51
- }
52
-
53
- void SetNull ()
54
- {
55
- nVersion = CBanEntry::CURRENT_VERSION;
56
- nCreateTime = 0 ;
57
- nBanUntil = 0 ;
58
- }
59
-
60
39
/* *
61
40
* Generate a JSON representation of this ban entry.
62
41
* @return JSON suitable for passing to the `CBanEntry(const UniValue&)` constructor.
Original file line number Diff line number Diff line change @@ -18,20 +18,6 @@ FUZZ_TARGET(addrdb)
18
18
FuzzedDataProvider fuzzed_data_provider (buffer.data (), buffer.size ());
19
19
20
20
// The point of this code is to exercise all CBanEntry constructors.
21
- const CBanEntry ban_entry = [&] {
22
- switch (fuzzed_data_provider.ConsumeIntegralInRange <int >(0 , 2 )) {
23
- case 0 :
24
- return CBanEntry{fuzzed_data_provider.ConsumeIntegral <int64_t >()};
25
- break ;
26
- case 1 : {
27
- const std::optional<CBanEntry> ban_entry = ConsumeDeserializable<CBanEntry>(fuzzed_data_provider);
28
- if (ban_entry) {
29
- return *ban_entry;
30
- }
31
- break ;
32
- }
33
- }
34
- return CBanEntry{};
35
- }();
21
+ const CBanEntry ban_entry{fuzzed_data_provider.ConsumeIntegral <int64_t >()};
36
22
(void )ban_entry; // currently unused
37
23
}
Original file line number Diff line number Diff line change @@ -195,10 +195,6 @@ FUZZ_TARGET_DESERIALIZE(blockheader_deserialize, {
195
195
CBlockHeader bh;
196
196
DeserializeFromFuzzingInput (buffer, bh);
197
197
})
198
- FUZZ_TARGET_DESERIALIZE(banentry_deserialize, {
199
- CBanEntry be;
200
- DeserializeFromFuzzingInput (buffer, be);
201
- })
202
198
FUZZ_TARGET_DESERIALIZE(txundo_deserialize, {
203
199
CTxUndo tu;
204
200
DeserializeFromFuzzingInput (buffer, tu);
You can’t perform that action at this time.
0 commit comments