lnd: populate lightning id within server

This commit is contained in:
Olaoluwa Osuntokun committed 2016-07-05 18:49:08 -07:00
1 parent 94c242073a
commit 2512fecf88
1 file changed
+7
+7
View File
@@ -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),