mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
fuzz: Move CTxDestination fuzzing to script fuzz target
No need to split it over several targets
This commit is contained in:
@@ -6,8 +6,10 @@
|
||||
#include <compressor.h>
|
||||
#include <core_io.h>
|
||||
#include <core_memusage.h>
|
||||
#include <key_io.h>
|
||||
#include <policy/policy.h>
|
||||
#include <pubkey.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <script/script.h>
|
||||
@@ -188,9 +190,22 @@ FUZZ_TARGET_INIT(script, initialize_script)
|
||||
fuzzed_data_provider.ConsumeBool() ?
|
||||
DecodeDestination(fuzzed_data_provider.ConsumeRandomLengthString()) :
|
||||
ConsumeTxDestination(fuzzed_data_provider)};
|
||||
const CTxDestination tx_destination_2 = ConsumeTxDestination(fuzzed_data_provider);
|
||||
const CTxDestination tx_destination_2{ConsumeTxDestination(fuzzed_data_provider)};
|
||||
const std::string encoded_dest{EncodeDestination(tx_destination_1)};
|
||||
const UniValue json_dest{DescribeAddress(tx_destination_1)};
|
||||
Assert(tx_destination_1 == DecodeDestination(encoded_dest));
|
||||
(void)GetKeyForDestination(/* store */ {}, tx_destination_1);
|
||||
const CScript dest{GetScriptForDestination(tx_destination_1)};
|
||||
const bool valid{IsValidDestination(tx_destination_1)};
|
||||
Assert(dest.empty() != valid);
|
||||
|
||||
Assert(valid == IsValidDestinationString(encoded_dest));
|
||||
|
||||
(void)(tx_destination_1 == tx_destination_2);
|
||||
(void)(tx_destination_1 < tx_destination_2);
|
||||
if (tx_destination_1 == tx_destination_2) {
|
||||
Assert(encoded_dest == EncodeDestination(tx_destination_2));
|
||||
Assert(json_dest.write() == DescribeAddress(tx_destination_2).write());
|
||||
Assert(dest == GetScriptForDestination(tx_destination_2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user