electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit b3da13420bb0c3aa08c42ebb6a997481cb285018
parent 75e7b3af49dcbd2b14726e2e6c4f4adb94bc81b3
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:
Melectrum/bitcoin.py | 1+
Mlib/lnbase.py | 6+++---
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/electrum/bitcoin.py b/electrum/bitcoin.py @@ -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: diff --git a/lib/lnbase.py b/lib/lnbase.py @@ -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 @@ -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