mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
lnsweep: return ctx.txid instead of None
This commit is contained in:
parent
56853da391
commit
1b7a3c25d1
2 changed files with 4 additions and 8 deletions
|
@ -464,8 +464,6 @@ class Channel(PrintError):
|
|||
else:
|
||||
encumbered_sweeptxs = create_sweeptxs_for_their_latest_ctx(self, ctx, self.sweep_address)
|
||||
for prev_txid, encumbered_tx in encumbered_sweeptxs:
|
||||
if prev_txid is None:
|
||||
prev_txid = ctx.txid()
|
||||
if encumbered_tx is not None:
|
||||
self.lnwatcher.add_sweep_tx(outpoint, prev_txid, encumbered_tx.to_json())
|
||||
|
||||
|
@ -476,8 +474,6 @@ class Channel(PrintError):
|
|||
ctx = self.remote_commitment_to_be_revoked # FIXME can't we just reconstruct it?
|
||||
encumbered_sweeptxs = create_sweeptxs_for_their_just_revoked_ctx(self, ctx, per_commitment_secret, self.sweep_address)
|
||||
for prev_txid, encumbered_tx in encumbered_sweeptxs:
|
||||
if prev_txid is None:
|
||||
prev_txid = ctx.txid()
|
||||
if encumbered_tx is not None:
|
||||
self.lnwatcher.add_sweep_tx(outpoint, prev_txid, encumbered_tx.to_json())
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ def create_sweeptxs_for_their_just_revoked_ctx(chan: 'Channel', ctx: Transaction
|
|||
delayed_pubkey=this_delayed_pubkey,
|
||||
sweep_address=sweep_address)
|
||||
if sweep_tx:
|
||||
txs.append((None, EncumberedTransaction('their_ctx_to_local', sweep_tx, csv_delay=0, cltv_expiry=0)))
|
||||
txs.append((ctx.txid(), EncumberedTransaction('their_ctx_to_local', sweep_tx, csv_delay=0, cltv_expiry=0)))
|
||||
# HTLCs
|
||||
def create_sweeptx_for_htlc(htlc: 'UpdateAddHtlc', is_received_htlc: bool) -> Tuple[Optional[Transaction],
|
||||
Optional[Transaction],
|
||||
|
@ -151,7 +151,7 @@ def create_sweeptxs_for_our_latest_ctx(chan: 'Channel', ctx: Transaction,
|
|||
remote_revocation_pubkey=other_revocation_pubkey,
|
||||
to_self_delay=to_self_delay)
|
||||
if sweep_tx:
|
||||
txs.append((None, EncumberedTransaction('our_ctx_to_local', sweep_tx, csv_delay=to_self_delay, cltv_expiry=0)))
|
||||
txs.append((ctx.txid(), EncumberedTransaction('our_ctx_to_local', sweep_tx, csv_delay=to_self_delay, cltv_expiry=0)))
|
||||
# HTLCs
|
||||
def create_txns_for_htlc(htlc: 'UpdateAddHtlc', is_received_htlc: bool) -> Tuple[Optional[Transaction], Optional[Transaction]]:
|
||||
if is_received_htlc:
|
||||
|
@ -244,13 +244,13 @@ def create_sweeptxs_for_their_latest_ctx(chan: 'Channel', ctx: Transaction,
|
|||
delayed_pubkey=this_delayed_pubkey,
|
||||
sweep_address=sweep_address)
|
||||
if sweep_tx:
|
||||
txs.append((None, EncumberedTransaction('their_ctx_to_local', sweep_tx, csv_delay=0, cltv_expiry=0)))
|
||||
txs.append((ctx.txid(), EncumberedTransaction('their_ctx_to_local', sweep_tx, csv_delay=0, cltv_expiry=0)))
|
||||
# to_remote
|
||||
sweep_tx = maybe_create_sweeptx_for_their_ctx_to_remote(ctx=ctx,
|
||||
sweep_address=sweep_address,
|
||||
our_payment_privkey=other_payment_privkey)
|
||||
if sweep_tx:
|
||||
txs.append((None, EncumberedTransaction('their_ctx_to_remote', sweep_tx, csv_delay=0, cltv_expiry=0)))
|
||||
txs.append((ctx.txid(), EncumberedTransaction('their_ctx_to_remote', sweep_tx, csv_delay=0, cltv_expiry=0)))
|
||||
# HTLCs
|
||||
# from their ctx, we can only redeem HTLCs if the ctx was not revoked,
|
||||
# as old HTLCs are not stored. (if it was revoked, then we should have presigned txns
|
||||
|
|
Loading…
Add table
Reference in a new issue