1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

test_msg_getaddress_show test now supports multisig

This commit is contained in:
Pavol Rusnak 2014-12-10 18:03:54 +01:00
parent 58f5644402
commit c0d0b191d6
2 changed files with 22 additions and 2 deletions

View File

@ -1,6 +1,8 @@
import unittest
import common
import trezorlib.ckd_public as bip32
import trezorlib.types_pb2 as proto_types
import binascii
class TestMsgGetaddress(common.TrezorTest):
@ -10,5 +12,20 @@ class TestMsgGetaddress(common.TrezorTest):
self.assertEqual(self.client.get_address('Bitcoin', [2], show_display=True), '15AeAhtNJNKyowK8qPHwgpXkhsokzLtUpG')
self.assertEqual(self.client.get_address('Bitcoin', [3], show_display=True), '1CmzyJp9w3NafXMSEFH4SLYUPAVCSUrrJ5')
def test_show_multisig(self):
self.setup_mnemonic_nopin_nopassphrase()
multisig = proto_types.MultisigRedeemScriptType(
pubkeys=[binascii.unhexlify('0338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6'),
binascii.unhexlify('038caebd6f753bbbd2bb1f3346a43cd32140648583673a31d62f2dfb56ad0ab9e3'),
binascii.unhexlify('03477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902')],
signatures=['', '', ''],
m=2,
)
self.assertEqual(self.client.get_address('Bitcoin', [1], show_display=True, multisig=multisig), '3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz')
self.assertEqual(self.client.get_address('Bitcoin', [2], show_display=True, multisig=multisig), '3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz')
self.assertEqual(self.client.get_address('Bitcoin', [3], show_display=True, multisig=multisig), '3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz')
if __name__ == '__main__':
unittest.main()

View File

@ -388,9 +388,12 @@ class ProtocolMixin(object):
@field('address')
@expect(proto.Address)
def get_address(self, coin_name, n, show_display=False):
def get_address(self, coin_name, n, show_display=False, multisig=None):
n = self._convert_prime(n)
return self.call(proto.GetAddress(address_n=n, coin_name=coin_name, show_display=show_display))
if multisig:
return self.call(proto.GetAddress(address_n=n, coin_name=coin_name, show_display=show_display, multisig=multisig))
else:
return self.call(proto.GetAddress(address_n=n, coin_name=coin_name, show_display=show_display))
@field('entropy')
@expect(proto.Entropy)