Synchronize watchtower asynchronously:
- remove remote_commitment_to_be_revoked - pass old ctns to lnsweep.create_sweeptxs_for_watchtower - store the ctn of sweeptxs in sweepStore database - request the highest ctn from sweepstore using get_ctn - send sweeptxs asynchronously in LNWallet.sync_with_watchtower
This commit is contained in:
@@ -41,7 +41,6 @@ from .lnutil import (Outpoint, LocalConfig, RECEIVED, UpdateAddHtlc,
|
||||
MINIMUM_MAX_HTLC_VALUE_IN_FLIGHT_ACCEPTED, MAXIMUM_HTLC_MINIMUM_MSAT_ACCEPTED,
|
||||
MAXIMUM_REMOTE_TO_SELF_DELAY_ACCEPTED, RemoteMisbehaving, DEFAULT_TO_SELF_DELAY)
|
||||
from .lnutil import FeeUpdate
|
||||
from .lnsweep import create_sweeptxs_for_watchtower
|
||||
from .lntransport import LNTransport, LNTransportBase
|
||||
from .lnmsg import encode_msg, decode_msg
|
||||
from .interface import GracefulDisconnect
|
||||
@@ -545,7 +544,6 @@ class Peer(Logger):
|
||||
"remote_config": remote_config,
|
||||
"local_config": local_config,
|
||||
"constraints": ChannelConstraints(capacity=funding_sat, is_initiator=True, funding_txn_minimum_depth=funding_txn_minimum_depth),
|
||||
"remote_commitment_to_be_revoked": None,
|
||||
}
|
||||
chan = Channel(chan_dict,
|
||||
sweep_address=self.lnworker.sweep_address,
|
||||
@@ -633,7 +631,6 @@ class Peer(Logger):
|
||||
),
|
||||
"local_config": local_config,
|
||||
"constraints": ChannelConstraints(capacity=funding_sat, is_initiator=False, funding_txn_minimum_depth=min_depth),
|
||||
"remote_commitment_to_be_revoked": None,
|
||||
}
|
||||
chan = Channel(chan_dict,
|
||||
sweep_address=self.lnworker.sweep_address,
|
||||
@@ -1261,22 +1258,12 @@ class Peer(Logger):
|
||||
self.logger.info("on_revoke_and_ack")
|
||||
channel_id = payload["channel_id"]
|
||||
chan = self.channels[channel_id]
|
||||
ctx = chan.remote_commitment_to_be_revoked # FIXME can't we just reconstruct it?
|
||||
rev = RevokeAndAck(payload["per_commitment_secret"], payload["next_per_commitment_point"])
|
||||
chan.receive_revocation(rev)
|
||||
self._remote_changed_events[chan.channel_id].set()
|
||||
self._remote_changed_events[chan.channel_id].clear()
|
||||
self.lnworker.save_channel(chan)
|
||||
self.maybe_send_commitment(chan)
|
||||
asyncio.ensure_future(self._on_revoke_and_ack(chan, ctx, rev.per_commitment_secret))
|
||||
|
||||
@ignore_exceptions
|
||||
@log_exceptions
|
||||
async def _on_revoke_and_ack(self, chan, ctx, per_commitment_secret):
|
||||
outpoint = chan.funding_outpoint.to_str()
|
||||
sweeptxs = create_sweeptxs_for_watchtower(chan, ctx, per_commitment_secret, chan.sweep_address)
|
||||
for tx in sweeptxs:
|
||||
await self.lnworker.lnwatcher.add_sweep_tx(outpoint, tx.prevout(0), str(tx))
|
||||
|
||||
def on_update_fee(self, payload):
|
||||
channel_id = payload["channel_id"]
|
||||
|
||||
Reference in New Issue
Block a user