lnd: add timing information to db open log

This commit is contained in:
Olaoluwa Osuntokun 2020-02-03 16:18:06 -08:00
parent 19bdbe7f8d
commit 698f1175f8
No known key found for this signature in database
GPG Key ID: BC13F65E2DC84465

8
lnd.go
View File

@ -222,9 +222,12 @@ func Main(lisCfg ListenerCfg) error {
defaultGraphSubDirname,
normalizeNetwork(activeNetParams.Name))
ltndLog.Infof("Opening the main database, this might take a few " +
"minutes...")
// Open the channeldb, which is dedicated to storing channel, and
// network related metadata.
ltndLog.Infof("Opening the channeldb, might take a few minutes")
startOpenTime := time.Now()
chanDB, err := channeldb.Open(
graphDir,
channeldb.OptionSetRejectCacheSize(cfg.Caches.RejectCacheSize),
@ -238,6 +241,9 @@ func Main(lisCfg ListenerCfg) error {
}
defer chanDB.Close()
openTime := time.Now().Sub(startOpenTime)
ltndLog.Infof("Database now open (time_to_open=%v)!", openTime)
// Only process macaroons if --no-macaroons isn't set.
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)