|
|
|
@ -927,8 +927,12 @@ class TestMsgSigntx:
|
|
|
|
|
):
|
|
|
|
|
btc.sign_tx(client, "Bitcoin", [inp0], [out1], details, prev_txes=cache)
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
|
"script_type",
|
|
|
|
|
(proto.InputScriptType.SPENDADDRESS, proto.InputScriptType.EXTERNAL),
|
|
|
|
|
)
|
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
|
def test_incorrect_script_type(self, client):
|
|
|
|
|
def test_incorrect_input_script_type(self, client, script_type):
|
|
|
|
|
address_n = parse_path("44'/1'/0'/0/0")
|
|
|
|
|
attacker_multisig_public_key = bytes.fromhex(
|
|
|
|
|
"030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
|
|
|
@ -952,7 +956,7 @@ class TestMsgSigntx:
|
|
|
|
|
address_n=address_n,
|
|
|
|
|
prev_index=1,
|
|
|
|
|
sequence=0xFFFFFFFF,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDADDRESS,
|
|
|
|
|
script_type=script_type, # incorrect script type
|
|
|
|
|
multisig=multisig,
|
|
|
|
|
prev_hash=TXHASH_e5040e,
|
|
|
|
|
)
|
|
|
|
@ -974,3 +978,54 @@ class TestMsgSigntx:
|
|
|
|
|
btc.sign_tx(
|
|
|
|
|
client, "Testnet", [inp1], [out1, out2], prev_txes=TxCache("Testnet")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
|
"script_type",
|
|
|
|
|
(proto.OutputScriptType.PAYTOADDRESS, proto.OutputScriptType.PAYTOSCRIPTHASH),
|
|
|
|
|
)
|
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
|
def test_incorrect_output_script_type(self, client, script_type):
|
|
|
|
|
address_n = parse_path("44'/1'/0'/0/0")
|
|
|
|
|
attacker_multisig_public_key = bytes.fromhex(
|
|
|
|
|
"030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
multisig = proto.MultisigRedeemScriptType(
|
|
|
|
|
m=1,
|
|
|
|
|
nodes=[
|
|
|
|
|
btc.get_public_node(client, address_n).node,
|
|
|
|
|
proto.HDNodeType(
|
|
|
|
|
depth=0,
|
|
|
|
|
fingerprint=0,
|
|
|
|
|
child_num=0,
|
|
|
|
|
chain_code=bytes(32),
|
|
|
|
|
public_key=attacker_multisig_public_key,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
address_n=[],
|
|
|
|
|
)
|
|
|
|
|
inp1 = proto.TxInputType(
|
|
|
|
|
address_n=address_n,
|
|
|
|
|
prev_index=1,
|
|
|
|
|
sequence=0xFFFFFFFF,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDADDRESS,
|
|
|
|
|
prev_hash=TXHASH_e5040e,
|
|
|
|
|
)
|
|
|
|
|
out1 = proto.TxOutputType(
|
|
|
|
|
address_n=address_n,
|
|
|
|
|
amount=1000000 - 50000 - 10000,
|
|
|
|
|
script_type=script_type, # incorrect script type
|
|
|
|
|
multisig=multisig,
|
|
|
|
|
)
|
|
|
|
|
out2 = proto.TxOutputType(
|
|
|
|
|
address="mtkyndbpgv1G7nwggwKDVagRpxEJrwwyh6",
|
|
|
|
|
amount=50000,
|
|
|
|
|
script_type=proto.OutputScriptType.PAYTOADDRESS,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
with pytest.raises(
|
|
|
|
|
TrezorFailure, match="Multisig field provided but not expected."
|
|
|
|
|
):
|
|
|
|
|
btc.sign_tx(
|
|
|
|
|
client, "Testnet", [inp1], [out1, out2], prev_txes=TxCache("Testnet")
|
|
|
|
|
)
|
|
|
|
|