routing: move payment session constructor

This commit is contained in:
Joost Jager
2020-04-16 15:20:23 +02:00
parent eec3799da9
commit 6e8442b333
4 changed files with 73 additions and 52 deletions

View File

@@ -140,18 +140,20 @@ func (c *integratedRoutingContext) testPayment(maxShards uint32) ([]htlcAttempt,
MaxShards: maxShards,
}
session := &paymentSession{
getBandwidthHints: getBandwidthHints,
payment: &payment,
pathFinder: findPath,
getRoutingGraph: func() (routingGraph, func(), error) {
session, err := newPaymentSession(
&payment, getBandwidthHints,
func() (routingGraph, func(), error) {
return c.graph, func() {}, nil
},
pathFindingConfig: c.pathFindingCfg,
missionControl: mc,
minShardAmt: lnwire.NewMSatFromSatoshis(5000),
mc, c.pathFindingCfg,
)
if err != nil {
c.t.Fatal(err)
}
// Override default minimum shard amount.
session.minShardAmt = lnwire.NewMSatFromSatoshis(5000)
// Now the payment control loop starts. It will keep trying routes until
// the payment succeeds.
var (