multi: Complete upgrade to new sphinx package interface.

This commit is contained in:
Jim Posen 2018-03-26 10:10:47 -07:00
parent 5d0d7a8511
commit 56e65339e0
2 changed files with 5 additions and 14 deletions

View File

@ -82,15 +82,8 @@ func initTestExtracter() {
// newOnionProcessor creates starts a new htlcswitch.OnionProcessor using a temp // newOnionProcessor creates starts a new htlcswitch.OnionProcessor using a temp
// db and no garbage collection. // db and no garbage collection.
func newOnionProcessor(t *testing.T) *htlcswitch.OnionProcessor { func newOnionProcessor(t *testing.T) *htlcswitch.OnionProcessor {
sharedSecretFile, err := ioutil.TempFile("", "sphinxreplay.db")
if err != nil {
t.Fatalf("unable to create temp path: %v", err)
}
sharedSecretPath := sharedSecretFile.Name()
sphinxRouter := sphinx.NewRouter( sphinxRouter := sphinx.NewRouter(
sharedSecretPath, sphinxPrivKey, &bitcoinCfg.SimNetParams, nil, sphinxPrivKey, &bitcoinCfg.SimNetParams, sphinx.NewMemoryReplayLog(),
) )
if err := sphinxRouter.Start(); err != nil { if err := sphinxRouter.Start(); err != nil {

View File

@ -16,12 +16,14 @@ import (
"time" "time"
"github.com/coreos/bbolt" "github.com/coreos/bbolt"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lightning-onion" "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/autopilot" "github.com/lightningnetwork/lnd/autopilot"
"github.com/lightningnetwork/lnd/brontide" "github.com/lightningnetwork/lnd/brontide"
"github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/contractcourt" "github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/discovery" "github.com/lightningnetwork/lnd/discovery"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/lnwire"
@ -31,9 +33,6 @@ import (
"github.com/roasbeef/btcd/connmgr" "github.com/roasbeef/btcd/connmgr"
"github.com/roasbeef/btcd/wire" "github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil" "github.com/roasbeef/btcutil"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/htlcswitch"
) )
var ( var (
@ -159,9 +158,8 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
// the same directory as the channel graph database. // the same directory as the channel graph database.
graphDir := chanDB.Path() graphDir := chanDB.Path()
sharedSecretPath := filepath.Join(graphDir, "sphinxreplay.db") sharedSecretPath := filepath.Join(graphDir, "sphinxreplay.db")
sphinxRouter := sphinx.NewRouter( replayLog := htlcswitch.NewDecayedLog(sharedSecretPath, cc.chainNotifier)
sharedSecretPath, privKey, activeNetParams.Params, cc.chainNotifier, sphinxRouter := sphinx.NewRouter(privKey, activeNetParams.Params, replayLog)
)
s := &server{ s := &server{
chanDB: chanDB, chanDB: chanDB,