server: ensure the replay database is stored under the graph+network namespace

In this commit we modify the storage location of the sphinx replay
database to be under the precise network, and not only the graph sub
directory. Before this commit, due to the usage of filepath.Dir(), the
db would lie under /graph/, rather than say, /graph/simnet.
This commit is contained in:
Olaoluwa Osuntokun 2018-03-10 13:02:19 -08:00
parent bfa76bad49
commit 2a6876bde2
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -141,8 +141,9 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
listeners := make([]net.Listener, len(listenAddrs))
for i, addr := range listenAddrs {
// Note: though brontide.NewListener uses ResolveTCPAddr, it doesn't need to call the
// general lndResolveTCP function since we are resolving a local address.
// Note: though brontide.NewListener uses ResolveTCPAddr, it
// doesn't need to call the general lndResolveTCP function
// since we are resolving a local address.
listeners[i], err = brontide.NewListener(privKey, addr)
if err != nil {
return nil, err
@ -155,7 +156,7 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
// Initialize the sphinx router, placing it's persistent replay log in
// the same directory as the channel graph database.
graphDir := filepath.Dir(chanDB.Path())
graphDir := chanDB.Path()
sharedSecretPath := filepath.Join(graphDir, "sphinxreplay.db")
sphinxRouter := sphinx.NewRouter(
sharedSecretPath, privKey, activeNetParams.Params, cc.chainNotifier,