forked from LBRYCommunity/lbry-sdk
allows script addresses (beginning with r) to be used
This commit is contained in:
parent
935adfb51a
commit
550ef9a1c4
2 changed files with 11 additions and 1 deletions
|
@ -185,7 +185,10 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_valid_address(cls, address):
|
def is_valid_address(cls, address):
|
||||||
decoded = Base58.decode_check(address)
|
decoded = Base58.decode_check(address)
|
||||||
return decoded[0] == cls.pubkey_address_prefix[0]
|
return (
|
||||||
|
decoded[0] == cls.pubkey_address_prefix[0] or
|
||||||
|
decoded[0] == cls.script_address_prefix[0]
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def public_key_to_address(cls, public_key):
|
def public_key_to_address(cls, public_key):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
from unittest import TestCase
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
|
||||||
from lbry.testcase import AsyncioTestCase
|
from lbry.testcase import AsyncioTestCase
|
||||||
|
@ -85,6 +86,12 @@ class LedgerTestCase(AsyncioTestCase):
|
||||||
self.ledger.headers._size = self.ledger.headers.io.seek(0, os.SEEK_END) // self.ledger.headers.header_size
|
self.ledger.headers._size = self.ledger.headers.io.seek(0, os.SEEK_END) // self.ledger.headers.header_size
|
||||||
|
|
||||||
|
|
||||||
|
class TestUtils(TestCase):
|
||||||
|
|
||||||
|
def test_valid_address(self):
|
||||||
|
self.assertTrue(Ledger.is_valid_address("rCz6yb1p33oYHToGZDzTjX7nFKaU3kNgBd"))
|
||||||
|
|
||||||
|
|
||||||
class TestSynchronization(LedgerTestCase):
|
class TestSynchronization(LedgerTestCase):
|
||||||
|
|
||||||
async def test_update_history(self):
|
async def test_update_history(self):
|
||||||
|
|
Loading…
Reference in a new issue