mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-01 11:00:51 +02:00
peer.go: moving the apply function outside of the constructor
This is mainly for readability so that the function isn't indented.
This commit is contained in:
14
peer.go
14
peer.go
@ -1060,11 +1060,7 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
|
|||||||
|
|
||||||
var chanLink htlcswitch.ChannelLink
|
var chanLink htlcswitch.ChannelLink
|
||||||
|
|
||||||
return newMsgStream(p,
|
apply := func(msg lnwire.Message) {
|
||||||
fmt.Sprintf("Update stream for ChannelID(%x) created", cid[:]),
|
|
||||||
fmt.Sprintf("Update stream for ChannelID(%x) exiting", cid[:]),
|
|
||||||
1000,
|
|
||||||
func(msg lnwire.Message) {
|
|
||||||
// This check is fine because if the link no longer exists, it will
|
// This check is fine because if the link no longer exists, it will
|
||||||
// be removed from the activeChannels map and subsequent messages
|
// be removed from the activeChannels map and subsequent messages
|
||||||
// shouldn't reach the chan msg stream.
|
// shouldn't reach the chan msg stream.
|
||||||
@ -1088,7 +1084,13 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chanLink.HandleChannelUpdate(msg)
|
chanLink.HandleChannelUpdate(msg)
|
||||||
},
|
}
|
||||||
|
|
||||||
|
return newMsgStream(p,
|
||||||
|
fmt.Sprintf("Update stream for ChannelID(%x) created", cid[:]),
|
||||||
|
fmt.Sprintf("Update stream for ChannelID(%x) exiting", cid[:]),
|
||||||
|
1000,
|
||||||
|
apply,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user