readability change: OP_n calculation from boolean arithmetic to ternary
This commit is contained in:
parent
653c7acb48
commit
a339270c07
|
@ -338,7 +338,7 @@ def address_to_script(addr):
|
||||||
if is_segwit_address(addr):
|
if is_segwit_address(addr):
|
||||||
witver, witprog = segwit_addr.decode(SEGWIT_HRP, addr)
|
witver, witprog = segwit_addr.decode(SEGWIT_HRP, addr)
|
||||||
assert (0 <= witver <= 16)
|
assert (0 <= witver <= 16)
|
||||||
OP_n = (witver+0x50) * (witver > 0)
|
OP_n = witver + 0x50 if witver > 0 else 0
|
||||||
script = bytes([OP_n]).hex()
|
script = bytes([OP_n]).hex()
|
||||||
script += push_script(bytes(witprog).hex())
|
script += push_script(bytes(witprog).hex())
|
||||||
return script
|
return script
|
||||||
|
|
Loading…
Reference in New Issue