Skip to content

Commit 0903159

Browse files
committed
core, legacy: make sure OPRETURN ouput is not marked as change
1 parent a513f74 commit 0903159

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

core/src/apps/wallet/sign_tx/signing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,13 @@ def output_is_change(
790790
segwit_in: int,
791791
multifp: multisig.MultisigFingerprint,
792792
) -> bool:
793+
if o.script_type not in (
794+
OutputScriptType.PAYTOADDRESS,
795+
OutputScriptType.PAYTOMULTISIG,
796+
OutputScriptType.PAYTOWITNESS,
797+
OutputScriptType.PAYTOP2SHWITNESS,
798+
):
799+
return False
793800
if o.multisig and not multifp.matches(o.multisig):
794801
return False
795802
if output_is_segwit(o) and o.amount > segwit_in:

legacy/firmware/signing.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,13 @@ static bool signing_check_output(TxOutputType *txoutput) {
696696
}
697697
}
698698

699+
if ((txoutput->script_type != OutputScriptType_PAYTOADDRESS) &&
700+
(txoutput->script_type != OutputScriptType_PAYTOMULTISIG) &&
701+
(txoutput->script_type != OutputScriptType_PAYTOWITNESS) &&
702+
(txoutput->script_type != OutputScriptType_PAYTOP2SHWITNESS)) {
703+
is_change = false;
704+
}
705+
699706
if (is_change) {
700707
if (change_spend == 0) { // not set
701708
change_spend = txoutput->amount;

0 commit comments

Comments
 (0)