mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
do not accet testnet addresses in bitcoin.is_address
This commit is contained in:
parent
604d5d432c
commit
cf5328b143
1 changed files with 4 additions and 1 deletions
|
@ -352,11 +352,14 @@ def is_valid(addr):
|
||||||
|
|
||||||
def is_address(addr):
|
def is_address(addr):
|
||||||
ADDRESS_RE = re.compile('[1-9A-HJ-NP-Za-km-z]{26,}\\Z')
|
ADDRESS_RE = re.compile('[1-9A-HJ-NP-Za-km-z]{26,}\\Z')
|
||||||
if not ADDRESS_RE.match(addr): return False
|
if not ADDRESS_RE.match(addr):
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
addrtype, h = bc_address_to_hash_160(addr)
|
addrtype, h = bc_address_to_hash_160(addr)
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
if addrtype != 0:
|
||||||
|
return False
|
||||||
return addr == hash_160_to_bc_address(h, addrtype)
|
return addr == hash_160_to_bc_address(h, addrtype)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue