mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-18 19:41:21 +02:00
link+peer: thread anchor tower client to link
This commit is contained in:
@@ -248,9 +248,13 @@ type Config struct {
|
||||
// HtlcNotifier is used when creating a ChannelLink.
|
||||
HtlcNotifier *htlcswitch.HtlcNotifier
|
||||
|
||||
// TowerClient is used when creating a ChannelLink.
|
||||
// TowerClient is used by legacy channels to backup revoked states.
|
||||
TowerClient wtclient.Client
|
||||
|
||||
// AnchorTowerClient is used by anchor channels to backup revoked
|
||||
// states.
|
||||
AnchorTowerClient wtclient.Client
|
||||
|
||||
// DisconnectPeer is used to disconnect this peer if the cooperative close
|
||||
// process fails.
|
||||
DisconnectPeer func(*btcec.PublicKey) error
|
||||
@@ -757,6 +761,18 @@ func (p *Brontide) addLink(chanPoint *wire.OutPoint,
|
||||
return p.cfg.ChainArb.UpdateContractSignals(*chanPoint, signals)
|
||||
}
|
||||
|
||||
chanType := lnChan.State().ChanType
|
||||
|
||||
// Select the appropriate tower client based on the channel type. It's
|
||||
// okay if the clients are disabled altogether and these values are nil,
|
||||
// as the link will check for nilness before using either.
|
||||
var towerClient htlcswitch.TowerClient
|
||||
if chanType.HasAnchors() {
|
||||
towerClient = p.cfg.AnchorTowerClient
|
||||
} else {
|
||||
towerClient = p.cfg.TowerClient
|
||||
}
|
||||
|
||||
linkCfg := htlcswitch.ChannelLinkConfig{
|
||||
Peer: p,
|
||||
DecodeHopIterators: p.cfg.Sphinx.DecodeHopIterators,
|
||||
@@ -782,7 +798,7 @@ func (p *Brontide) addLink(chanPoint *wire.OutPoint,
|
||||
MinFeeUpdateTimeout: htlcswitch.DefaultMinLinkFeeUpdateTimeout,
|
||||
MaxFeeUpdateTimeout: htlcswitch.DefaultMaxLinkFeeUpdateTimeout,
|
||||
OutgoingCltvRejectDelta: p.cfg.OutgoingCltvRejectDelta,
|
||||
TowerClient: p.cfg.TowerClient,
|
||||
TowerClient: towerClient,
|
||||
MaxOutgoingCltvExpiry: p.cfg.MaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: p.cfg.MaxChannelFeeAllocation,
|
||||
NotifyActiveLink: p.cfg.ChannelNotifier.NotifyActiveLinkEvent,
|
||||
|
Reference in New Issue
Block a user