Skip to content

Commit ad1f46e

Browse files
committed
Update src/psbt.h file
1 parent 1b72ce3 commit ad1f46e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/psbt.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,13 @@ struct PartiallySignedTransaction
11771177
inputs.push_back(input);
11781178

11791179
// Make sure the non-witness utxo matches the outpoint
1180-
if (input.non_witness_utxo && input.non_witness_utxo->GetHash() != tx->vin[i].prevout.hash) {
1181-
throw std::ios_base::failure("Non-witness UTXO does not match outpoint hash");
1180+
if (input.non_witness_utxo) {
1181+
if (input.non_witness_utxo->GetHash() != tx->vin[i].prevout.hash) {
1182+
throw std::ios_base::failure("Non-witness UTXO does not match outpoint hash");
1183+
}
1184+
if (tx->vin[i].prevout.n >= input.non_witness_utxo->vout.size()) {
1185+
throw std::ios_base::failure("Input specifies output index that does not exist");
1186+
}
11821187
}
11831188
++i;
11841189
}

0 commit comments

Comments
 (0)