peer+server: rename discoverSrv to authGossiper
This commit is contained in:
parent
dd1d69b140
commit
c09713ebd1
3
peer.go
3
peer.go
@ -663,7 +663,7 @@ out:
|
|||||||
*lnwire.NodeAnnouncement,
|
*lnwire.NodeAnnouncement,
|
||||||
*lnwire.AnnounceSignatures:
|
*lnwire.AnnounceSignatures:
|
||||||
|
|
||||||
p.server.discoverSrv.ProcessRemoteAnnouncement(msg,
|
p.server.authGossiper.ProcessRemoteAnnouncement(msg,
|
||||||
p.addr.IdentityKey)
|
p.addr.IdentityKey)
|
||||||
default:
|
default:
|
||||||
peerLog.Errorf("unknown message received from peer "+
|
peerLog.Errorf("unknown message received from peer "+
|
||||||
@ -1374,6 +1374,7 @@ func calculateCompromiseFee(ourIdealFee, lastSentFee, peerFee uint64) uint64 {
|
|||||||
func (p *peer) handleClosingSigned(localReq *htlcswitch.ChanClose,
|
func (p *peer) handleClosingSigned(localReq *htlcswitch.ChanClose,
|
||||||
msg *lnwire.ClosingSigned, deliveryScripts *closingScripts,
|
msg *lnwire.ClosingSigned, deliveryScripts *closingScripts,
|
||||||
lastSig []byte, lastFee uint64) ([]byte, uint64) {
|
lastSig []byte, lastFee uint64) ([]byte, uint64) {
|
||||||
|
|
||||||
chanID := msg.ChannelID
|
chanID := msg.ChannelID
|
||||||
p.activeChanMtx.RLock()
|
p.activeChanMtx.RLock()
|
||||||
channel, ok := p.activeChannels[chanID]
|
channel, ok := p.activeChannels[chanID]
|
||||||
|
30
server.go
30
server.go
@ -70,7 +70,7 @@ type server struct {
|
|||||||
|
|
||||||
chanRouter *routing.ChannelRouter
|
chanRouter *routing.ChannelRouter
|
||||||
|
|
||||||
discoverSrv *discovery.AuthenticatedGossiper
|
authGossiper *discovery.AuthenticatedGossiper
|
||||||
|
|
||||||
utxoNursery *utxoNursery
|
utxoNursery *utxoNursery
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
UpdateTopology: func(msg *lnwire.ChannelUpdate) error {
|
UpdateTopology: func(msg *lnwire.ChannelUpdate) error {
|
||||||
s.discoverSrv.ProcessRemoteAnnouncement(msg, nil)
|
s.authGossiper.ProcessRemoteAnnouncement(msg, nil)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -205,7 +205,10 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
chanGraph := chanDB.ChannelGraph()
|
chanGraph := chanDB.ChannelGraph()
|
||||||
|
|
||||||
// TODO(roasbeef): make alias configurable
|
// TODO(roasbeef): make alias configurable
|
||||||
alias := lnwire.NewAlias(hex.EncodeToString(serializedPubKey[:10]))
|
alias, err := lnwire.NewNodeAlias(hex.EncodeToString(serializedPubKey[:10]))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
selfNode := &channeldb.LightningNode{
|
selfNode := &channeldb.LightningNode{
|
||||||
HaveNodeAnnouncement: true,
|
HaveNodeAnnouncement: true,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: time.Now(),
|
||||||
@ -267,15 +270,18 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
return nil, fmt.Errorf("can't create router: %v", err)
|
return nil, fmt.Errorf("can't create router: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.discoverSrv, err = discovery.New(discovery.Config{
|
s.authGossiper, err = discovery.New(discovery.Config{
|
||||||
Broadcast: s.BroadcastMessage,
|
|
||||||
Notifier: s.cc.chainNotifier,
|
|
||||||
Router: s.chanRouter,
|
Router: s.chanRouter,
|
||||||
|
Notifier: s.cc.chainNotifier,
|
||||||
|
Broadcast: s.BroadcastMessage,
|
||||||
SendToPeer: s.SendToPeer,
|
SendToPeer: s.SendToPeer,
|
||||||
TrickleDelay: time.Millisecond * 300,
|
|
||||||
ProofMatureDelta: 0,
|
ProofMatureDelta: 0,
|
||||||
|
TrickleDelay: time.Millisecond * 300,
|
||||||
DB: chanDB,
|
DB: chanDB,
|
||||||
})
|
AnnSigner: s.nodeSigner,
|
||||||
|
},
|
||||||
|
s.identityPriv.PubKey(),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -339,7 +345,7 @@ func (s *server) Start() error {
|
|||||||
if err := s.breachArbiter.Start(); err != nil {
|
if err := s.breachArbiter.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.discoverSrv.Start(); err != nil {
|
if err := s.authGossiper.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.chanRouter.Start(); err != nil {
|
if err := s.chanRouter.Start(); err != nil {
|
||||||
@ -376,7 +382,7 @@ func (s *server) Stop() error {
|
|||||||
s.htlcSwitch.Stop()
|
s.htlcSwitch.Stop()
|
||||||
s.utxoNursery.Stop()
|
s.utxoNursery.Stop()
|
||||||
s.breachArbiter.Stop()
|
s.breachArbiter.Stop()
|
||||||
s.discoverSrv.Stop()
|
s.authGossiper.Stop()
|
||||||
s.cc.wallet.Shutdown()
|
s.cc.wallet.Shutdown()
|
||||||
s.cc.chainView.Stop()
|
s.cc.chainView.Stop()
|
||||||
s.connMgr.Stop()
|
s.connMgr.Stop()
|
||||||
@ -484,7 +490,7 @@ func (s *server) establishPersistentConnections() error {
|
|||||||
err = sourceNode.ForEachChannel(nil, func(
|
err = sourceNode.ForEachChannel(nil, func(
|
||||||
_ *bolt.Tx,
|
_ *bolt.Tx,
|
||||||
_ *channeldb.ChannelEdgeInfo,
|
_ *channeldb.ChannelEdgeInfo,
|
||||||
policy *channeldb.ChannelEdgePolicy) error {
|
policy, _ *channeldb.ChannelEdgePolicy) error {
|
||||||
|
|
||||||
pubStr := string(policy.Node.PubKey.SerializeCompressed())
|
pubStr := string(policy.Node.PubKey.SerializeCompressed())
|
||||||
|
|
||||||
@ -1041,7 +1047,7 @@ func (s *server) addPeer(p *peer) {
|
|||||||
// Once the peer has been added to our indexes, send a message to the
|
// Once the peer has been added to our indexes, send a message to the
|
||||||
// channel router so we can synchronize our view of the channel graph
|
// channel router so we can synchronize our view of the channel graph
|
||||||
// with this new peer.
|
// with this new peer.
|
||||||
go s.discoverSrv.SynchronizeNode(p.addr.IdentityKey)
|
go s.authGossiper.SynchronizeNode(p.addr.IdentityKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// removePeer removes the passed peer from the server's state of all active
|
// removePeer removes the passed peer from the server's state of all active
|
||||||
|
Loading…
Reference in New Issue
Block a user