Skip to content

Commit fd3a2f3

Browse files
[tests] Add fuzz testing for BlockTransactions and BlockTransactionsRequest
1 parent 57ee739 commit fd3a2f3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/test/test_bitcoin_fuzzy.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "undo.h"
2020
#include "version.h"
2121
#include "pubkey.h"
22+
#include "blockencodings.h"
2223

2324
#include <stdint.h>
2425
#include <unistd.h>
@@ -45,6 +46,8 @@ enum TEST_ID {
4546
CBLOOMFILTER_DESERIALIZE,
4647
CDISKBLOCKINDEX_DESERIALIZE,
4748
CTXOUTCOMPRESSOR_DESERIALIZE,
49+
BLOCKTRANSACTIONS_DESERIALIZE,
50+
BLOCKTRANSACTIONSREQUEST_DESERIALIZE,
4851
TEST_ID_END
4952
};
5053

@@ -245,6 +248,26 @@ int test_one_input(std::vector<uint8_t> buffer) {
245248

246249
break;
247250
}
251+
case BLOCKTRANSACTIONS_DESERIALIZE:
252+
{
253+
try
254+
{
255+
BlockTransactions bt;
256+
ds >> bt;
257+
} catch (const std::ios_base::failure& e) {return 0;}
258+
259+
break;
260+
}
261+
case BLOCKTRANSACTIONSREQUEST_DESERIALIZE:
262+
{
263+
try
264+
{
265+
BlockTransactionsRequest btr;
266+
ds >> btr;
267+
} catch (const std::ios_base::failure& e) {return 0;}
268+
269+
break;
270+
}
248271
default:
249272
return 0;
250273
}

0 commit comments

Comments
 (0)