mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
fuzz: Properly initialize PrecomputedTransactionData
This commit is contained in:
parent
d67883d01e
commit
fa56d56d4e
1 changed files with 7 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue