diff options
author | Anthony Towns <aj@erisian.com.au> | 2023-09-07 19:16:57 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2023-11-14 08:45:30 +1000 |
commit | 6e9e4e6130797b721c8df1eabaf46ec25ebb6abe (patch) | |
tree | 6444c337cd23d1e6aabedf229a9efb1583fb7351 /src/test/fuzz/rpc.cpp | |
parent | 5800c558eb5efb4839ed00d6967e43306d68e1c3 (diff) | |
download | bitcoin-6e9e4e6130797b721c8df1eabaf46ec25ebb6abe.tar.xz |
Use ParamsWrapper for witness serialization
Diffstat (limited to 'src/test/fuzz/rpc.cpp')
-rw-r--r-- | src/test/fuzz/rpc.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/test/fuzz/rpc.cpp b/src/test/fuzz/rpc.cpp index 4e059c7d0a..97b99ea2a3 100644 --- a/src/test/fuzz/rpc.cpp +++ b/src/test/fuzz/rpc.cpp @@ -249,13 +249,13 @@ std::string ConsumeScalarRPCArgument(FuzzedDataProvider& fuzzed_data_provider, b }, [&] { // hex encoded block - std::optional<CBlock> opt_block = ConsumeDeserializable<CBlock>(fuzzed_data_provider); + std::optional<CBlock> opt_block = ConsumeDeserializable<CBlock>(fuzzed_data_provider, TX_WITH_WITNESS); if (!opt_block) { good_data = false; return; } CDataStream data_stream{SER_NETWORK, PROTOCOL_VERSION}; - data_stream << *opt_block; + data_stream << TX_WITH_WITNESS(*opt_block); r = HexStr(data_stream); }, [&] { @@ -271,13 +271,14 @@ std::string ConsumeScalarRPCArgument(FuzzedDataProvider& fuzzed_data_provider, b }, [&] { // hex encoded tx - std::optional<CMutableTransaction> opt_tx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider); + std::optional<CMutableTransaction> opt_tx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider, TX_WITH_WITNESS); if (!opt_tx) { good_data = false; return; } - CDataStream data_stream{SER_NETWORK, fuzzed_data_provider.ConsumeBool() ? PROTOCOL_VERSION : (PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS)}; - data_stream << *opt_tx; + DataStream data_stream; + auto allow_witness = (fuzzed_data_provider.ConsumeBool() ? TX_WITH_WITNESS : TX_NO_WITNESS); + data_stream << allow_witness(*opt_tx); r = HexStr(data_stream); }, [&] { |