routing/payment_session: make RequestRoute take max amt, fee limit and

active shards

In preparation for doing pathfinding for routes sending a value less
than the total payment amount, we let the payment session take the max
amount to send and the fee limit as arguments to RequestRoute.
This commit is contained in:
Johan T. Halseth
2020-04-01 00:13:22 +02:00
parent f9eeb6b41f
commit 00903ef9f5
5 changed files with 44 additions and 16 deletions

View File

@ -31,6 +31,8 @@ func (e errNoRoute) Error() string {
// needed to resume if from any point.
type paymentLifecycle struct {
router *ChannelRouter
totalAmount lnwire.MilliSatoshi
feeLimit lnwire.MilliSatoshi
paymentHash lntypes.Hash
paySession PaymentSession
timeoutChan <-chan time.Time
@ -267,7 +269,9 @@ func (p *paymentLifecycle) createNewPaymentAttempt() (lnwire.ShortChannelID,
}
// Create a new payment attempt from the given payment session.
rt, err := p.paySession.RequestRoute(uint32(p.currentHeight))
rt, err := p.paySession.RequestRoute(
p.totalAmount, p.feeLimit, 0, uint32(p.currentHeight),
)
if err != nil {
log.Warnf("Failed to find route for payment %x: %v",
p.paymentHash, err)