htlcswitch+routing: PaymentBandwidth accepts channel peer pubkey argument
This commit is contained in:
3 files changed
+13
-3
No files matched your search
@@ -522,7 +522,8 @@ type AuxTrafficShaper interface {
|
|||||||
PaymentBandwidth(fundingBlob, htlcBlob,
|
PaymentBandwidth(fundingBlob, htlcBlob,
|
||||||
commitmentBlob fn.Option[tlv.Blob],
|
commitmentBlob fn.Option[tlv.Blob],
|
||||||
linkBandwidth, htlcAmt lnwire.MilliSatoshi,
|
linkBandwidth, htlcAmt lnwire.MilliSatoshi,
|
||||||
htlcView lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error)
|
htlcView lnwallet.AuxHtlcView,
|
||||||
|
peer route.Vertex) (lnwire.MilliSatoshi, error)
|
||||||
|
|
||||||
// IsCustomHTLC returns true if the HTLC carries the set of relevant
|
// IsCustomHTLC returns true if the HTLC carries the set of relevant
|
||||||
// custom records to put it under the purview of the traffic shaper,
|
// custom records to put it under the purview of the traffic shaper,
|
||||||
|
|||||||
+10
-1
@@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/queue"
|
"github.com/lightningnetwork/lnd/queue"
|
||||||
"github.com/lightningnetwork/lnd/record"
|
"github.com/lightningnetwork/lnd/record"
|
||||||
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
"github.com/lightningnetwork/lnd/ticker"
|
"github.com/lightningnetwork/lnd/ticker"
|
||||||
"github.com/lightningnetwork/lnd/tlv"
|
"github.com/lightningnetwork/lnd/tlv"
|
||||||
)
|
)
|
||||||
@@ -3503,11 +3504,19 @@ func (l *channelLink) AuxBandwidth(amount lnwire.MilliSatoshi,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
peerBytes := l.cfg.Peer.PubKey()
|
||||||
|
|
||||||
|
peer, err := route.NewVertexFromBytes(peerBytes[:])
|
||||||
|
if err != nil {
|
||||||
|
return fn.Err[OptionalBandwidth](fmt.Errorf("failed to decode "+
|
||||||
|
"peer pub key: %v", err))
|
||||||
|
}
|
||||||
|
|
||||||
// Ask for a specific bandwidth to be used for the channel.
|
// Ask for a specific bandwidth to be used for the channel.
|
||||||
commitmentBlob := l.CommitmentCustomBlob()
|
commitmentBlob := l.CommitmentCustomBlob()
|
||||||
auxBandwidth, err := ts.PaymentBandwidth(
|
auxBandwidth, err := ts.PaymentBandwidth(
|
||||||
fundingBlob, htlcBlob, commitmentBlob, l.Bandwidth(), amount,
|
fundingBlob, htlcBlob, commitmentBlob, l.Bandwidth(), amount,
|
||||||
l.channel.FetchLatestAuxHTLCView(),
|
l.channel.FetchLatestAuxHTLCView(), peer,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fn.Err[OptionalBandwidth](fmt.Errorf("failed to get "+
|
return fn.Err[OptionalBandwidth](fmt.Errorf("failed to get "+
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ func (*mockTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID,
|
|||||||
// ShouldHandleTraffic method should be called first.
|
// ShouldHandleTraffic method should be called first.
|
||||||
func (*mockTrafficShaper) PaymentBandwidth(_, _, _ fn.Option[tlv.Blob],
|
func (*mockTrafficShaper) PaymentBandwidth(_, _, _ fn.Option[tlv.Blob],
|
||||||
linkBandwidth, _ lnwire.MilliSatoshi,
|
linkBandwidth, _ lnwire.MilliSatoshi,
|
||||||
_ lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error) {
|
_ lnwallet.AuxHtlcView, _ route.Vertex) (lnwire.MilliSatoshi, error) {
|
||||||
|
|
||||||
return linkBandwidth, nil
|
return linkBandwidth, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user