1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-10 15:30:55 +00:00

signing: Check decred_script_version for txinput

This commit is contained in:
Saleem Rashid 2017-12-20 20:51:45 +00:00 committed by Pavol Rusnak
parent f0875285b2
commit 0df9404054

View File

@ -559,6 +559,12 @@ static bool signing_check_input(TxInputType *txinput) {
tx_prevout_hash(&hashers[0], txinput);
tx_sequence_hash(&hashers[1], txinput);
if (coin->decred) {
if (txinput->decred_script_version > 0) {
fsm_sendFailure(FailureType_Failure_DataError, _("Decred v1+ scripts are not supported"));
signing_abort();
return false;
}
// serialize Decred prefix in Phase 1
resp.has_serialized = true;
resp.serialized.has_serialized_tx = true;
@ -1037,6 +1043,11 @@ void signing_txack(TransactionType *tx)
signing_abort();
return;
}
if (coin->decred && tx->bin_outputs[0].decred_script_version > 0) {
fsm_sendFailure(FailureType_Failure_DataError, _("Decred script version does not match previous output"));
signing_abort();
return;
}
to_spend += tx->bin_outputs[0].amount;
}
if (idx2 < tp.outputs_len - 1) {