mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
routing: add TlvTrafficShaper to bandwidth hints
This commit is contained in:
committed by
Oliver Gugger
parent
5dcda25881
commit
5b4de5f0d4
@@ -9,12 +9,14 @@ import (
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
"github.com/lightningnetwork/lnd/routing/shards"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
@@ -104,7 +106,8 @@ type mockPaymentSessionSourceOld struct {
|
||||
var _ PaymentSessionSource = (*mockPaymentSessionSourceOld)(nil)
|
||||
|
||||
func (m *mockPaymentSessionSourceOld) NewPaymentSession(
|
||||
_ *LightningPayment) (PaymentSession, error) {
|
||||
_ *LightningPayment, _ fn.Option[tlv.Blob],
|
||||
_ fn.Option[TlvTrafficShaper]) (PaymentSession, error) {
|
||||
|
||||
return &mockPaymentSessionOld{
|
||||
routes: m.routes,
|
||||
@@ -166,7 +169,8 @@ type mockPaymentSessionOld struct {
|
||||
var _ PaymentSession = (*mockPaymentSessionOld)(nil)
|
||||
|
||||
func (m *mockPaymentSessionOld) RequestRoute(_, _ lnwire.MilliSatoshi,
|
||||
_, height uint32) (*route.Route, error) {
|
||||
_, height uint32, _ lnwire.CustomRecords) (*route.Route,
|
||||
error) {
|
||||
|
||||
if m.release != nil {
|
||||
m.release <- struct{}{}
|
||||
@@ -630,9 +634,10 @@ type mockPaymentSessionSource struct {
|
||||
var _ PaymentSessionSource = (*mockPaymentSessionSource)(nil)
|
||||
|
||||
func (m *mockPaymentSessionSource) NewPaymentSession(
|
||||
payment *LightningPayment) (PaymentSession, error) {
|
||||
payment *LightningPayment, firstHopBlob fn.Option[tlv.Blob],
|
||||
tlvShaper fn.Option[TlvTrafficShaper]) (PaymentSession, error) {
|
||||
|
||||
args := m.Called(payment)
|
||||
args := m.Called(payment, firstHopBlob, tlvShaper)
|
||||
return args.Get(0).(PaymentSession), args.Error(1)
|
||||
}
|
||||
|
||||
@@ -690,9 +695,12 @@ type mockPaymentSession struct {
|
||||
var _ PaymentSession = (*mockPaymentSession)(nil)
|
||||
|
||||
func (m *mockPaymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
|
||||
activeShards, height uint32) (*route.Route, error) {
|
||||
activeShards, height uint32,
|
||||
firstHopCustomRecords lnwire.CustomRecords) (*route.Route, error) {
|
||||
|
||||
args := m.Called(maxAmt, feeLimit, activeShards, height)
|
||||
args := m.Called(
|
||||
maxAmt, feeLimit, activeShards, height, firstHopCustomRecords,
|
||||
)
|
||||
|
||||
// Type assertion on nil will fail, so we check and return here.
|
||||
if args.Get(0) == nil {
|
||||
@@ -897,6 +905,14 @@ func (m *mockLink) MayAddOutgoingHtlc(_ lnwire.MilliSatoshi) error {
|
||||
return m.mayAddOutgoingErr
|
||||
}
|
||||
|
||||
func (m *mockLink) FundingCustomBlob() fn.Option[tlv.Blob] {
|
||||
return fn.None[tlv.Blob]()
|
||||
}
|
||||
|
||||
func (m *mockLink) CommitmentCustomBlob() fn.Option[tlv.Blob] {
|
||||
return fn.None[tlv.Blob]()
|
||||
}
|
||||
|
||||
type mockShardTracker struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
Reference in New Issue
Block a user