tbitcoin.py: SCRIPT-related clean-up. transaction.py: construct_witness - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit b3da13420bb0c3aa08c42ebb6a997481cb285018 DIR parent 75e7b3af49dcbd2b14726e2e6c4f4adb94bc81b3 HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 27 Apr 2018 15:38:44 +0200 bitcoin.py: SCRIPT-related clean-up. transaction.py: construct_witness Diffstat: M electrum/bitcoin.py | 1 + M lib/lnbase.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) --- DIR diff --git a/electrum/bitcoin.py b/electrum/bitcoin.py t@@ -234,6 +234,7 @@ def script_num_to_hex(i: int) -> str: return bh2u(result) + def var_int(i: int) -> str: # https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer if i<0xfd: DIR diff --git a/lib/lnbase.py b/lib/lnbase.py t@@ -24,8 +24,8 @@ import cryptography.hazmat.primitives.ciphers.aead as AEAD from .bitcoin import (public_key_from_private_key, ser_to_point, point_to_ser, string_to_number, deserialize_privkey, EC_KEY, rev_hex, int_to_hex, - push_script, script_num_to_hex, add_data_to_script, - add_number_to_script, var_int, witness_push) + push_script, script_num_to_hex, + add_number_to_script, var_int) from . import bitcoin from . import constants from . import transaction t@@ -374,7 +374,7 @@ def make_htlc_tx_witness(remotehtlcsig, localhtlcsig, payment_preimage, witness_ assert type(localhtlcsig) is bytes assert type(payment_preimage) is bytes assert type(witness_script) is bytes - return bfh(var_int(5) + '00' + ''.join([witness_push(bh2u(x)) for x in [remotehtlcsig, localhtlcsig, payment_preimage, witness_script]])) + return bfh(transaction.construct_witness([0, remotehtlcsig, localhtlcsig, payment_preimage, witness_script])) def make_htlc_tx_inputs(htlc_output_txid, htlc_output_index, revocationpubkey, local_delayedpubkey, amount_msat, witness_script): assert type(htlc_output_txid) is str