URI: 
       tlnsweep: return ctx.txid instead of None - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1b7a3c25d1fe8ecd880ced6b98b38420c6b542b3
   DIR parent 56853da391e26e7bdabf8d8e35f9d5e2a35aae65
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Wed, 12 Dec 2018 14:13:39 +0100
       
       lnsweep: return ctx.txid instead of None
       
       Diffstat:
         M electrum/lnchan.py                  |       4 ----
         M electrum/lnsweep.py                 |       8 ++++----
       
       2 files changed, 4 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/electrum/lnchan.py b/electrum/lnchan.py
       t@@ -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())
        
       t@@ -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())
        
   DIR diff --git a/electrum/lnsweep.py b/electrum/lnsweep.py
       t@@ -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],
       t@@ -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:
       t@@ -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