mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 17:52:25 +01:00
htlcswitch+peer: pass BestHeight to ChannelLinkConfig
This allows non-test usages of ChannelLinkConfig to omit the raw htlcswitch.Switch pointer.
This commit is contained in:
parent
90db8de6fe
commit
6c6e353597
@ -134,6 +134,9 @@ type ChannelLinkConfig struct {
|
||||
// TODO(conner): remove after refactoring htlcswitch testing framework.
|
||||
Switch *Switch
|
||||
|
||||
// BestHeight returns the best known height.
|
||||
BestHeight func() uint32
|
||||
|
||||
// ForwardPackets attempts to forward the batch of htlcs through the
|
||||
// switch. The function returns and error in case it fails to send one or
|
||||
// more packets. The link's quit signal should be provided to allow
|
||||
@ -2677,7 +2680,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
|
||||
continue
|
||||
}
|
||||
|
||||
heightNow := l.cfg.Switch.BestHeight()
|
||||
heightNow := l.cfg.BestHeight()
|
||||
|
||||
pld, err := chanIterator.HopPayload()
|
||||
if err != nil {
|
||||
|
@ -1951,6 +1951,7 @@ func newSingleLinkTestHarness(chanAmt, chanReserve btcutil.Amount) (
|
||||
FwrdingPolicy: globalPolicy,
|
||||
Peer: alicePeer,
|
||||
Switch: aliceSwitch,
|
||||
BestHeight: aliceSwitch.BestHeight,
|
||||
Circuits: aliceSwitch.CircuitModifier(),
|
||||
ForwardPackets: aliceSwitch.ForwardPackets,
|
||||
DecodeHopIterators: decoder.DecodeHopIterators,
|
||||
@ -4454,6 +4455,7 @@ func (h *persistentLinkHarness) restartLink(
|
||||
FwrdingPolicy: globalPolicy,
|
||||
Peer: alicePeer,
|
||||
Switch: aliceSwitch,
|
||||
BestHeight: aliceSwitch.BestHeight,
|
||||
Circuits: aliceSwitch.CircuitModifier(),
|
||||
ForwardPackets: aliceSwitch.ForwardPackets,
|
||||
DecodeHopIterators: decoder.DecodeHopIterators,
|
||||
|
@ -1119,6 +1119,7 @@ func (h *hopNetwork) createChannelLink(server, peer *mockServer,
|
||||
link := NewChannelLink(
|
||||
ChannelLinkConfig{
|
||||
Switch: server.htlcSwitch,
|
||||
BestHeight: server.htlcSwitch.BestHeight,
|
||||
FwrdingPolicy: h.globalPolicy,
|
||||
Peer: peer,
|
||||
Circuits: server.htlcSwitch.CircuitModifier(),
|
||||
|
@ -813,7 +813,7 @@ func (p *Brontide) addLink(chanPoint *wire.OutPoint,
|
||||
FetchLastChannelUpdate: p.cfg.FetchLastChanUpdate,
|
||||
HodlMask: p.cfg.Hodl.Mask(),
|
||||
Registry: p.cfg.Invoices,
|
||||
Switch: p.cfg.Switch,
|
||||
BestHeight: p.cfg.Switch.BestHeight,
|
||||
Circuits: p.cfg.Switch.CircuitModifier(),
|
||||
ForwardPackets: p.cfg.InterceptSwitch.ForwardPackets,
|
||||
FwrdingPolicy: *forwardingPolicy,
|
||||
|
Loading…
x
Reference in New Issue
Block a user