mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-03 03:53:10 +02:00
routing/payment_session: make NewPaymentSession take payment directly
This commit moves supplying of the information in the LightningPayment to the initialization of the paymentSession, away from every call to RequestRoute. Instead the paymentSession will store this information internally, as it doesn't change between payment attempts. This is done to rid the RequestRoute call of the LightingPayment argument, as for SendToRoute calls, it is not needed to supply the next route.
This commit is contained in:
@ -44,16 +44,6 @@ func TestRequestRoute(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
session := &paymentSession{
|
||||
getBandwidthHints: func() (map[uint64]lnwire.MilliSatoshi,
|
||||
error) {
|
||||
|
||||
return nil, nil
|
||||
},
|
||||
sessionSource: sessionSource,
|
||||
pathFinder: findPath,
|
||||
}
|
||||
|
||||
cltvLimit := uint32(30)
|
||||
finalCltvDelta := uint16(8)
|
||||
|
||||
@ -62,7 +52,18 @@ func TestRequestRoute(t *testing.T) {
|
||||
FinalCLTVDelta: finalCltvDelta,
|
||||
}
|
||||
|
||||
route, err := session.RequestRoute(payment, height, finalCltvDelta)
|
||||
session := &paymentSession{
|
||||
getBandwidthHints: func() (map[uint64]lnwire.MilliSatoshi,
|
||||
error) {
|
||||
|
||||
return nil, nil
|
||||
},
|
||||
sessionSource: sessionSource,
|
||||
payment: payment,
|
||||
pathFinder: findPath,
|
||||
}
|
||||
|
||||
route, err := session.RequestRoute(height)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user