Skip to content

Commit

Permalink
fuzz: Properly initialize PrecomputedTransactionData
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Oct 26, 2020
1 parent d67883d commit fa56d56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test/fuzz/script_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ void test_one_input(const std::vector<uint8_t>& buffer)

try {
const CTransaction tx(deserialize, ds);
const PrecomputedTransactionData txdata(tx);

unsigned int verify_flags;
ds >> verify_flags;
Expand All @@ -41,10 +40,17 @@ void test_one_input(const std::vector<uint8_t>& buffer)
unsigned int fuzzed_flags;
ds >> fuzzed_flags;

std::vector<CTxOut> spent_outputs;
for (unsigned i = 0; i < tx.vin.size(); ++i) {
CTxOut 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};

ScriptError serror;
Expand Down

0 comments on commit fa56d56

Please sign in to comment.