routing/payment_lifecycle: extract attempt sending logic

Define shardHandler which is a struct holding what is needed to send
attempts along given routes. The reason we define the logic on this
struct instead of the paymentLifecycle is that we later will make
SendToRoute calls not go through the payment lifecycle, but only using
this struct.

The launch shard is responsible for registering the attempt with the
control tower, failing it if the launch fails. Note that it is NOT
responsible for marking the _payment_ failed in case a terminal error is
encountered. This is important since we will later reuse this method for
SendToRoute, where whether to fail the payment cannot be decided on the
shard level.
This commit is contained in:
Johan T. Halseth
2020-04-01 00:13:24 +02:00
parent bcca1ab821
commit 9712dd1a7f
2 changed files with 99 additions and 47 deletions

View File

@@ -1827,7 +1827,6 @@ func (r *ChannelRouter) sendPayment(
paymentHash: paymentHash,
paySession: paySession,
currentHeight: currentHeight,
lastError: nil,
}
// If a timeout is specified, create a timeout channel. If no timeout is