funding: rename ProcessRoutingMessage to SendToRouter

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-02-24 16:16:13 -08:00
parent c137dc53df
commit 5cc0765b63
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
2 changed files with 21 additions and 18 deletions

@ -141,9 +141,9 @@ type fundingConfig struct {
// so that the channel creation process can be completed. // so that the channel creation process can be completed.
Notifier chainntnfs.ChainNotifier 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. // 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 // SendToPeer allows the FundingManager to send messages to the peer
// node during the multiple steps involved in the creation of the // node during the multiple steps involved in the creation of the
@ -254,14 +254,14 @@ func (f *fundingManager) Start() error {
return err return err
} }
// For any channels that were in a pending state when the daemon was last // For any channels that were in a pending state when the daemon was
// connected, the Funding Manager will re-initialize the channel barriers // last connected, the Funding Manager will re-initialize the channel
// and will also launch waitForFundingConfirmation to wait for the // barriers and will also launch waitForFundingConfirmation to wait for
// channel's funding transaction to be confirmed on the blockchain. // the channel's funding transaction to be confirmed on the blockchain.
for _, channel := range pendingChannels { for _, channel := range pendingChannels {
f.barrierMtx.Lock() f.barrierMtx.Lock()
fndgLog.Tracef("Creating chan barrier for "+ fndgLog.Tracef("Loading pending ChannelPoint(%v), creating chan "+
"ChannelPoint(%v)", *channel.FundingOutpoint) "barrier", *channel.FundingOutpoint)
f.newChanBarriers[*channel.FundingOutpoint] = make(chan struct{}) f.newChanBarriers[*channel.FundingOutpoint] = make(chan struct{})
f.barrierMtx.Unlock() f.barrierMtx.Unlock()
@ -1076,8 +1076,8 @@ func (f *fundingManager) announceChannel(idKey, remoteIdKey *btcec.PublicKey,
chanAnnouncement := newChanAnnouncement(idKey, remoteIdKey, channel, chanID, chanAnnouncement := newChanAnnouncement(idKey, remoteIdKey, channel, chanID,
localProof, remoteProof) localProof, remoteProof)
f.cfg.ProcessRoutingMessage(chanAnnouncement.chanAnn, idKey) f.cfg.SendToRouter(chanAnnouncement.chanAnn)
f.cfg.ProcessRoutingMessage(chanAnnouncement.edgeUpdate, idKey) f.cfg.SendToRouter(chanAnnouncement.edgeUpdate)
} }
// initFundingWorkflow sends a message to the funding manager instructing it // initFundingWorkflow sends a message to the funding manager instructing it

@ -198,14 +198,17 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
s.breachArbiter = newBreachArbiter(wallet, chanDB, notifier, s.htlcSwitch) s.breachArbiter = newBreachArbiter(wallet, chanDB, notifier, s.htlcSwitch)
s.fundingMgr, err = newFundingManager(fundingConfig{ s.fundingMgr, err = newFundingManager(fundingConfig{
IDKey: s.identityPriv.PubKey(), IDKey: s.identityPriv.PubKey(),
Wallet: wallet, Wallet: wallet,
Notifier: s.chainNotifier, Notifier: s.chainNotifier,
ProcessRoutingMessage: s.chanRouter.ProcessRoutingMessage, SendToRouter: func(msg lnwire.Message) {
ArbiterChan: s.breachArbiter.newContracts, s.chanRouter.ProcessRoutingMessage(msg,
SendToPeer: s.sendToPeer, s.identityPriv.PubKey())
FindPeer: s.findPeer, },
FindChannel: s.rpcServer.fetchActiveChannel, ArbiterChan: s.breachArbiter.newContracts,
SendToPeer: s.sendToPeer,
FindPeer: s.findPeer,
FindChannel: s.rpcServer.fetchActiveChannel,
}) })
if err != nil { if err != nil {
return nil, err return nil, err