mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-15 12:08:59 +00:00
tests/device: two output changes yield error
this test should fail on T1 after e716f7e84ecdb4732ad97b56e78d7407ec0b321e
This commit is contained in:
parent
cb47dbd284
commit
bc036bc857
@ -733,3 +733,54 @@ class TestMsgSigntx(TrezorTest):
|
||||
|
||||
# Accepted by network: tx
|
||||
assert hexlify(serialized_tx) == b'010000000136825bfdb78c8ede226c7c4f25a018e99a2c061d63c7fb425fca7c7d6721dad6000000006a473044022047845c366eb24f40be315c7815a154513c444c7989eb80f7ce7ff6aeb703d26a022007c1f5efadf67c5889634fd7ac39a7ce78bffac291673e8772ecd8389c901d9f01210338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6ffffffff01c6100795000000001976a9143d2496e67f5f57a924353da42d4725b318e7a8ea88ac00000000'
|
||||
|
||||
def test_two_changes(self):
|
||||
self.setup_mnemonic_allallall()
|
||||
# see 87be0736f202f7c2bff0781b42bad3e0cdcb54761939da69ea793a3735552c56
|
||||
|
||||
# tx: e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd
|
||||
# input 0: 0.31 BTC
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=self.client.expand_path("44'/1'/0'/0/0"),
|
||||
# amount=31000000,
|
||||
prev_hash=TXHASH_e5040e,
|
||||
prev_index=0,
|
||||
)
|
||||
|
||||
out1 = proto.TxOutputType(
|
||||
address='msj42CCGruhRsFrGATiUuh25dtxYtnpbTx',
|
||||
amount=30090000,
|
||||
script_type=proto.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
out_change1 = proto.TxOutputType(
|
||||
address_n=self.client.expand_path("44'/1'/0'/1/0"),
|
||||
amount=900000,
|
||||
script_type=proto.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
out_change2 = proto.TxOutputType(
|
||||
address_n=self.client.expand_path("44'/1'/0'/1/1"),
|
||||
amount=10000,
|
||||
script_type=proto.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
with self.client:
|
||||
self.client.set_tx_api(TxApiTestnet)
|
||||
self.client.set_expected_responses([
|
||||
proto.TxRequest(request_type=proto.RequestType.TXINPUT, details=proto.TxRequestDetailsType(request_index=0)),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXMETA, details=proto.TxRequestDetailsType(tx_hash=TXHASH_e5040e)),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXINPUT, details=proto.TxRequestDetailsType(request_index=0, tx_hash=TXHASH_e5040e)),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=0, tx_hash=TXHASH_e5040e)),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=1, tx_hash=TXHASH_e5040e)),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=0)),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=1)),
|
||||
proto.TxRequest(request_type=proto.RequestType.TXOUTPUT, details=proto.TxRequestDetailsType(request_index=2)),
|
||||
|
||||
# error should occur
|
||||
proto.Failure(code=proto.FailureType.ProcessError, message='Only one change output is valid'),
|
||||
])
|
||||
|
||||
with pytest.raises(CallException):
|
||||
self.client.sign_tx('Testnet', [inp1, ], [out1, out_change1, out_change2])
|
||||
|
Loading…
Reference in New Issue
Block a user