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)
|
||||
return bytes(s)
|
||||
|
||||
if settings.COINDAEMON_Reward == 'POW':
|
||||
def script_to_address(addr):
|
||||
d = address_to_pubkeyhash(addr)
|
||||
if not d:
|
||||
raise ValueError('invalid address')
|
||||
(ver, pubkeyhash) = d
|
||||
return b'\x76\xa9\x14' + pubkeyhash + b'\x88\xac'
|
||||
else:
|
||||
def script_to_pubkey(key):
|
||||
if len(key) == 66: key = binascii.unhexlify(key)
|
||||
if len(key) != 33: raise Exception('Invalid Address')
|
||||
return b'\x21' + key + b'\xac'
|
||||
#if settings.COINDAEMON_Reward == 'POW':
|
||||
def script_to_address(addr):
|
||||
d = address_to_pubkeyhash(addr)
|
||||
if not d:
|
||||
raise ValueError('invalid address')
|
||||
(ver, pubkeyhash) = d
|
||||
return b'\x76\xa9\x14' + pubkeyhash + b'\x88\xac'
|
||||
#else:
|
||||
def script_to_pubkey(key):
|
||||
if len(key) == 66: key = binascii.unhexlify(key)
|
||||
if len(key) != 33: raise Exception('Invalid Address')
|
||||
return b'\x21' + key + b'\xac'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user