mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
htlcswitch+peer: CreateAndAddLink in switch, add messageSwitch to peer
This commit allows the peer to be tested without relying on a raw htlcswitch.Switch pointer. This is accomplished by using a messageSwitch interface and adding the CreateAndAddLink method to the htlcswitch.Switch.
This commit is contained in:
@ -1956,6 +1956,15 @@ func (s *Switch) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateAndAddLink will create a link and then add it to the internal maps
|
||||
// when given a ChannelLinkConfig and LightningChannel.
|
||||
func (s *Switch) CreateAndAddLink(linkCfg ChannelLinkConfig,
|
||||
lnChan *lnwallet.LightningChannel) error {
|
||||
|
||||
link := NewChannelLink(linkCfg, lnChan)
|
||||
return s.AddLink(link)
|
||||
}
|
||||
|
||||
// AddLink is used to initiate the handling of the add link command. The
|
||||
// request will be propagated and handled in the main goroutine.
|
||||
func (s *Switch) AddLink(link ChannelLink) error {
|
||||
|
Reference in New Issue
Block a user