diff --git a/lbry/wallet/ledger.py b/lbry/wallet/ledger.py index fb1dd78b4..fc8decf57 100644 --- a/lbry/wallet/ledger.py +++ b/lbry/wallet/ledger.py @@ -185,7 +185,10 @@ class Ledger(metaclass=LedgerRegistry): @classmethod def is_valid_address(cls, 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 def public_key_to_address(cls, public_key): diff --git a/tests/unit/wallet/test_ledger.py b/tests/unit/wallet/test_ledger.py index 276c5fa15..67f78f0aa 100644 --- a/tests/unit/wallet/test_ledger.py +++ b/tests/unit/wallet/test_ledger.py @@ -1,4 +1,5 @@ import os +from unittest import TestCase from binascii import hexlify 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 +class TestUtils(TestCase): + + def test_valid_address(self): + self.assertTrue(Ledger.is_valid_address("rCz6yb1p33oYHToGZDzTjX7nFKaU3kNgBd")) + + class TestSynchronization(LedgerTestCase): async def test_update_history(self):