lnd+watchtower: rename NodePrivKey to NodeKeyECDH

This commit is contained in:
Oliver Gugger 2020-04-28 10:06:23 +02:00
parent 7f1b865b53
commit 140731af00
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
5 changed files with 12 additions and 12 deletions

2
lnd.go

@ -570,7 +570,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
lnwallet.WitnessPubKey, false, lnwallet.WitnessPubKey, false,
) )
}, },
NodePrivKey: towerPrivKey, NodeKeyECDH: towerPrivKey,
PublishTx: activeChainControl.wallet.PublishTransaction, PublishTx: activeChainControl.wallet.PublishTransaction,
ChainHash: *activeNetParams.GenesisHash, ChainHash: *activeNetParams.GenesisHash,
} }

@ -63,9 +63,9 @@ type Config struct {
// successfully sent funds can be received. // successfully sent funds can be received.
NewAddress func() (btcutil.Address, error) NewAddress func() (btcutil.Address, error)
// NodePrivKey is private key to be used in accepting new brontide // NodeKeyECDH is the ECDH capable wrapper of the key to be used in
// connections. // accepting new brontide connections.
NodePrivKey *btcec.PrivateKey NodeKeyECDH *btcec.PrivateKey
// PublishTx provides the ability to send a signed transaction to the // PublishTx provides the ability to send a signed transaction to the
// network. // network.

@ -72,7 +72,7 @@ func New(cfg *Config) (*Standalone, error) {
listeners := make([]net.Listener, 0, len(cfg.ListenAddrs)) listeners := make([]net.Listener, 0, len(cfg.ListenAddrs))
for _, listenAddr := range cfg.ListenAddrs { for _, listenAddr := range cfg.ListenAddrs {
listener, err := brontide.NewListener( listener, err := brontide.NewListener(
cfg.NodePrivKey, listenAddr.String(), cfg.NodeKeyECDH, listenAddr.String(),
) )
if err != nil { if err != nil {
return nil, err return nil, err
@ -85,7 +85,7 @@ func New(cfg *Config) (*Standalone, error) {
server, err := wtserver.New(&wtserver.Config{ server, err := wtserver.New(&wtserver.Config{
ChainHash: cfg.ChainHash, ChainHash: cfg.ChainHash,
DB: cfg.DB, DB: cfg.DB,
NodePrivKey: cfg.NodePrivKey, NodeKeyECDH: cfg.NodeKeyECDH,
Listeners: listeners, Listeners: listeners,
ReadTimeout: cfg.ReadTimeout, ReadTimeout: cfg.ReadTimeout,
WriteTimeout: cfg.WriteTimeout, WriteTimeout: cfg.WriteTimeout,
@ -190,7 +190,7 @@ func (w *Standalone) createNewHiddenService() error {
// //
// NOTE: Part of the watchtowerrpc.WatchtowerBackend interface. // NOTE: Part of the watchtowerrpc.WatchtowerBackend interface.
func (w *Standalone) PubKey() *btcec.PublicKey { func (w *Standalone) PubKey() *btcec.PublicKey {
return w.cfg.NodePrivKey.PubKey() return w.cfg.NodeKeyECDH.PubKey()
} }
// ListeningAddrs returns the listening addresses where the watchtower server // ListeningAddrs returns the listening addresses where the watchtower server

@ -416,7 +416,7 @@ func newHarness(t *testing.T, cfg harnessCfg) *testHarness {
DB: serverDB, DB: serverDB,
ReadTimeout: timeout, ReadTimeout: timeout,
WriteTimeout: timeout, WriteTimeout: timeout,
NodePrivKey: privKey, NodeKeyECDH: privKey,
NewAddress: func() (btcutil.Address, error) { NewAddress: func() (btcutil.Address, error) {
return addr, nil return addr, nil
}, },
@ -519,7 +519,7 @@ func (h *testHarness) startClient() {
h.t.Fatalf("Unable to resolve tower TCP addr: %v", err) h.t.Fatalf("Unable to resolve tower TCP addr: %v", err)
} }
towerAddr := &lnwire.NetAddress{ towerAddr := &lnwire.NetAddress{
IdentityKey: h.serverCfg.NodePrivKey.PubKey(), IdentityKey: h.serverCfg.NodeKeyECDH.PubKey(),
Address: towerTCPAddr, Address: towerTCPAddr,
} }

@ -33,9 +33,9 @@ type Config struct {
// storing state updates. // storing state updates.
DB DB DB DB
// NodePrivKey is private key to be used in accepting new brontide // NodeKeyECDH is the the ECDH capable wrapper of the key to be used in
// connections. // accepting new brontide connections.
NodePrivKey *btcec.PrivateKey NodeKeyECDH *btcec.PrivateKey
// Listeners specifies which address to which clients may connect. // Listeners specifies which address to which clients may connect.
Listeners []net.Listener Listeners []net.Listener