multi: skip range check in pathfinder and switch for custom htlc payments
This commit is contained in:
4 files changed
+112
-48
No files matched your search
+22
-7
@@ -24,9 +24,9 @@ type bandwidthHints interface {
|
||||
availableChanBandwidth(channelID uint64,
|
||||
amount lnwire.MilliSatoshi) (lnwire.MilliSatoshi, bool)
|
||||
|
||||
// firstHopCustomBlob returns the custom blob for the first hop of the
|
||||
// payment, if available.
|
||||
firstHopCustomBlob() fn.Option[tlv.Blob]
|
||||
// isCustomHTLCPayment returns true if this payment is a custom payment.
|
||||
// For custom payments policy checks might not be needed.
|
||||
isCustomHTLCPayment() bool
|
||||
}
|
||||
|
||||
// getLinkQuery is the function signature used to lookup a link.
|
||||
@@ -207,8 +207,23 @@ func (b *bandwidthManager) availableChanBandwidth(channelID uint64,
|
||||
return bandwidth, true
|
||||
}
|
||||
|
||||
// firstHopCustomBlob returns the custom blob for the first hop of the payment,
|
||||
// if available.
|
||||
func (b *bandwidthManager) firstHopCustomBlob() fn.Option[tlv.Blob] {
|
||||
return b.firstHopBlob
|
||||
// isCustomHTLCPayment returns true if this payment is a custom payment.
|
||||
// For custom payments policy checks might not be needed.
|
||||
func (b *bandwidthManager) isCustomHTLCPayment() bool {
|
||||
return fn.MapOptionZ(b.firstHopBlob, func(blob tlv.Blob) bool {
|
||||
customRecords, err := lnwire.ParseCustomRecords(blob)
|
||||
if err != nil {
|
||||
log.Warnf("failed to parse custom records when "+
|
||||
"checking if payment is custom: %v", err)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
return fn.MapOptionZ(
|
||||
b.trafficShaper,
|
||||
func(s htlcswitch.AuxTrafficShaper) bool {
|
||||
return s.IsCustomHTLC(customRecords)
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user