|
|
|
@ -1436,8 +1436,8 @@ void signing_init(const SignTx *msg, const CoinInfo *_coin, const HDNode *_root,
|
|
|
|
|
|
|
|
|
|
static bool signing_validate_input(const TxInputType *txinput) {
|
|
|
|
|
if (txinput->prev_hash.size != 32) {
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_ProcessError,
|
|
|
|
|
_("Encountered invalid prevhash"));
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
|
_("Provided prev_hash is invalid."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -1450,7 +1450,22 @@ static bool signing_validate_input(const TxInputType *txinput) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!txinput->has_multisig &&
|
|
|
|
|
txinput->script_type == InputScriptType_SPENDMULTISIG) {
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
|
_("Multisig details required."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_internal_input_script_type(txinput->script_type)) {
|
|
|
|
|
if (txinput->address_n_count == 0) {
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
|
_("Missing address_n field."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (txinput->has_script_pubkey) {
|
|
|
|
|
// scriptPubKey should only be provided for external inputs
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
@ -1487,6 +1502,14 @@ static bool signing_validate_input(const TxInputType *txinput) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!coin->decred && txinput->has_decred_tree) {
|
|
|
|
|
fsm_sendFailure(
|
|
|
|
|
FailureType_Failure_DataError,
|
|
|
|
|
_("Decred details provided but Decred coin not specified."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_segwit_input_script_type(txinput->script_type)) {
|
|
|
|
|
if (!coin->has_segwit) {
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
@ -1520,8 +1543,8 @@ static bool signing_validate_input(const TxInputType *txinput) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (txinput->orig_hash.size != 32) {
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_ProcessError,
|
|
|
|
|
_("Encountered invalid orig_hash"));
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
|
_("Provided orig_hash is invalid."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -1530,6 +1553,25 @@ static bool signing_validate_input(const TxInputType *txinput) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool signing_validate_prev_input(const TxInputType *txinput) {
|
|
|
|
|
if (txinput->prev_hash.size != 32) {
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError,
|
|
|
|
|
_("Provided prev_hash is invalid."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!coin->decred && txinput->has_decred_tree) {
|
|
|
|
|
fsm_sendFailure(
|
|
|
|
|
FailureType_Failure_DataError,
|
|
|
|
|
_("Decred details provided but Decred coin not specified."));
|
|
|
|
|
signing_abort();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool signing_validate_output(TxOutputType *txoutput) {
|
|
|
|
|
if (txoutput->has_multisig &&
|
|
|
|
|
!is_multisig_output_script_type(txoutput->script_type)) {
|
|
|
|
@ -3657,7 +3699,7 @@ void signing_txack(TransactionType *tx) {
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case STAGE_REQUEST_3_PREV_INPUT:
|
|
|
|
|
if (!signing_validate_input(&tx->inputs[0])) {
|
|
|
|
|
if (!signing_validate_prev_input(&tx->inputs[0])) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
progress_substep++;
|
|
|
|
|