mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 13:42:49 +02:00
htlcswitch+routing: PaymentBandwidth accepts channel peer pubkey argument
This commit is contained in:
committed by
Oliver Gugger
parent
ab036990b5
commit
128b23e813
@@ -522,7 +522,8 @@ type AuxTrafficShaper interface {
|
||||
PaymentBandwidth(fundingBlob, htlcBlob,
|
||||
commitmentBlob fn.Option[tlv.Blob],
|
||||
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
|
||||
// custom records to put it under the purview of the traffic shaper,
|
||||
|
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/queue"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
"github.com/lightningnetwork/lnd/ticker"
|
||||
"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.
|
||||
commitmentBlob := l.CommitmentCustomBlob()
|
||||
auxBandwidth, err := ts.PaymentBandwidth(
|
||||
fundingBlob, htlcBlob, commitmentBlob, l.Bandwidth(), amount,
|
||||
l.channel.FetchLatestAuxHTLCView(),
|
||||
l.channel.FetchLatestAuxHTLCView(), peer,
|
||||
)
|
||||
if err != nil {
|
||||
return fn.Err[OptionalBandwidth](fmt.Errorf("failed to get "+
|
||||
|
Reference in New Issue
Block a user