@@ -475,6 +475,28 @@ func (g *GossipSyncer) Stop() {
475
475
})
476
476
}
477
477
478
+ // handleSyncingChans handles the state syncingChans for the GossipSyncer. When
479
+ // in this state, we will send a QueryChannelRange msg to our peer and advance
480
+ // the syncer's state to waitingQueryRangeReply.
481
+ func (g * GossipSyncer ) handleSyncingChans () {
482
+ // Prepare the query msg.
483
+ queryRangeMsg , err := g .genChanRangeQuery (g .genHistoricalChanRangeQuery )
484
+ if err != nil {
485
+ log .Errorf ("Unable to gen chan range query: %v" , err )
486
+ return
487
+ }
488
+
489
+ err = g .cfg .sendToPeer (queryRangeMsg )
490
+ if err != nil {
491
+ log .Errorf ("Unable to send chan range query: %v" , err )
492
+ return
493
+ }
494
+
495
+ // With the message sent successfully, we'll transition into the next
496
+ // state where we wait for their reply.
497
+ g .setSyncState (waitingQueryRangeReply )
498
+ }
499
+
478
500
// channelGraphSyncer is the main goroutine responsible for ensuring that we
479
501
// properly channel graph state with the remote peer, and also that we only
480
502
// send them messages which actually pass their defined update horizon.
@@ -495,27 +517,7 @@ func (g *GossipSyncer) channelGraphSyncer() {
495
517
// understand, as we'll as responding to any other queries by
496
518
// them.
497
519
case syncingChans :
498
- // If we're in this state, then we'll send the remote
499
- // peer our opening QueryChannelRange message.
500
- queryRangeMsg , err := g .genChanRangeQuery (
501
- g .genHistoricalChanRangeQuery ,
502
- )
503
- if err != nil {
504
- log .Errorf ("Unable to gen chan range " +
505
- "query: %v" , err )
506
- return
507
- }
508
-
509
- err = g .cfg .sendToPeer (queryRangeMsg )
510
- if err != nil {
511
- log .Errorf ("Unable to send chan range " +
512
- "query: %v" , err )
513
- return
514
- }
515
-
516
- // With the message sent successfully, we'll transition
517
- // into the next state where we wait for their reply.
518
- g .setSyncState (waitingQueryRangeReply )
520
+ g .handleSyncingChans ()
519
521
520
522
// In this state, we've sent out our initial channel range
521
523
// query and are waiting for the final response from the remote
0 commit comments