gossip: broadcast channel updates along with channel announcements
The channel update in mark_open is only sent once, and only to the channel peer. In addition, it seems to be discarded by Eclair.
This commit is contained in:
@@ -578,6 +578,7 @@ class Peer(Logger, EventListener):
|
|||||||
for chan in public_channels:
|
for chan in public_channels:
|
||||||
if chan.is_open() and chan.peer_state == PeerState.GOOD:
|
if chan.is_open() and chan.peer_state == PeerState.GOOD:
|
||||||
self.maybe_send_channel_announcement(chan)
|
self.maybe_send_channel_announcement(chan)
|
||||||
|
self.maybe_send_channel_update(chan)
|
||||||
await asyncio.sleep(600)
|
await asyncio.sleep(600)
|
||||||
|
|
||||||
def _should_forward_gossip(self) -> bool:
|
def _should_forward_gossip(self) -> bool:
|
||||||
@@ -1782,6 +1783,10 @@ class Peer(Logger, EventListener):
|
|||||||
raw_msg = encode_msg(message_type, **payload)
|
raw_msg = encode_msg(message_type, **payload)
|
||||||
self.transport.send_bytes(raw_msg)
|
self.transport.send_bytes(raw_msg)
|
||||||
|
|
||||||
|
def maybe_send_channel_update(self, chan: Channel):
|
||||||
|
chan_upd = chan.get_outgoing_gossip_channel_update()
|
||||||
|
self.transport.send_bytes(chan_upd)
|
||||||
|
|
||||||
def maybe_mark_open(self, chan: Channel):
|
def maybe_mark_open(self, chan: Channel):
|
||||||
if not chan.sent_channel_ready:
|
if not chan.sent_channel_ready:
|
||||||
return
|
return
|
||||||
@@ -1806,13 +1811,12 @@ class Peer(Logger, EventListener):
|
|||||||
if pending_channel_update:
|
if pending_channel_update:
|
||||||
chan.set_remote_update(pending_channel_update)
|
chan.set_remote_update(pending_channel_update)
|
||||||
self.logger.info(f"CHANNEL OPENING COMPLETED ({chan.get_id_for_log()})")
|
self.logger.info(f"CHANNEL OPENING COMPLETED ({chan.get_id_for_log()})")
|
||||||
forwarding_enabled = self.network.config.EXPERIMENTAL_LN_FORWARD_PAYMENTS
|
if chan.is_public():
|
||||||
if forwarding_enabled and chan.short_channel_id:
|
|
||||||
# send channel_update of outgoing edge to peer,
|
# send channel_update of outgoing edge to peer,
|
||||||
# so that channel can be used to receive payments
|
# so that channel can be used to receive payments
|
||||||
self.logger.info(f"sending channel update for outgoing edge ({chan.get_id_for_log()})")
|
# Note: this is only useful for our unit tests. peers may discard
|
||||||
chan_upd = chan.get_outgoing_gossip_channel_update()
|
# channel updates if the channel has not been announced
|
||||||
self.transport.send_bytes(chan_upd)
|
self.maybe_send_channel_update(chan)
|
||||||
|
|
||||||
def maybe_send_announcement_signatures(self, chan: Channel, is_reply=False):
|
def maybe_send_announcement_signatures(self, chan: Channel, is_reply=False):
|
||||||
if not chan.is_public():
|
if not chan.is_public():
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ def create_channel_state(
|
|||||||
"remote_config": remote_config,
|
"remote_config": remote_config,
|
||||||
"local_config": local_config,
|
"local_config": local_config,
|
||||||
"constraints":lnpeer.ChannelConstraints(
|
"constraints":lnpeer.ChannelConstraints(
|
||||||
flags=0,
|
flags=lnchannel.CF_ANNOUNCE_CHANNEL,
|
||||||
capacity=funding_sat,
|
capacity=funding_sat,
|
||||||
is_initiator=is_initiator,
|
is_initiator=is_initiator,
|
||||||
funding_txn_minimum_depth=3,
|
funding_txn_minimum_depth=3,
|
||||||
|
|||||||
Reference in New Issue
Block a user