have both script_to_address and script_to_pubkey functions
This commit is contained in:
parent
74d9c2edba
commit
11054020dd
24
lib/util.py
24
lib/util.py
@ -211,15 +211,15 @@ def ser_number(n):
|
|||||||
s.append(n)
|
s.append(n)
|
||||||
return bytes(s)
|
return bytes(s)
|
||||||
|
|
||||||
if settings.COINDAEMON_Reward == 'POW':
|
#if settings.COINDAEMON_Reward == 'POW':
|
||||||
def script_to_address(addr):
|
def script_to_address(addr):
|
||||||
d = address_to_pubkeyhash(addr)
|
d = address_to_pubkeyhash(addr)
|
||||||
if not d:
|
if not d:
|
||||||
raise ValueError('invalid address')
|
raise ValueError('invalid address')
|
||||||
(ver, pubkeyhash) = d
|
(ver, pubkeyhash) = d
|
||||||
return b'\x76\xa9\x14' + pubkeyhash + b'\x88\xac'
|
return b'\x76\xa9\x14' + pubkeyhash + b'\x88\xac'
|
||||||
else:
|
#else:
|
||||||
def script_to_pubkey(key):
|
def script_to_pubkey(key):
|
||||||
if len(key) == 66: key = binascii.unhexlify(key)
|
if len(key) == 66: key = binascii.unhexlify(key)
|
||||||
if len(key) != 33: raise Exception('Invalid Address')
|
if len(key) != 33: raise Exception('Invalid Address')
|
||||||
return b'\x21' + key + b'\xac'
|
return b'\x21' + key + b'\xac'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user