MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ConstructPubKeyBytes

Function ConstructPubKeyBytes

src/test/fuzz/util.cpp:16–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include <memory>
15
16std::vector<uint8_t> ConstructPubKeyBytes(FuzzedDataProvider& fuzzed_data_provider, std::span<const uint8_t> byte_data, const bool compressed) noexcept
17{
18 uint8_t pk_type;
19 if (compressed) {
20 pk_type = fuzzed_data_provider.PickValueInArray({0x02, 0x03});
21 } else {
22 pk_type = fuzzed_data_provider.PickValueInArray({0x04, 0x06, 0x07});
23 }
24 std::vector<uint8_t> pk_data{byte_data.begin(), byte_data.begin() + (compressed ? CPubKey::COMPRESSED_SIZE : CPubKey::SIZE)};
25 pk_data[0] = pk_type;
26 return pk_data;
27}
28
29CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider, const std::optional<CAmount>& max) noexcept
30{

Callers 2

ConsumeScriptFunction · 0.85
ConsumeTxDestinationFunction · 0.85

Calls 2

PickValueInArrayMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected