mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-05 05:15:27 +00:00
legacy: forbid unnecessary fields in OPRETURN output
This commit is contained in:
parent
4af9aa547e
commit
a513f7429b
@ -652,6 +652,15 @@ static bool signing_check_output(TxOutputType *txoutput) {
|
|||||||
// add it to hash_outputs
|
// add it to hash_outputs
|
||||||
// ask user for permission
|
// ask user for permission
|
||||||
|
|
||||||
|
if (txoutput->script_type == OutputScriptType_PAYTOOPRETURN) {
|
||||||
|
if (txoutput->has_address || (txoutput->address_n_count > 0) ||
|
||||||
|
txoutput->has_multisig) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("OP_RETURN output with address or multisig"));
|
||||||
|
signing_abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
// check for change address
|
// check for change address
|
||||||
bool is_change = false;
|
bool is_change = false;
|
||||||
if (txoutput->address_n_count > 0) {
|
if (txoutput->address_n_count > 0) {
|
||||||
|
@ -199,7 +199,8 @@ int compile_output(const CoinInfo *coin, const HDNode *root, TxOutputType *in,
|
|||||||
|
|
||||||
if (in->script_type == OutputScriptType_PAYTOOPRETURN) {
|
if (in->script_type == OutputScriptType_PAYTOOPRETURN) {
|
||||||
// only 0 satoshi allowed for OP_RETURN
|
// only 0 satoshi allowed for OP_RETURN
|
||||||
if (in->amount != 0) {
|
if (in->amount != 0 || in->has_address || (in->address_n_count > 0) ||
|
||||||
|
in->has_multisig) {
|
||||||
return 0; // failed to compile output
|
return 0; // failed to compile output
|
||||||
}
|
}
|
||||||
if (needs_confirm) {
|
if (needs_confirm) {
|
||||||
|
@ -236,4 +236,9 @@ class TestOpReturn:
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert exc.value.args[0] == proto.FailureType.DataError
|
assert exc.value.args[0] == proto.FailureType.DataError
|
||||||
|
if client.features.model == "1":
|
||||||
|
assert exc.value.args[1].endswith(
|
||||||
|
"OP_RETURN output with address or multisig"
|
||||||
|
)
|
||||||
|
else:
|
||||||
assert exc.value.args[1] == "OP_RETURN output with address or multisig"
|
assert exc.value.args[1] == "OP_RETURN output with address or multisig"
|
||||||
|
Loading…
Reference in New Issue
Block a user