This is an inefficient hack. Can you tell I really didn't want to implement this? MPP was finalized in 2018 FFS. We do this by adding another "auto" layer, which removes all too-small channels, and then makes our MPP node pile all the funds into the largest channel it chooses. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
44 lines
1.6 KiB
C
44 lines
1.6 KiB
C
#ifndef LIGHTNING_PLUGINS_ASKRENE_MCF_H
|
|
#define LIGHTNING_PLUGINS_ASKRENE_MCF_H
|
|
/* Eduardo Quintela's (lagrang3@protonmail.com) Min Cost Flow implementation
|
|
* from renepay, as modified to fit askrene */
|
|
#include "config.h"
|
|
#include <common/amount.h>
|
|
#include <common/gossmap.h>
|
|
|
|
struct route_query;
|
|
|
|
/**
|
|
* optimal_payment_flow - API for min cost flow function(s).
|
|
* @ctx: context to allocate returned flows from
|
|
* @rq: the route_query we're processing (for logging)
|
|
* @source: the source to start from
|
|
* @target: the target to pay
|
|
* @amount: the amount we want to reach @target
|
|
* @mu: 0 = corresponds to only probabilities, 100 corresponds to only fee.
|
|
* @delay_feefactor: convert 1 block delay into msat.
|
|
* @single_part: don't do MCF at all, just create a single flow.
|
|
*
|
|
* @delay_feefactor converts 1 block delay into msat, as if it were an additional
|
|
* fee. So if a CLTV delay on a node is 5 blocks, that's treated as if it
|
|
* were a fee of 5 * @delay_feefactor.
|
|
*
|
|
* Return a series of subflows which deliver amount to target, or NULL.
|
|
*/
|
|
struct flow **minflow(const tal_t *ctx,
|
|
const struct route_query *rq,
|
|
const struct gossmap_node *source,
|
|
const struct gossmap_node *target,
|
|
struct amount_msat amount,
|
|
u32 mu,
|
|
double delay_feefactor,
|
|
bool single_part);
|
|
|
|
/* To sanity check: this is the approximation mcf uses for the cost
|
|
* of each channel. */
|
|
struct amount_msat linear_flow_cost(const struct flow *flow,
|
|
struct amount_msat total_amount,
|
|
double delay_feefactor);
|
|
|
|
#endif /* LIGHTNING_PLUGINS_ASKRENE_MCF_H */
|