lnd: minor clean up with comments + go fmt after latest PR merge

This commit is contained in:
Olaoluwa Osuntokun 2016-08-11 11:55:56 -07:00
parent c0d59a2d85
commit 4bc315d061
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
3 changed files with 10 additions and 16 deletions

@ -617,14 +617,14 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
fndgLog.Infof("FundingOpen: ChannelPoint(%v) with peerID(%v) is now open",
resCtx.reservation.FundingOutpoint, fmsg.peer.id)
// ROUTING ADDED
capacity := float64(resCtx.reservation.OurContribution().FundingAmount + resCtx.reservation.TheirContribution().FundingAmount)
capacity := float64(resCtx.reservation.OurContribution().FundingAmount +
resCtx.reservation.TheirContribution().FundingAmount)
fmsg.peer.server.routingMgr.AddChannel(
graph.NewID(fmsg.peer.server.lightningID),
graph.NewID([32]byte(fmsg.peer.lightningID)),
graph.NewEdgeID(resCtx.reservation.FundingOutpoint().String()),
&rt.ChannelInfo{
Cpt:capacity,
Cpt: capacity,
},
)
fmsg.peer.newChannels <- openChan

15
peer.go

@ -17,7 +17,6 @@ import (
"github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcd/txscript"
"github.com/roasbeef/btcd/wire"
)
var (
@ -378,15 +377,15 @@ out:
case *lnwire.CommitSignature:
isChanUpate = true
targetChan = msg.ChannelPoint
// ROUTING ADDED
case *lnwire.NeighborAckMessage,
*lnwire.NeighborHelloMessage,
*lnwire.NeighborRstMessage,
*lnwire.NeighborUpdMessage,
*lnwire.RoutingTableRequestMessage,
*lnwire.RoutingTableTransferMessage:
p.server.routingMgr.ChIn <- msg
*lnwire.NeighborHelloMessage,
*lnwire.NeighborRstMessage,
*lnwire.NeighborUpdMessage,
*lnwire.RoutingTableRequestMessage,
*lnwire.RoutingTableTransferMessage:
// TODO(mkl): determine sender and receiver of message
p.server.routingMgr.ChIn <- msg
}
if isChanUpate {

@ -52,7 +52,6 @@ type server struct {
htlcSwitch *htlcSwitch
invoices *invoiceRegistry
// ROUTING ADDED
routingMgr *routing.RoutingManager
newPeers chan *peer
@ -148,12 +147,9 @@ func (s *server) Stop() error {
}
}
// Shutdown the wallet, funding manager, and the rpc server.
s.rpcServer.Stop()
s.lnwallet.Shutdown()
s.fundingMgr.Stop()
// ROUTING ADDED
s.routingMgr.Stop()
// Signal all the lingering goroutines to quit.
@ -406,7 +402,6 @@ func (s *server) handleOpenChanReq(req *openChanReq) {
// TODO(roasbeef): server semaphore to restrict num goroutines
fundingID, err := s.fundingMgr.initFundingWorkflow(targetPeer, req)
if err == nil {
// ROUTING ADDED
capacity := float64(req.localFundingAmt + req.remoteFundingAmt)
s.routingMgr.AddChannel(
graph.NewID(s.lightningID),