When using MPP, if we can't find a route, we need to add an entry to the
DB. Otherwise when users query their payment status, nothing will be
returned which is a bad UX.
Fixes#1512
We were previously using an encoding that was incompatible with TLV.
We keep the old format, but also understand the channel version when provided
in a TLV field.
If the old format is provided, it will be preferred.
Instead of waiting for latest feerates from the fee provider at startup,
we use the previously stored feerates in the meantime, and proceed with
the initialization.
It makes sense because fees are asynchronous so we are "always late"
anyway.
manualTransition is a fix for old akka version where onTransition events
are not fired for same state transitions. Must not be used if states are
different, otherwise duplicate events are fired.
* Split feerate mismatch configuration
We want to be much stricter with feerates that are below our estimation
than feerates that are above it.
This also makes this configuration parameter easier to understand
for end users.
* Tolerate feerate mismatch while channel is unused
We can relax the conditions where we close a channel because of a feerate
mismatch: when the channel has no pending HTLCs, it's ok to temporarily
disagree on the feerate.
While we disagree on feerates, we don't use this channel to offer outgoing
HTLCs. If we receive an incoming HTLC, we have to close the channel because
that HTLC would be at risk (incorrect feerate).
This mechanism gives us time to adapt to feerate changes, hopefully reducing
the amount of unnecessary channel closures.
The channelstats API only returns results for the *outgoing* channels
used when relaying. We must also include the *incoming* channels, otherwise
it looks like they're inactive which doesn't reflect their real usage.
Fixes#1465
- Test was not executed (because the "tests" variable was an iterator that was emptied by the call to .size())
- HTLC regex had to be updated to skip over the HTLC number that was added to the reference test vectors
* Add metric to track onion payload format
This will be useful to decide when we can safely phase out support for
the legacy format.
* Add metric to track htlcs in flight
We track both the number of HTLCs and their amounts.
We track this at the channel level and globally.
If all trampoline retries fail, we should convert the error to a route
not found. We tried multiple fee targets and none of those was enough to
allow the trampoline node to find a satisfying route.
MPP lifecycle shares preimage as soon as received.
This allows removing the use of the node-relayer as a passthrough for
fulfills, it can now simply listen to this event.
Long term, this could be sent to the event stream to share with more actors.
* PaymentLifecycle cleanup
Remove temporary hooks added for first version of MPP (route prefix,
empty routes, etc).
Allow specifying the whole route (not only nodeIds) in SendPaymentToRoute.
* Rework MultiPartPaymentLifecycle
Use the Router's new MPP RouteRequest.
Remove the "blind" split based on channel balances.
Reactivate trampoline relay to MPP non-trampoline recipient.
* Add MPP payment metrics
* Activate MPP feature by default
This provider will save the feerates retrieved by another provider to
database.
This feature can be used to retrieve the last used feerates when starting
the node, which will save time. This can have a significant effect on nodes
running with a slow connection (e.g. mobile devices).
Note that this commit does not affect the current setup and does not
actually create the database, the feature must be implemented separately.
Fixes#1447
Legacy codecs are isolated in a separate file, with a visibility restricted to "package" in order to reduce the risk of using those codecs. Also codecs are restricted to `decodeOnly` for the same reason.
* localPaymentBasepoint->staticPaymentBasepoint
Use `getOrElse` on the option value to decide between static/dynamic
payment point, instead of the `ChannelVersion` bit.
* define explicit method to test channel features
Also reduce visibility of a few members of `ChannelVersion`, and some
cleanup.
* use `if/else` instead of `match` for version bit
Leverage Yen's k-shortest paths and a simple split algorithm
to move MPP entirely inside the Router.
This is currently unused, the multipart payment lifecycle needs
to be updated to leverage this new algorithm.
We go to the `CLOSING` if and only if the funding tx has been spent by
one transaction. The `require` is absolutely necessary. We could
probably enforce this constraint at the compilation level by more clever
typing but that's another matter.
It should return stats for all channels (funder and fundee).
The previous code was incorrectly filtering on channels for which we paid
an on-chain fees, excluding the channels for which we were fundee.
Fixes#1449.
Light clients don't always validate channels by fetching the blockchain tx.
That means they don't have access to the exact capacity.
When that happens, we can fallback to htlc_maximum_msat if
available, or to a default capacity (otherwise path-finding will ignore
these edges).