Skip to content

Commit

Permalink
[tests] Add fuzz testing for BlockTransactions and BlockTransactionsR…
Browse files Browse the repository at this point in the history
…equest
  • Loading branch information
practicalswift committed Oct 25, 2017
1 parent 57ee739 commit fd3a2f3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/test_bitcoin_fuzzy.cpp
Expand Up @@ -19,6 +19,7 @@
#include "undo.h"
#include "version.h"
#include "pubkey.h"
#include "blockencodings.h"

#include <stdint.h>
#include <unistd.h>
Expand All @@ -45,6 +46,8 @@ enum TEST_ID {
CBLOOMFILTER_DESERIALIZE,
CDISKBLOCKINDEX_DESERIALIZE,
CTXOUTCOMPRESSOR_DESERIALIZE,
BLOCKTRANSACTIONS_DESERIALIZE,
BLOCKTRANSACTIONSREQUEST_DESERIALIZE,
TEST_ID_END
};

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

break;
}
case BLOCKTRANSACTIONS_DESERIALIZE:
{
try
{
BlockTransactions bt;
ds >> bt;
} catch (const std::ios_base::failure& e) {return 0;}

break;
}
case BLOCKTRANSACTIONSREQUEST_DESERIALIZE:
{
try
{
BlockTransactionsRequest btr;
ds >> btr;
} catch (const std::ios_base::failure& e) {return 0;}

break;
}
default:
return 0;
}
Expand Down

0 comments on commit fd3a2f3

Please sign in to comment.