discovery: remove channel synchronization from ActiveSync GossipSyncers
In this commit, we remove the ability for ActiveSync GossipSyncers to synchronize our graph with our remote peers. This serves as a starting point towards allowing the daemon to only synchronize our graph through historical syncs, which will be routinely done by the SyncManager.
This commit is contained in:
parent
1c22474ad3
commit
9a6e8ecb9e
@ -18,16 +18,23 @@ import (
|
||||
type SyncerType uint8
|
||||
|
||||
const (
|
||||
// ActiveSync denotes that a gossip syncer should exercise its default
|
||||
// behavior. This includes reconciling the set of missing graph updates
|
||||
// with the remote peer _and_ receiving new updates from them.
|
||||
// ActiveSync denotes that a gossip syncer:
|
||||
//
|
||||
// 1. Should not attempt to synchronize with the remote peer for
|
||||
// missing channels.
|
||||
// 2. Should respond to queries from the remote peer.
|
||||
// 3. Should receive new updates from the remote peer.
|
||||
//
|
||||
// They are started in a chansSynced state in order to accomplish their
|
||||
// responsibilities above.
|
||||
ActiveSync SyncerType = iota
|
||||
|
||||
// PassiveSync denotes that a gossip syncer:
|
||||
//
|
||||
// 1. Should not attempt to query the remote peer for graph updates.
|
||||
// 2. Should respond to queries from the remote peer.
|
||||
// 3. Should not receive new updates from the remote peer.
|
||||
// 1. Should not attempt to synchronize with the remote peer for
|
||||
// missing channels.
|
||||
// 2. Should respond to queries from the remote peer.
|
||||
// 3. Should not receive new updates from the remote peer.
|
||||
//
|
||||
// They are started in a chansSynced state in order to accomplish their
|
||||
// responsibilities above.
|
||||
@ -1128,7 +1135,6 @@ func (g *GossipSyncer) handleSyncTransition(req *syncTransitionReq) error {
|
||||
var (
|
||||
firstTimestamp time.Time
|
||||
timestampRange uint32
|
||||
newState syncerState
|
||||
)
|
||||
|
||||
switch req.newSyncType {
|
||||
@ -1137,11 +1143,6 @@ func (g *GossipSyncer) handleSyncTransition(req *syncTransitionReq) error {
|
||||
case ActiveSync:
|
||||
firstTimestamp = time.Now()
|
||||
timestampRange = math.MaxUint32
|
||||
newState = syncingChans
|
||||
|
||||
// We'll set genHistoricalChanRangeQuery to false since in order
|
||||
// to not perform another historical sync if we previously have.
|
||||
g.genHistoricalChanRangeQuery = false
|
||||
|
||||
// If a PassiveSync transition has been requested, then we should no
|
||||
// longer receive any new updates from the remote peer. We can do this
|
||||
@ -1150,7 +1151,6 @@ func (g *GossipSyncer) handleSyncTransition(req *syncTransitionReq) error {
|
||||
case PassiveSync:
|
||||
firstTimestamp = zeroTimestamp
|
||||
timestampRange = 0
|
||||
newState = chansSynced
|
||||
|
||||
default:
|
||||
return fmt.Errorf("unhandled sync transition %v",
|
||||
@ -1162,7 +1162,6 @@ func (g *GossipSyncer) handleSyncTransition(req *syncTransitionReq) error {
|
||||
return fmt.Errorf("unable to send local update horizon: %v", err)
|
||||
}
|
||||
|
||||
g.setSyncState(newState)
|
||||
g.setSyncType(req.newSyncType)
|
||||
|
||||
return nil
|
||||
|
@ -2014,8 +2014,7 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
|
||||
syncState := g.syncState()
|
||||
if syncState != chansSynced {
|
||||
t.Fatalf("expected syncerState %v, "+
|
||||
"got %v", chansSynced,
|
||||
syncState)
|
||||
"got %v", chansSynced, syncState)
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -2037,21 +2036,10 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
|
||||
TimestampRange: math.MaxUint32,
|
||||
})
|
||||
|
||||
// The local update horizon should be followed
|
||||
// by a QueryChannelRange message sent to the
|
||||
// remote peer requesting all channels it
|
||||
// knows of from the highest height the syncer
|
||||
// knows of.
|
||||
assertMsgSent(t, msgChan, &lnwire.QueryChannelRange{
|
||||
FirstBlockHeight: startHeight,
|
||||
NumBlocks: math.MaxUint32 - startHeight,
|
||||
})
|
||||
|
||||
syncState := g.syncState()
|
||||
if syncState != waitingQueryRangeReply {
|
||||
if syncState != chansSynced {
|
||||
t.Fatalf("expected syncerState %v, "+
|
||||
"got %v", waitingQueryRangeReply,
|
||||
syncState)
|
||||
"got %v", chansSynced, syncState)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user