示例#1
0
    def _check_sign_msg(self, msg):
        addr_path = "m/44h/1h/0h/0/0"
        sign_res = self.do_command(self.dev_args + ['signmessage', msg, addr_path])
        self.assertNotIn("error", sign_res)
        self.assertNotIn("code", sign_res)
        self.assertIn("signature", sign_res)
        sig = sign_res["signature"]

        addr = self.do_command(self.dev_args + ['displayaddress', "--addr-type", "legacy", '--path', addr_path])["address"]
        addr = to_address(decode(addr)[1:-4], b"\x6F")

        self.assertTrue(self.rpc.verifymessage(addr, sig, msg))
示例#2
0
    def test_decoding(self):
        """Test base58 decoding"""

        for pair in TEST_VECTORS:
            decoded: bytes = base58.decode(pair[1])
            self.assertEqual(decoded, unhexlify(pair[0]))