commit 5e7117ddddb2b39a6c835b5e90e6f9225f728e64
parent 5753cf9e050f9297f10afa87215b2906f9f0753f
Author: Janus <ysangkok@gmail.com>
Date: Wed, 26 Sep 2018 19:15:59 +0200
ln: commit fee updates as soon as possible
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/electrum/lnbase.py b/electrum/lnbase.py
@@ -1040,7 +1040,7 @@ class Peer(PrintError):
channel_id = payload["channel_id"]
self.channels[channel_id].receive_update_fee(int.from_bytes(payload["feerate_per_kw"], "big"))
- def on_bitcoin_fee_update(self, chan):
+ async def bitcoin_fee_update(self, chan):
"""
called when our fee estimates change
"""
@@ -1062,6 +1062,11 @@ class Peer(PrintError):
return
self.send_message(gen_msg("update_fee", channel_id=chan.channel_id, feerate_per_kw=feerate_per_kw))
+ sig_64, htlc_sigs = chan.sign_next_commitment()
+ self.send_message(gen_msg("commitment_signed", channel_id=chan.channel_id, signature=sig_64, num_htlcs=len(htlc_sigs), htlc_signature=b"".join(htlc_sigs)))
+ await self.receive_revoke(chan)
+ await self.receive_commitment(chan)
+ self.revoke(chan)
self.lnworker.save_channel(chan)
def current_feerate_per_kw(self):
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
@@ -150,7 +150,7 @@ class LNWorker(PrintError):
self.print_error("peer not found for {}".format(bh2u(chan.node_id)))
return
if event == 'fee':
- peer.on_bitcoin_fee_update(chan)
+ await peer.bitcoin_fee_update(chan)
conf = self.wallet.get_tx_height(chan.funding_outpoint.txid).conf
peer.on_network_update(chan, conf)