We make the capacity factor configurable via an lnd.conf routerrpc
apriori parameter. The capacity factor trades off increased success
probability with a reduced set of channel candidates, which may lead to
increased fees. To let users choose whether the factor is active or not,
we add a config setting where a capacity fraction of 1.0 disables the
factor. We limit the capacity fraction to values between 0.75 and 1.0.
Lower values may discard too many channels.
We require channel updates to have the max HTLC message flag set.
Several flows need to pass that check before channel updates are
forwarded to peers:
* after channel funding: `addToRouterGraph`
* after receiving channel updates from a peer:
`ProcessRemoteAnnouncement`
* after we update channel policies: `PropagateChanPolicyUpdate`
Implements a new probability estimator based on a probability theory
framework.
The computed probability consists of:
* the direct channel probability, which is estimated based on a
depleted liquidity distribution model, formulas and broader concept derived
after Pickhardt et al. https://arxiv.org/abs/2103.08576
* an extension of the probability model to incorporate knowledge decay
after time for previous successes and failures
* a mixed node probability taking into account successes/failures on other
channels of the node (similar to the apriori approach)
The storage of final htlc resolutions is a safety-critical feature. By
exposing it through the GetInfo call, connected applications can
ensure that the feature is turned on and avoid relying on the assumption
that lnd was configured correctly.
The grpc stream.Recv() will decode an ForwardHtlcInterceptResponse
without an IncomingCircuit, which will leave that pointer nil,
causing a nil pointer dereferece when components of in.IncomingCircuitKey
are used in the resolveFromClient() function.
This commit checks for the nil pointer and returns an error before
the rest of the parsing.
Since the cert pair is written with a subsequent call to
cert.WriteCertPair we can safely remove the two file paths from the
argument list of cert.GenCertPair.