mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 15:20:49 +01:00
[tests] Add fuzz testing for BlockTransactions and BlockTransactionsRequest
This commit is contained in:
parent
57ee73990f
commit
fd3a2f3130
1 changed files with 23 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "pubkey.h"
|
#include "pubkey.h"
|
||||||
|
#include "blockencodings.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -45,6 +46,8 @@ enum TEST_ID {
|
||||||
CBLOOMFILTER_DESERIALIZE,
|
CBLOOMFILTER_DESERIALIZE,
|
||||||
CDISKBLOCKINDEX_DESERIALIZE,
|
CDISKBLOCKINDEX_DESERIALIZE,
|
||||||
CTXOUTCOMPRESSOR_DESERIALIZE,
|
CTXOUTCOMPRESSOR_DESERIALIZE,
|
||||||
|
BLOCKTRANSACTIONS_DESERIALIZE,
|
||||||
|
BLOCKTRANSACTIONSREQUEST_DESERIALIZE,
|
||||||
TEST_ID_END
|
TEST_ID_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -245,6 +248,26 @@ int test_one_input(std::vector<uint8_t> buffer) {
|
||||||
|
|
||||||
break;
|
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:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue