lnd: minor clean up with comments + go fmt after latest PR merge
This commit is contained in:
parent
c0d59a2d85
commit
4bc315d061
@ -617,14 +617,14 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
|
|||||||
fndgLog.Infof("FundingOpen: ChannelPoint(%v) with peerID(%v) is now open",
|
fndgLog.Infof("FundingOpen: ChannelPoint(%v) with peerID(%v) is now open",
|
||||||
resCtx.reservation.FundingOutpoint, fmsg.peer.id)
|
resCtx.reservation.FundingOutpoint, fmsg.peer.id)
|
||||||
|
|
||||||
// ROUTING ADDED
|
capacity := float64(resCtx.reservation.OurContribution().FundingAmount +
|
||||||
capacity := float64(resCtx.reservation.OurContribution().FundingAmount + resCtx.reservation.TheirContribution().FundingAmount)
|
resCtx.reservation.TheirContribution().FundingAmount)
|
||||||
fmsg.peer.server.routingMgr.AddChannel(
|
fmsg.peer.server.routingMgr.AddChannel(
|
||||||
graph.NewID(fmsg.peer.server.lightningID),
|
graph.NewID(fmsg.peer.server.lightningID),
|
||||||
graph.NewID([32]byte(fmsg.peer.lightningID)),
|
graph.NewID([32]byte(fmsg.peer.lightningID)),
|
||||||
graph.NewEdgeID(resCtx.reservation.FundingOutpoint().String()),
|
graph.NewEdgeID(resCtx.reservation.FundingOutpoint().String()),
|
||||||
&rt.ChannelInfo{
|
&rt.ChannelInfo{
|
||||||
Cpt:capacity,
|
Cpt: capacity,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
fmsg.peer.newChannels <- openChan
|
fmsg.peer.newChannels <- openChan
|
||||||
|
15
peer.go
15
peer.go
@ -17,7 +17,6 @@ import (
|
|||||||
"github.com/roasbeef/btcd/btcec"
|
"github.com/roasbeef/btcd/btcec"
|
||||||
"github.com/roasbeef/btcd/txscript"
|
"github.com/roasbeef/btcd/txscript"
|
||||||
"github.com/roasbeef/btcd/wire"
|
"github.com/roasbeef/btcd/wire"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -378,15 +377,15 @@ out:
|
|||||||
case *lnwire.CommitSignature:
|
case *lnwire.CommitSignature:
|
||||||
isChanUpate = true
|
isChanUpate = true
|
||||||
targetChan = msg.ChannelPoint
|
targetChan = msg.ChannelPoint
|
||||||
// ROUTING ADDED
|
|
||||||
case *lnwire.NeighborAckMessage,
|
case *lnwire.NeighborAckMessage,
|
||||||
*lnwire.NeighborHelloMessage,
|
*lnwire.NeighborHelloMessage,
|
||||||
*lnwire.NeighborRstMessage,
|
*lnwire.NeighborRstMessage,
|
||||||
*lnwire.NeighborUpdMessage,
|
*lnwire.NeighborUpdMessage,
|
||||||
*lnwire.RoutingTableRequestMessage,
|
*lnwire.RoutingTableRequestMessage,
|
||||||
*lnwire.RoutingTableTransferMessage:
|
*lnwire.RoutingTableTransferMessage:
|
||||||
p.server.routingMgr.ChIn <- msg
|
|
||||||
// TODO(mkl): determine sender and receiver of message
|
// TODO(mkl): determine sender and receiver of message
|
||||||
|
p.server.routingMgr.ChIn <- msg
|
||||||
}
|
}
|
||||||
|
|
||||||
if isChanUpate {
|
if isChanUpate {
|
||||||
|
@ -52,7 +52,6 @@ type server struct {
|
|||||||
htlcSwitch *htlcSwitch
|
htlcSwitch *htlcSwitch
|
||||||
invoices *invoiceRegistry
|
invoices *invoiceRegistry
|
||||||
|
|
||||||
// ROUTING ADDED
|
|
||||||
routingMgr *routing.RoutingManager
|
routingMgr *routing.RoutingManager
|
||||||
|
|
||||||
newPeers chan *peer
|
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.rpcServer.Stop()
|
||||||
s.lnwallet.Shutdown()
|
s.lnwallet.Shutdown()
|
||||||
s.fundingMgr.Stop()
|
s.fundingMgr.Stop()
|
||||||
|
|
||||||
// ROUTING ADDED
|
|
||||||
s.routingMgr.Stop()
|
s.routingMgr.Stop()
|
||||||
|
|
||||||
// Signal all the lingering goroutines to quit.
|
// 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
|
// TODO(roasbeef): server semaphore to restrict num goroutines
|
||||||
fundingID, err := s.fundingMgr.initFundingWorkflow(targetPeer, req)
|
fundingID, err := s.fundingMgr.initFundingWorkflow(targetPeer, req)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// ROUTING ADDED
|
|
||||||
capacity := float64(req.localFundingAmt + req.remoteFundingAmt)
|
capacity := float64(req.localFundingAmt + req.remoteFundingAmt)
|
||||||
s.routingMgr.AddChannel(
|
s.routingMgr.AddChannel(
|
||||||
graph.NewID(s.lightningID),
|
graph.NewID(s.lightningID),
|
||||||
|
Loading…
Reference in New Issue
Block a user