From 4bc315d061962106de1d35459f71196ba9d0bc75 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 11 Aug 2016 11:55:56 -0700 Subject: [PATCH] lnd: minor clean up with comments + go fmt after latest PR merge --- fundingmanager.go | 6 +++--- peer.go | 15 +++++++-------- server.go | 5 ----- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/fundingmanager.go b/fundingmanager.go index 2fe6a9a4..762ae560 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -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 diff --git a/peer.go b/peer.go index 80d64133..6bc4ef5f 100644 --- a/peer.go +++ b/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 { diff --git a/server.go b/server.go index a049c4a7..a051c712 100644 --- a/server.go +++ b/server.go @@ -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),