routing: prune nodes from the channel graph on start up

This commit is contained in:
Olaoluwa Osuntokun 2018-07-21 19:52:21 -07:00
parent 0645261e5e
commit f8cbe34e93
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -9,6 +9,9 @@ import (
"sync/atomic"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/coreos/bbolt"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/channeldb"
@ -17,9 +20,6 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/multimutex"
"github.com/lightningnetwork/lnd/routing/chainview"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"crypto/sha256"
@ -382,6 +382,13 @@ func (r *ChannelRouter) Start() error {
return err
}
// Finally, before we proceed, we'll prune any unconnected nodes from
// the graph in order to ensure we maintain a tight graph of "useful"
// nodes.
if err := r.cfg.Graph.PruneGraphNodes(); err != nil {
return err
}
r.wg.Add(1)
go r.networkHandler()