multi: move routing.TlvTrafficShaper => htlcswitch.AuxTrafficShaper

With this commit we move the traffic shaper definition from the routing
package to the HTLC switch package as a preparation for being able to
use it there as well.
At the same time we rename it to AuxTrafficShaper to be more in line
with the other auxiliary components.
This commit is contained in:
Oliver Gugger
2024-12-03 13:23:01 +01:00
parent fa309c9a0e
commit 117c6bc781
12 changed files with 167 additions and 99 deletions

View File

@@ -107,7 +107,7 @@ var _ PaymentSessionSource = (*mockPaymentSessionSourceOld)(nil)
func (m *mockPaymentSessionSourceOld) NewPaymentSession(
_ *LightningPayment, _ fn.Option[tlv.Blob],
_ fn.Option[TlvTrafficShaper]) (PaymentSession, error) {
_ fn.Option[htlcswitch.AuxTrafficShaper]) (PaymentSession, error) {
return &mockPaymentSessionOld{
routes: m.routes,
@@ -635,7 +635,8 @@ var _ PaymentSessionSource = (*mockPaymentSessionSource)(nil)
func (m *mockPaymentSessionSource) NewPaymentSession(
payment *LightningPayment, firstHopBlob fn.Option[tlv.Blob],
tlvShaper fn.Option[TlvTrafficShaper]) (PaymentSession, error) {
tlvShaper fn.Option[htlcswitch.AuxTrafficShaper]) (PaymentSession,
error) {
args := m.Called(payment, firstHopBlob, tlvShaper)
return args.Get(0).(PaymentSession), args.Error(1)
@@ -895,6 +896,19 @@ func (m *mockLink) Bandwidth() lnwire.MilliSatoshi {
return m.bandwidth
}
// AuxBandwidth returns the bandwidth that can be used for a channel,
// expressed in milli-satoshi. This might be different from the regular
// BTC bandwidth for custom channels. This will always return fn.None()
// for a regular (non-custom) channel.
func (m *mockLink) AuxBandwidth(lnwire.MilliSatoshi, lnwire.ShortChannelID,
fn.Option[tlv.Blob],
htlcswitch.AuxTrafficShaper) fn.Result[htlcswitch.OptionalBandwidth] {
return fn.Ok[htlcswitch.OptionalBandwidth](
fn.None[lnwire.MilliSatoshi](),
)
}
// EligibleToForward returns the mock's configured eligibility.
func (m *mockLink) EligibleToForward() bool {
return !m.ineligible