Merge pull request #4667 from guggero/auto-compact

channeldb/kvdb/bolt: automatically compact database on startup
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2020-11-16 17:50:14 -08:00
commit e4f0f2aa69
21 files changed
+659 -94

No files matched your search

+6 -5
View File
@@ -10,7 +10,6 @@ import (
"math/big"
prand "math/rand"
"net"
"path/filepath"
"regexp"
"strconv"
"strings"
@@ -372,10 +371,10 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
// Initialize the sphinx router, placing it's persistent replay log in
// the same directory as the channel graph database. We don't need to
// replicate this data, so we'll store it locally.
sharedSecretPath := filepath.Join(
cfg.localDatabaseDir(), defaultSphinxDbName,
replayLog := htlcswitch.NewDecayedLog(
cfg.localDatabaseDir(), defaultSphinxDbName, cfg.DB.Bolt,
cc.ChainNotifier,
)
replayLog := htlcswitch.NewDecayedLog(sharedSecretPath, cc.ChainNotifier)
sphinxRouter := sphinx.NewRouter(
nodeKeyECDH, cfg.ActiveNetParams.Params, replayLog,
)
@@ -1303,7 +1302,9 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
diskCheck := healthcheck.NewObservation(
"disk space",
func() error {
free, err := healthcheck.AvailableDiskSpace(cfg.LndDir)
free, err := healthcheck.AvailableDiskSpaceRatio(
cfg.LndDir,
)
if err != nil {
return err
}