added check for extended public key (HDWallet)
This commit is contained in:
parent
19b7df7582
commit
083fac3e51
@ -104,11 +104,14 @@ def private_to_public_key(private_key, compressed=True, hex=False):
|
|||||||
def is_valid_public_key(key):
|
def is_valid_public_key(key):
|
||||||
if len(key) < 33:
|
if len(key) < 33:
|
||||||
return False
|
return False
|
||||||
if key[0] == 0x04 and len(key) != 65:
|
elif key[0] == 0x04 and len(key) != 65:
|
||||||
return False
|
return False
|
||||||
elif key[0] == 0x02 or key[0] == 0x03:
|
elif key[0] == 0x02 or key[0] == 0x03:
|
||||||
if len(key) != 33:
|
if len(key) != 33:
|
||||||
return False
|
return False
|
||||||
|
elif isinstance(key, str):
|
||||||
|
if not key[:4] in ['xpub', 'tpub']:
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user