1
0

move is_valid from wallet class to bitcoin.py

This commit is contained in:
thomasv
2013-03-01 14:27:56 +01:00
parent f3cc234c87
commit f72c8ee5d2
9 changed files with 49 additions and 32 deletions

View File

@@ -259,6 +259,16 @@ def address_from_private_key(sec):
return address
def is_valid(addr):
ADDRESS_RE = re.compile('[1-9A-HJ-NP-Za-km-z]{26,}\\Z')
if not ADDRESS_RE.match(addr): return False
try:
addrtype, h = bc_address_to_hash_160(addr)
except:
return False
return addr == hash_160_to_bc_address(h, addrtype)
########### end pywallet functions #######################
# secp256k1, http://www.oid-info.com/get/1.3.132.0.10