fuzz: Properly initialize PrecomputedTransactionData

pull/764/head
MarcoFalke 4 years ago
parent d67883d01e
commit fa56d56d4e
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -31,7 +31,6 @@ void test_one_input(const std::vector<uint8_t>& buffer)
try { try {
const CTransaction tx(deserialize, ds); const CTransaction tx(deserialize, ds);
const PrecomputedTransactionData txdata(tx);
unsigned int verify_flags; unsigned int verify_flags;
ds >> verify_flags; ds >> verify_flags;
@ -41,10 +40,17 @@ void test_one_input(const std::vector<uint8_t>& buffer)
unsigned int fuzzed_flags; unsigned int fuzzed_flags;
ds >> fuzzed_flags; ds >> fuzzed_flags;
std::vector<CTxOut> spent_outputs;
for (unsigned i = 0; i < tx.vin.size(); ++i) { for (unsigned i = 0; i < tx.vin.size(); ++i) {
CTxOut prevout; CTxOut prevout;
ds >> prevout; ds >> prevout;
spent_outputs.push_back(prevout);
}
PrecomputedTransactionData txdata;
txdata.Init(tx, std::move(spent_outputs));
for (unsigned i = 0; i < tx.vin.size(); ++i) {
const CTxOut& prevout = txdata.m_spent_outputs.at(i);
const TransactionSignatureChecker checker{&tx, i, prevout.nValue, txdata}; const TransactionSignatureChecker checker{&tx, i, prevout.nValue, txdata};
ScriptError serror; ScriptError serror;

Loading…
Cancel
Save