Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/descriptor_parse.cpp
// Copyright (c) 2009-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <pubkey.h> | |||||
#include <script/descriptor.h> | #include <script/descriptor.h> | ||||
#include <test/fuzz/fuzz.h> | #include <test/fuzz/fuzz.h> | ||||
#include <memory> | |||||
void initialize() { | void initialize() { | ||||
static const auto verify_handle = std::make_unique<ECCVerifyHandle>(); | |||||
SelectParams(CBaseChainParams::REGTEST); | SelectParams(CBaseChainParams::REGTEST); | ||||
} | } | ||||
void test_one_input(const std::vector<uint8_t> &buffer) { | void test_one_input(const std::vector<uint8_t> &buffer) { | ||||
const std::string descriptor(buffer.begin(), buffer.end()); | const std::string descriptor(buffer.begin(), buffer.end()); | ||||
FlatSigningProvider signing_provider; | FlatSigningProvider signing_provider; | ||||
std::string error; | std::string error; | ||||
for (const bool require_checksum : {true, false}) { | for (const bool require_checksum : {true, false}) { | ||||
Parse(descriptor, signing_provider, error, require_checksum); | Parse(descriptor, signing_provider, error, require_checksum); | ||||
} | } | ||||
} | } |