1
0

bitcoin.py: base58 address: make sure all public methods test checksum

Note: the checksum was already being checked in practically all cases, by the caller.
Moved the check here, to the lower level (but still public) method for sanity.
This commit is contained in:
SomberNight
2019-12-08 06:56:19 +01:00
parent 8cf3587aeb
commit 5f6f7da2a1
2 changed files with 15 additions and 2 deletions

View File

@@ -711,6 +711,16 @@ class Test_keyImport(ElectrumTestCase):
self.assertFalse(is_address("not an address"))
def test_is_address_bad_checksums(self):
self.assertTrue(is_address('1819s5TxxbBtuRPr3qYskMVC8sb1pqapWx'))
self.assertFalse(is_address('1819s5TxxbBtuRPr3qYskMVC8sb1pqapWw'))
self.assertTrue(is_address('3LrjLVnngqnaJeo3BQwMBg34iqYsjZjQUe'))
self.assertFalse(is_address('3LrjLVnngqnaJeo3BQwMBg34iqYsjZjQUd'))
self.assertTrue(is_address('bc1qxq64lrwt02hm7tu25lr3hm9tgzh58snfe67yt6'))
self.assertFalse(is_address('bc1qxq64lrwt02hm7tu25lr3hm9tgzh58snfe67yt5'))
@needs_test_with_all_ecc_implementations
def test_is_private_key(self):
for priv_details in self.priv_pub_addr: