1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

legacy/signing: Check inputs for amount field only when amount is required.

This commit is contained in:
Andrew Kozlik 2020-03-27 16:42:50 +01:00 committed by Tomas Susanka
parent d34428eeb3
commit 386be6ff09

View File

@ -674,17 +674,6 @@ static bool signing_validate_input(const TxInputType *txinput) {
return false;
}
#if !BITCOIN_ONLY
if (coin->force_bip143 || coin->overwintered) {
if (!txinput->has_amount) {
fsm_sendFailure(FailureType_Failure_DataError,
_("Expected input with amount"));
signing_abort();
return false;
}
}
#endif
if (is_segwit_input_script_type(txinput)) {
if (!coin->has_segwit) {
fsm_sendFailure(FailureType_Failure_DataError,
@ -692,12 +681,6 @@ static bool signing_validate_input(const TxInputType *txinput) {
signing_abort();
return false;
}
if (!txinput->has_amount) {
fsm_sendFailure(FailureType_Failure_DataError,
_("Segwit input without amount"));
signing_abort();
return false;
}
}
return true;
@ -1159,6 +1142,12 @@ static bool signing_sign_segwit_input(TxInputType *txinput) {
uint8_t hash[32] = {0};
if (is_segwit_input_script_type(txinput)) {
if (!txinput->has_amount) {
fsm_sendFailure(FailureType_Failure_DataError,
_("Segwit input without amount"));
signing_abort();
return false;
}
if (!compile_input_script_sig(txinput)) {
fsm_sendFailure(FailureType_Failure_ProcessError,
_("Failed to compile input"));
@ -1617,6 +1606,12 @@ void signing_txack(TransactionType *tx) {
signing_abort();
return;
}
if (!tx->inputs[0].has_amount) {
fsm_sendFailure(FailureType_Failure_DataError,
_("Expected input with amount"));
signing_abort();
return;
}
uint8_t hash[32] = {0};
#if !BITCOIN_ONLY