|
@ -215,6 +215,7 @@ class Peer(PrintError): |
|
|
self.localfeatures |= LnLocalFeatures.INITIAL_ROUTING_SYNC |
|
|
self.localfeatures |= LnLocalFeatures.INITIAL_ROUTING_SYNC |
|
|
self.localfeatures |= LnLocalFeatures.OPTION_DATA_LOSS_PROTECT_OPT |
|
|
self.localfeatures |= LnLocalFeatures.OPTION_DATA_LOSS_PROTECT_OPT |
|
|
self.attempted_route = {} |
|
|
self.attempted_route = {} |
|
|
|
|
|
self.orphan_channel_updates = OrderedDict() |
|
|
|
|
|
|
|
|
def send_message(self, message_name, **kwargs): |
|
|
def send_message(self, message_name, **kwargs): |
|
|
assert type(message_name) is str |
|
|
assert type(message_name) is str |
|
@ -308,16 +309,13 @@ class Peer(PrintError): |
|
|
try: |
|
|
try: |
|
|
self.channel_db.on_channel_update(payload) |
|
|
self.channel_db.on_channel_update(payload) |
|
|
except NotFoundChanAnnouncementForUpdate: |
|
|
except NotFoundChanAnnouncementForUpdate: |
|
|
# If it's for a direct channel with this peer, save it in chan. |
|
|
# If it's for a direct channel with this peer, save it for later, as it might be |
|
|
# Note that this is prone to a race.. we might not have a short_channel_id |
|
|
# for our own channel (and we might not yet know the short channel id for that) |
|
|
# associated with the channel in some cases |
|
|
|
|
|
short_channel_id = payload['short_channel_id'] |
|
|
short_channel_id = payload['short_channel_id'] |
|
|
self.print_error("not found channel announce for channel update in db", bh2u(short_channel_id)) |
|
|
self.print_error("not found channel announce for channel update in db", bh2u(short_channel_id)) |
|
|
for chan in self.channels.values(): |
|
|
self.orphan_channel_updates[short_channel_id] = payload |
|
|
if chan.short_channel_id_predicted == short_channel_id: |
|
|
while len(self.orphan_channel_updates) > 10: |
|
|
chan.pending_channel_update_message = payload |
|
|
self.orphan_channel_updates.popitem(last=False) |
|
|
self.print_error("channel update is for our own private channel", bh2u(short_channel_id)) |
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
def on_channel_announcement(self, payload): |
|
|
def on_channel_announcement(self, payload): |
|
|
self.channel_db.on_channel_announcement(payload) |
|
|
self.channel_db.on_channel_announcement(payload) |
|
@ -807,8 +805,9 @@ class Peer(PrintError): |
|
|
# see https://github.com/lightningnetwork/lnd/issues/1347 |
|
|
# see https://github.com/lightningnetwork/lnd/issues/1347 |
|
|
#self.send_message("query_short_channel_ids", chain_hash=constants.net.rev_genesis_bytes(), |
|
|
#self.send_message("query_short_channel_ids", chain_hash=constants.net.rev_genesis_bytes(), |
|
|
# len=9, encoded_short_ids=b'\x00'+chan.short_channel_id) |
|
|
# len=9, encoded_short_ids=b'\x00'+chan.short_channel_id) |
|
|
if hasattr(chan, 'pending_channel_update_message'): |
|
|
pending_channel_update = self.orphan_channel_updates.get(chan.short_channel_id) |
|
|
self.on_channel_update(chan.pending_channel_update_message) |
|
|
if pending_channel_update: |
|
|
|
|
|
self.channel_db.on_channel_update(pending_channel_update) |
|
|
|
|
|
|
|
|
self.print_error("CHANNEL OPENING COMPLETED") |
|
|
self.print_error("CHANNEL OPENING COMPLETED") |
|
|
|
|
|
|
|
|