lnd/discovery
yyforyongyu 9fecfed3b5
discovery: fix race access to syncer's state
This commit fixes the following race,
1. syncer(state=syncingChans) sends QueryChannelRange
2. remote peer replies ReplyChannelRange
3. ProcessQueryMsg fails to process the remote peer's msg as its state
   is neither waitingQueryChanReply nor waitingQueryRangeReply.
4. syncer marks its new state waitingQueryChanReply, but too late.

The historical sync will now fail, and the syncer will be stuck at this
state. What's worse is it cannot forward channel announcements to other
connected peers now as it will skip the broadcasting during initial
graph sync.

This is now fixed to make sure the following two steps are atomic,
1. syncer(state=syncingChans) sends QueryChannelRange
2. syncer marks its new state waitingQueryChanReply.
2025-01-17 02:39:07 +08:00
..
ban.go discovery: add banman for channel announcements 2024-08-27 14:11:06 -04:00
ban_test.go discovery: add banman for channel announcements 2024-08-27 14:11:06 -04:00
bootstrapper.go multi: add SpewLogClosure to avoid code repetition 2024-07-25 22:18:49 +08:00
chan_series.go refactor: move graph related DB code to graph/db from channeldb 2024-11-28 13:36:13 +02:00
gossiper.go discovery: fix race access to syncer's state 2025-01-17 02:39:07 +08:00
gossiper_test.go chore: fix typo 2025-01-05 20:45:35 +08:00
log.go multi: start updating various loggers to use the new v2 type 2024-10-22 17:03:55 +02:00
message_store.go multi: rename ChannelUpdate to ChannelUpdate1 2024-09-18 16:13:17 +02:00
message_store_test.go multi: rename chan DB Open method to OpenForTesting 2024-11-28 13:51:15 +02:00
mock_test.go discovery: implement ChannelAnnouncement banning 2024-08-27 14:11:06 -04:00
reliable_sender.go discovery+peer: add logs to reveal shutdown flow 2022-12-08 17:57:01 +08:00
reliable_sender_test.go multi: extend lnpeer.Peer interface with Disconnect function 2024-08-27 14:11:06 -04:00
sync_manager.go multi: add debug logs for edge policy flow 2025-01-17 00:17:23 +08:00
sync_manager_test.go multi: start asking for update timestamps in QueryChannelRange 2023-12-11 09:12:04 +02:00
syncer.go discovery: fix race access to syncer's state 2025-01-17 02:39:07 +08:00
syncer_test.go refactor: move graph related DB code to graph/db from channeldb 2024-11-28 13:36:13 +02:00