| 25 | } |
| 26 | |
| 27 | FUZZ_TARGET_INIT(script_sigcache, initialize_script_sigcache) |
| 28 | { |
| 29 | FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); |
| 30 | |
| 31 | const std::optional<CMutableTransaction> mutable_transaction = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider); |
| 32 | const CTransaction tx{mutable_transaction ? *mutable_transaction : CMutableTransaction{}}; |
| 33 | const unsigned int n_in = fuzzed_data_provider.ConsumeIntegral<unsigned int>(); |
| 34 | const CAmount amount = ConsumeMoney(fuzzed_data_provider); |
| 35 | const bool store = fuzzed_data_provider.ConsumeBool(); |
| 36 | PrecomputedTransactionData tx_data; |
| 37 | CachingTransactionSignatureChecker caching_transaction_signature_checker{mutable_transaction ? &tx : nullptr, n_in, amount, store, tx_data}; |
| 38 | if (fuzzed_data_provider.ConsumeBool()) { |
| 39 | const auto random_bytes = fuzzed_data_provider.ConsumeBytes<unsigned char>(64); |
| 40 | const XOnlyPubKey pub_key(ConsumeUInt256(fuzzed_data_provider)); |
| 41 | if (random_bytes.size() == 64) { |
| 42 | (void)caching_transaction_signature_checker.VerifySchnorrSignature(random_bytes, pub_key, ConsumeUInt256(fuzzed_data_provider)); |
| 43 | } |
| 44 | } else { |
| 45 | const auto random_bytes = ConsumeRandomLengthByteVector(fuzzed_data_provider); |
| 46 | const auto pub_key = ConsumeDeserializable<CPubKey>(fuzzed_data_provider); |
| 47 | if (pub_key) { |
| 48 | if (!random_bytes.empty()) { |
| 49 | (void)caching_transaction_signature_checker.VerifyECDSASignature(random_bytes, *pub_key, ConsumeUInt256(fuzzed_data_provider)); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |
nothing calls this directly
no test coverage detected