From ee74e4ba8628abfd989a85e8ecbb653c2b27b940 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 28 Apr 2020 10:06:28 +0200 Subject: [PATCH] server+mod: use ECDH interface for sphinx router --- go.mod | 2 +- go.sum | 4 ++-- htlcswitch/circuit_test.go | 4 +++- server.go | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index b3807147..c57f99a9 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/kkdai/bstream v0.0.0-20181106074824-b3251f7901ec github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200 github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d - github.com/lightningnetwork/lightning-onion v1.0.1 + github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea github.com/lightningnetwork/lnd/cert v1.0.2 github.com/lightningnetwork/lnd/queue v1.0.4 github.com/lightningnetwork/lnd/ticker v1.0.0 diff --git a/go.sum b/go.sum index ec887b75..8f07ff2d 100644 --- a/go.sum +++ b/go.sum @@ -159,8 +159,8 @@ github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200 h1:j4iZ1 github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200/go.mod h1:MlZmoKa7CJP3eR1s5yB7Rm5aSyadpKkxqAwLQmog7N0= github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d h1:QWD/5MPnaZfUVP7P8wLa4M8Td2DI7XXHXt2vhVtUgGI= github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d/go.mod h1:KDb67YMzoh4eudnzClmvs2FbiLG9vxISmLApUkCa4uI= -github.com/lightningnetwork/lightning-onion v1.0.1 h1:qChGgS5+aPxFeR6JiUsGvanei1bn6WJpYbvosw/1604= -github.com/lightningnetwork/lightning-onion v1.0.1/go.mod h1:rigfi6Af/KqsF7Za0hOgcyq2PNH4AN70AaMRxcJkff4= +github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea h1:oCj48NQ8u7Vz+MmzHqt0db6mxcFZo3Ho7M5gCJauY/k= +github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea/go.mod h1:rigfi6Af/KqsF7Za0hOgcyq2PNH4AN70AaMRxcJkff4= github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 h1:sjOGyegMIhvgfq5oaue6Td+hxZuf3tDC8lAPrFldqFw= github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796/go.mod h1:3p7ZTf9V1sNPI5H8P3NkTFF4LuwMdPl2DodF60qAKqY= github.com/ltcsuite/ltcutil v0.0.0-20181217130922-17f3b04680b6/go.mod h1:8Vg/LTOO0KYa/vlHWJ6XZAevPQThGH5sufO0Hrou/lA= diff --git a/htlcswitch/circuit_test.go b/htlcswitch/circuit_test.go index 1b5d59e8..00a4b6e7 100644 --- a/htlcswitch/circuit_test.go +++ b/htlcswitch/circuit_test.go @@ -13,6 +13,7 @@ import ( "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/htlcswitch" "github.com/lightningnetwork/lnd/htlcswitch/hop" + "github.com/lightningnetwork/lnd/keychain" "github.com/lightningnetwork/lnd/lnwire" ) @@ -84,7 +85,8 @@ func initTestExtracter() { // db and no garbage collection. func newOnionProcessor(t *testing.T) *hop.OnionProcessor { sphinxRouter := sphinx.NewRouter( - sphinxPrivKey, &bitcoinCfg.SimNetParams, sphinx.NewMemoryReplayLog(), + &keychain.PrivKeyECDH{PrivKey: sphinxPrivKey}, + &bitcoinCfg.SimNetParams, sphinx.NewMemoryReplayLog(), ) if err := sphinxRouter.Start(); err != nil { diff --git a/server.go b/server.go index a3a68ebc..b8b51fc8 100644 --- a/server.go +++ b/server.go @@ -332,6 +332,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, chanDB *channeldb.DB, var ( err error + nodeKeyECDH = keychain.NewPubKeyECDH(*nodeKeyDesc, cc.keyRing) nodeKeySigner = keychain.NewPubKeyDigestSigner( *nodeKeyDesc, cc.keyRing, ) @@ -379,7 +380,9 @@ func newServer(cfg *Config, listenAddrs []net.Addr, chanDB *channeldb.DB, graphDir := chanDB.Path() sharedSecretPath := filepath.Join(graphDir, "sphinxreplay.db") replayLog := htlcswitch.NewDecayedLog(sharedSecretPath, cc.chainNotifier) - sphinxRouter := sphinx.NewRouter(privKey, activeNetParams.Params, replayLog) + sphinxRouter := sphinx.NewRouter( + nodeKeyECDH, activeNetParams.Params, replayLog, + ) writeBufferPool := pool.NewWriteBuffer( pool.DefaultWriteBufferGCInterval,