forked from LBRYCommunity/lbry-sdk
ledger.is_valid_address added
This commit is contained in:
parent
9281bdb61b
commit
ca4a07f766
3 changed files with 8 additions and 1 deletions
|
@ -153,6 +153,11 @@ class BaseLedger(metaclass=LedgerRegistry):
|
|||
def address_to_hash160(address):
|
||||
return Base58.decode(address)[1:21]
|
||||
|
||||
@classmethod
|
||||
def is_valid_address(cls, address):
|
||||
decoded = Base58.decode(address)
|
||||
return decoded[0] == cls.pubkey_address_prefix
|
||||
|
||||
@classmethod
|
||||
def public_key_to_address(cls, public_key):
|
||||
return cls.hash160_to_address(hash160(public_key))
|
||||
|
|
|
@ -64,7 +64,7 @@ def push_data(data):
|
|||
else:
|
||||
yield BCDataStream.uint8.pack(OP_PUSHDATA4)
|
||||
yield BCDataStream.uint32.pack(size)
|
||||
yield data
|
||||
yield bytes(data)
|
||||
|
||||
|
||||
def read_data(token, stream):
|
||||
|
|
|
@ -61,6 +61,8 @@ class AsyncioTestCase(unittest.TestCase):
|
|||
# Implementation inspired by discussion:
|
||||
# https://bugs.python.org/issue32972
|
||||
|
||||
maxDiff = None
|
||||
|
||||
async def asyncSetUp(self): # pylint: disable=C0103
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue