Browse Source

bitcoin.py: SCRIPT-related clean-up. transaction.py: construct_witness

regtest_lnd
SomberNight 7 years ago
parent
commit
6c9060a42b
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 1
      electrum/bitcoin.py
  2. 6
      lib/lnbase.py

1
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:

6
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

Loading…
Cancel
Save