|
@@ -147,7 +147,7 @@ class tool_cmd(tool_cmd_base):
|
|
def pubhex2redeem_script(self,pubkeyhex:'sstr'): # new
|
|
def pubhex2redeem_script(self,pubkeyhex:'sstr'): # new
|
|
"convert a hexadecimal pubkey to a Segwit P2SH-P2WPKH redeem script"
|
|
"convert a hexadecimal pubkey to a Segwit P2SH-P2WPKH redeem script"
|
|
assert self.mmtype.name == 'segwit','This command is meaningful only for --type=segwit'
|
|
assert self.mmtype.name == 'segwit','This command is meaningful only for --type=segwit'
|
|
- from ..proto.common import hash160
|
|
|
|
|
|
+ from ..proto.btc.common import hash160
|
|
return self.proto.pubhash2redeem_script( hash160(bytes.fromhex(pubkeyhex)) ).hex()
|
|
return self.proto.pubhash2redeem_script( hash160(bytes.fromhex(pubkeyhex)) ).hex()
|
|
|
|
|
|
def redeem_script2addr(self,redeem_script_hex:'sstr'): # new
|
|
def redeem_script2addr(self,redeem_script_hex:'sstr'): # new
|
|
@@ -155,7 +155,7 @@ class tool_cmd(tool_cmd_base):
|
|
assert self.mmtype.name == 'segwit', 'This command is meaningful only for --type=segwit'
|
|
assert self.mmtype.name == 'segwit', 'This command is meaningful only for --type=segwit'
|
|
assert redeem_script_hex[:4] == '0014', f'{redeem_script_hex!r}: invalid redeem script'
|
|
assert redeem_script_hex[:4] == '0014', f'{redeem_script_hex!r}: invalid redeem script'
|
|
assert len(redeem_script_hex) == 44, f'{len(redeem_script_hex)//2} bytes: invalid redeem script length'
|
|
assert len(redeem_script_hex) == 44, f'{len(redeem_script_hex)//2} bytes: invalid redeem script length'
|
|
- from ..proto.common import hash160
|
|
|
|
|
|
+ from ..proto.btc.common import hash160
|
|
return self.proto.pubhash2addr(
|
|
return self.proto.pubhash2addr(
|
|
hash160( bytes.fromhex(redeem_script_hex) ),
|
|
hash160( bytes.fromhex(redeem_script_hex) ),
|
|
p2sh = True )
|
|
p2sh = True )
|