def test_address_from_pk_hash(self): self.assertEquals( key.address_from_pk_hash( '\xe9\x9f\xaa\x1b\x12\x8f\x13w\x8d"#\xa9\xd1\xd3~\x88\x92\x0b]B' ), '\x00\xe9\x9f\xaa\x1b\x12\x8f\x13w\x8d"#\xa9\xd1\xd3~\x88\x92\x0b]B\xe6\xf2\xf5Y' )
def test_pks(self): script = '\x42' * 5 pks = protocol.PubKeyScript(script) self.assertEquals(pks.bytes, script) self.assertEquals(repr(pks), binascii.hexlify(script)) self.assertFalse(pks.is_standard_transaction) addr = '\x42' * 20 script = '\x76\xa9\x14' + addr + '\x88\xac' pks = protocol.PubKeyScript(script) self.assertEquals(pks.bytes, script) self.assertEquals( repr(pks), 'To Addr: ' + byte_util.base58_encode(key.address_from_pk_hash(addr))) self.assertTrue(pks.is_standard_transaction) self.assertEquals(pks, pks)
def test_base58_decode_address(self): self.assertEquals( byte_util.base58_decode('1NJHiNy5CS2heskf6bx3VuHm9zjXTGdtSt'), key.address_from_pk_hash( '\xe9\x9f\xaa\x1b\x12\x8f\x13w\x8d"#\xa9\xd1\xd3~\x88\x92\x0b]B' ))
def to_address(self): if self.is_standard_transaction: return byte_util.base58_encode( key.address_from_pk_hash(self.bytes[3:-2])) else: return None
def test_address_from_pk_hash(self): self.assertEquals( key.address_from_pk_hash( '\xe9\x9f\xaa\x1b\x12\x8f\x13w\x8d"#\xa9\xd1\xd3~\x88\x92\x0b]B'), '\x00\xe9\x9f\xaa\x1b\x12\x8f\x13w\x8d"#\xa9\xd1\xd3~\x88\x92\x0b]B\xe6\xf2\xf5Y')
def test_base58_decode_address(self): self.assertEquals( byte_util.base58_decode('1NJHiNy5CS2heskf6bx3VuHm9zjXTGdtSt'), key.address_from_pk_hash( '\xe9\x9f\xaa\x1b\x12\x8f\x13w\x8d"#\xa9\xd1\xd3~\x88\x92\x0b]B'))