Browse Source
fix logic error in lnworker.on_channel_closed
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight
5 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
8 additions and
6 deletions
-
electrum/lnwatcher.py
-
electrum/lnworker.py
|
|
@ -150,7 +150,9 @@ class LNWatcher(AddressSynchronizer): |
|
|
|
def get_channel_status(self, outpoint): |
|
|
|
return self.channel_status.get(outpoint, 'unknown') |
|
|
|
|
|
|
|
def add_channel(self, outpoint, address): |
|
|
|
def add_channel(self, outpoint: str, address: str) -> None: |
|
|
|
assert isinstance(outpoint, str) |
|
|
|
assert isinstance(address, str) |
|
|
|
self.add_address(address) |
|
|
|
self.channels[address] = outpoint |
|
|
|
|
|
|
|
|
|
@ -638,18 +638,18 @@ class LNWallet(LNWorker): |
|
|
|
# create and broadcast transaction |
|
|
|
for prevout, sweep_info in sweep_info_dict.items(): |
|
|
|
name = sweep_info.name |
|
|
|
spender = spenders.get(prevout) |
|
|
|
if spender is not None: |
|
|
|
spender_tx = await self.network.get_transaction(spender) |
|
|
|
spender_txid = spenders.get(prevout) |
|
|
|
if spender_txid is not None: |
|
|
|
spender_tx = await self.network.get_transaction(spender_txid) |
|
|
|
spender_tx = Transaction(spender_tx) |
|
|
|
e_htlc_tx = chan.sweep_htlc(closing_tx, spender_tx) |
|
|
|
if e_htlc_tx: |
|
|
|
spender2 = spenders.get(spender_tx.outputs()[0]) |
|
|
|
spender2 = spenders.get(spender_txid+':0') |
|
|
|
if spender2: |
|
|
|
self.logger.info(f'htlc is already spent {name}: {prevout}') |
|
|
|
else: |
|
|
|
self.logger.info(f'trying to redeem htlc {name}: {prevout}') |
|
|
|
await self.try_redeem(spender+':0', e_htlc_tx) |
|
|
|
await self.try_redeem(spender_txid+':0', e_htlc_tx) |
|
|
|
else: |
|
|
|
self.logger.info(f'outpoint already spent {name}: {prevout}') |
|
|
|
else: |
|
|
|