routing: only update the filter if we have a non-zero chain view

In this commit we ensure that we only update the filter, if we have a
non-zero chain view. Otherwise, a mini rescan may be kicked off
unnecessarily  if we don’t yet know of any channels yet in the greater
graph.
This commit is contained in:
Olaoluwa Osuntokun 2017-11-15 18:17:43 -08:00
parent 7408aa6c8d
commit 2b052cc889
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -295,10 +295,12 @@ func (r *ChannelRouter) Start() error {
} }
log.Infof("Filtering chain using %v channels active", len(channelView)) log.Infof("Filtering chain using %v channels active", len(channelView))
if len(channelView) != 0 {
err = r.cfg.ChainView.UpdateFilter(channelView, pruneHeight) err = r.cfg.ChainView.UpdateFilter(channelView, pruneHeight)
if err != nil { if err != nil {
return err return err
} }
}
// Before we begin normal operation of the router, we first need to // Before we begin normal operation of the router, we first need to
// synchronize the channel graph to the latest state of the UTXO set. // synchronize the channel graph to the latest state of the UTXO set.