Browse Source

readability change: OP_n calculation from boolean arithmetic to ternary

seed_v14
SomberNight 7 years ago
parent
commit
a339270c07
  1. 2
      lib/bitcoin.py

2
lib/bitcoin.py

@ -338,7 +338,7 @@ def address_to_script(addr):
if is_segwit_address(addr):
witver, witprog = segwit_addr.decode(SEGWIT_HRP, addr)
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 += push_script(bytes(witprog).hex())
return script

Loading…
Cancel
Save