lnsweep: rm code dupe: 2nd stage htlc tx out vs ctx to_local addr reuse
This commit is contained in:
@@ -509,19 +509,11 @@ def derive_blinded_privkey(basepoint_secret: bytes, per_commitment_secret: bytes
|
||||
def make_htlc_tx_output(amount_msat, local_feerate, revocationpubkey, local_delayedpubkey, success, to_self_delay):
|
||||
assert type(amount_msat) is int
|
||||
assert type(local_feerate) is int
|
||||
assert type(revocationpubkey) is bytes
|
||||
assert type(local_delayedpubkey) is bytes
|
||||
script = bfh(construct_script([
|
||||
opcodes.OP_IF,
|
||||
revocationpubkey,
|
||||
opcodes.OP_ELSE,
|
||||
to_self_delay,
|
||||
opcodes.OP_CHECKSEQUENCEVERIFY,
|
||||
opcodes.OP_DROP,
|
||||
local_delayedpubkey,
|
||||
opcodes.OP_ENDIF,
|
||||
opcodes.OP_CHECKSIG,
|
||||
]))
|
||||
script = make_commitment_output_to_local_witness_script(
|
||||
revocation_pubkey=revocationpubkey,
|
||||
to_self_delay=to_self_delay,
|
||||
delayed_pubkey=local_delayedpubkey,
|
||||
)
|
||||
|
||||
p2wsh = bitcoin.redeem_script_to_address('p2wsh', bh2u(script))
|
||||
weight = HTLC_SUCCESS_WEIGHT if success else HTLC_TIMEOUT_WEIGHT
|
||||
@@ -896,7 +888,11 @@ def make_commitment(
|
||||
return tx
|
||||
|
||||
def make_commitment_output_to_local_witness_script(
|
||||
revocation_pubkey: bytes, to_self_delay: int, delayed_pubkey: bytes) -> bytes:
|
||||
revocation_pubkey: bytes, to_self_delay: int, delayed_pubkey: bytes,
|
||||
) -> bytes:
|
||||
assert type(revocation_pubkey) is bytes
|
||||
assert type(to_self_delay) is int
|
||||
assert type(delayed_pubkey) is bytes
|
||||
script = bfh(construct_script([
|
||||
opcodes.OP_IF,
|
||||
revocation_pubkey,
|
||||
|
||||
Reference in New Issue
Block a user