From a339270c0751a8119a44ffea8d59d39012e2e6d6 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sat, 16 Sep 2017 03:43:08 +0200 Subject: [PATCH] readability change: OP_n calculation from boolean arithmetic to ternary --- lib/bitcoin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bitcoin.py b/lib/bitcoin.py index 1c299b92..3673dc17 100644 --- a/lib/bitcoin.py +++ b/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