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:
eugene committed 2021-08-10 17:15:49 -04:00
1 parent 90db8de6fe
commit 6c6e353597
4 files changed
+8 -2

No files matched your search

+4 -1
View File
@@ -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 {