redeem htlcs:
- fix bug in lnsweep: lnwatcher transactions were indexed by prev_txid - add test for breach remedy with unsettled htlcs - add timeout option to lnpay, and replace DO_NOT_SETTLE with SETTLE_DELAY so that we can read intermediate commitment tx in regtest
This commit is contained in:
@@ -40,7 +40,7 @@ def create_sweeptxs_for_their_revoked_ctx(chan: 'Channel', ctx: Transaction, per
|
||||
per_commitment_secret)
|
||||
to_self_delay = other_conf.to_self_delay
|
||||
this_delayed_pubkey = derive_pubkey(this_conf.delayed_basepoint.pubkey, pcp)
|
||||
txs = {}
|
||||
txs = []
|
||||
# to_local
|
||||
revocation_pubkey = ecc.ECPrivkey(other_revocation_privkey).get_public_key_bytes(compressed=True)
|
||||
witness_script = bh2u(make_commitment_output_to_local_witness_script(
|
||||
@@ -55,7 +55,7 @@ def create_sweeptxs_for_their_revoked_ctx(chan: 'Channel', ctx: Transaction, per
|
||||
witness_script=witness_script,
|
||||
privkey=other_revocation_privkey,
|
||||
is_revocation=True)
|
||||
txs[ctx.txid()] = sweep_tx
|
||||
txs.append(sweep_tx)
|
||||
# HTLCs
|
||||
def create_sweeptx_for_htlc(htlc: 'UpdateAddHtlc', is_received_htlc: bool) -> Tuple[Optional[Transaction],
|
||||
Optional[Transaction],
|
||||
@@ -93,17 +93,17 @@ def create_sweeptxs_for_their_revoked_ctx(chan: 'Channel', ctx: Transaction, per
|
||||
for htlc in received_htlcs:
|
||||
direct_sweep_tx, secondstage_sweep_tx, htlc_tx = create_sweeptx_for_htlc(htlc, is_received_htlc=True)
|
||||
if direct_sweep_tx:
|
||||
txs[ctx.txid()] = direct_sweep_tx
|
||||
txs.append(direct_sweep_tx)
|
||||
if secondstage_sweep_tx:
|
||||
txs[htlc_tx.txid()] = secondstage_sweep_tx
|
||||
txs.append(secondstage_sweep_tx)
|
||||
# offered HTLCs, in their ctx
|
||||
offered_htlcs = chan.included_htlcs(REMOTE, SENT, ctn)
|
||||
for htlc in offered_htlcs:
|
||||
direct_sweep_tx, secondstage_sweep_tx, htlc_tx = create_sweeptx_for_htlc(htlc, is_received_htlc=False)
|
||||
if direct_sweep_tx:
|
||||
txs[ctx.txid()] = direct_sweep_tx
|
||||
txs.append(direct_sweep_tx)
|
||||
if secondstage_sweep_tx:
|
||||
txs[htlc_tx.txid()] = secondstage_sweep_tx
|
||||
txs.append(secondstage_sweep_tx)
|
||||
return txs
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user