From 5cc0765b63efaec66c25a72afb1e3a2e3963e432 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 24 Feb 2017 16:16:13 -0800 Subject: [PATCH] funding: rename ProcessRoutingMessage to SendToRouter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit renames routing processing method in the funding mangers config from ProcessRoutingMessage to SendToRouter and also modifies the signature to only require the message itself and not the server’s identity public key. --- fundingmanager.go | 20 ++++++++++---------- server.go | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/fundingmanager.go b/fundingmanager.go index 38b34446d..919a0ddb5 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -141,9 +141,9 @@ type fundingConfig struct { // so that the channel creation process can be completed. Notifier chainntnfs.ChainNotifier - // ProcessRoutingMessage is used by the FundingManager to announce newly created + // SendToRouter is used by the FundingManager to announce newly created // channels to the rest of the Lightning Network. - ProcessRoutingMessage func(msg lnwire.Message, src *btcec.PublicKey) + SendToRouter func(msg lnwire.Message) // SendToPeer allows the FundingManager to send messages to the peer // node during the multiple steps involved in the creation of the @@ -254,14 +254,14 @@ func (f *fundingManager) Start() error { return err } - // For any channels that were in a pending state when the daemon was last - // connected, the Funding Manager will re-initialize the channel barriers - // and will also launch waitForFundingConfirmation to wait for the - // channel's funding transaction to be confirmed on the blockchain. + // For any channels that were in a pending state when the daemon was + // last connected, the Funding Manager will re-initialize the channel + // barriers and will also launch waitForFundingConfirmation to wait for + // the channel's funding transaction to be confirmed on the blockchain. for _, channel := range pendingChannels { f.barrierMtx.Lock() - fndgLog.Tracef("Creating chan barrier for "+ - "ChannelPoint(%v)", *channel.FundingOutpoint) + fndgLog.Tracef("Loading pending ChannelPoint(%v), creating chan "+ + "barrier", *channel.FundingOutpoint) f.newChanBarriers[*channel.FundingOutpoint] = make(chan struct{}) f.barrierMtx.Unlock() @@ -1076,8 +1076,8 @@ func (f *fundingManager) announceChannel(idKey, remoteIdKey *btcec.PublicKey, chanAnnouncement := newChanAnnouncement(idKey, remoteIdKey, channel, chanID, localProof, remoteProof) - f.cfg.ProcessRoutingMessage(chanAnnouncement.chanAnn, idKey) - f.cfg.ProcessRoutingMessage(chanAnnouncement.edgeUpdate, idKey) + f.cfg.SendToRouter(chanAnnouncement.chanAnn) + f.cfg.SendToRouter(chanAnnouncement.edgeUpdate) } // initFundingWorkflow sends a message to the funding manager instructing it diff --git a/server.go b/server.go index c4c3ca7a7..8990d0463 100644 --- a/server.go +++ b/server.go @@ -198,14 +198,17 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier, s.breachArbiter = newBreachArbiter(wallet, chanDB, notifier, s.htlcSwitch) s.fundingMgr, err = newFundingManager(fundingConfig{ - IDKey: s.identityPriv.PubKey(), - Wallet: wallet, - Notifier: s.chainNotifier, - ProcessRoutingMessage: s.chanRouter.ProcessRoutingMessage, - ArbiterChan: s.breachArbiter.newContracts, - SendToPeer: s.sendToPeer, - FindPeer: s.findPeer, - FindChannel: s.rpcServer.fetchActiveChannel, + IDKey: s.identityPriv.PubKey(), + Wallet: wallet, + Notifier: s.chainNotifier, + SendToRouter: func(msg lnwire.Message) { + s.chanRouter.ProcessRoutingMessage(msg, + s.identityPriv.PubKey()) + }, + ArbiterChan: s.breachArbiter.newContracts, + SendToPeer: s.sendToPeer, + FindPeer: s.findPeer, + FindChannel: s.rpcServer.fetchActiveChannel, }) if err != nil { return nil, err