From 2512fecf888e589119d324464a5f70c95bad4dc4 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 5 Jul 2016 18:48:35 -0700 Subject: [PATCH] lnd: populate lightning id within server --- server.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.go b/server.go index 22b6a140..66b7db08 100644 --- a/server.go +++ b/server.go @@ -7,6 +7,7 @@ import ( "sync" "sync/atomic" + "github.com/btcsuite/fastsha256" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/lndc" "github.com/lightningnetwork/lnd/lnwallet" @@ -29,6 +30,10 @@ type server struct { // connections. identityPriv *btcec.PrivateKey + // lightningID is the sha256 of the public key corresponding to our + // long-term identity private key. + lightningID [32]byte + listeners []net.Listener peers map[int32]*peer @@ -69,11 +74,13 @@ func newServer(listenAddrs []string, wallet *lnwallet.LightningWallet, } } + serializedPubKey := privKey.PubKey().SerializeCompressed() s := &server{ chanDB: chanDB, fundingMgr: newFundingManager(wallet), lnwallet: wallet, identityPriv: privKey, + lightningID: fastsha256.Sum256(serializedPubKey), listeners: listeners, peers: make(map[int32]*peer), chanIndex: make(map[wire.OutPoint]*peer),