1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00

signing: Skip TX_META with SIGHASH_FORKID

This commit is contained in:
Saleem Rashid 2017-07-25 16:49:55 +01:00 committed by Pavol Rusnak
parent a34554b091
commit 979a6ef266

View File

@ -644,11 +644,6 @@ static bool signing_sign_input(void) {
signing_abort(); signing_abort();
return false; return false;
} }
if (!input.has_amount) {
fsm_sendFailure(FailureType_Failure_DataError, _("SIGHASH_FORKID input without amount"));
signing_abort();
return false;
}
if (input.amount > to_spend) { if (input.amount > to_spend) {
fsm_sendFailure(FailureType_Failure_DataError, _("Transaction has changed during signing")); fsm_sendFailure(FailureType_Failure_DataError, _("Transaction has changed during signing"));
signing_abort(); signing_abort();
@ -825,7 +820,23 @@ void signing_txack(TransactionType *tx)
return; return;
} }
#endif #endif
send_req_2_prev_meta();
if (coin->has_forkid) {
if (!tx->inputs[0].has_amount) {
fsm_sendFailure(FailureType_Failure_DataError, _("SIGHASH_FORKID input without amount"));
signing_abort();
return;
}
if (to_spend + tx->inputs[0].amount < to_spend) {
fsm_sendFailure(FailureType_Failure_DataError, _("Value overflow"));
signing_abort();
return;
}
to_spend += tx->inputs[0].amount;
phase1_request_next_input();
} else {
send_req_2_prev_meta();
}
} else if (tx->inputs[0].script_type == InputScriptType_SPENDWITNESS } else if (tx->inputs[0].script_type == InputScriptType_SPENDWITNESS
|| tx->inputs[0].script_type == InputScriptType_SPENDP2SHWITNESS) { || tx->inputs[0].script_type == InputScriptType_SPENDP2SHWITNESS) {
if (!coin->has_segwit || !coin->segwit) { if (!coin->has_segwit || !coin->segwit) {