Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23087,6 +23087,12 @@
"source": "default",
"plugin": "/usr/local/libexec/plugins/cln-xpay"
},
"xpay-failing-node-tolerance": {
"value_int": 4,
"source": "default",
"plugin": "/usr/local/libexec/plugins/cln-xpay",
"dynamic": true
},
"xpay-handle-pay": {
"value_bool": true,
"source": "default",
Expand Down
4 changes: 4 additions & 0 deletions doc/lightningd-config.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,10 @@ command, so they invoices can also be paid onchain.

Specify the name of a layer `xpay` shall use always for every payment. This is specially useful when combined with `xpay-handle-pay` since the `layers` parameter is not available in the `pay` interface. This can be specified multiple times to add more layers.

* **xpay-failing-node-tolerance**=*NUMBER* [plugin `xpay`, *dynamic*]

How many times a forwarding node can give us a weird error before we disable it for the current payment session. If a node gives us weird errors on its channels repeatedly it could either be that we were unlucky and all the channels we tried have some kind of issue or it is the node that has an issue. In the first case it would just be a matter of trying again through a different channel, but in the latter case it is better to avoid routing through it otherwise it'll make us waste our time and eventually fail the payment on timeout. The tolerance must balance the odds of those two cases (the default is 4). Some critical error types will trigger the node disable at the first hit regardless of the value of the tolerance.

* **askrene-timeout**=*SECONDS* [plugin `askrene`, *dynamic*]

This option makes the `getroutes` call fail if it takes more than this many seconds. Setting it to zero is a fun way to ensure your node never makes payments.
Expand Down
6 changes: 6 additions & 0 deletions doc/schemas/listconfigs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,12 @@
"source": "default",
"plugin": "/usr/local/libexec/plugins/cln-xpay"
},
"xpay-failing-node-tolerance": {
"value_int": 4,
"source": "default",
"plugin": "/usr/local/libexec/plugins/cln-xpay",
"dynamic": true
},
"xpay-handle-pay": {
"value_bool": true,
"source": "default",
Expand Down
20 changes: 16 additions & 4 deletions plugins/askrene/layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,17 @@ const struct node_bias *layer_set_node_bias(struct layer *layer,
return bias;
}

static void bias_add_clamped(s8 *bias, s8 add)
{
s32 x = *bias;
x += add;
if (x > 100)
x = 100;
if (x < -100)
x = -100;
*bias = x;
}

void layer_apply_biases(const struct layer *layer,
const struct gossmap *gossmap,
s8 *biases)
Expand All @@ -1112,21 +1123,22 @@ void layer_apply_biases(const struct layer *layer,
c = gossmap_nth_chan(gossmap, n, i, &dir);
idx = (gossmap_chan_idx(gossmap, c) << 1) | dir;

biases[idx] += node_bias->out_bias;
biases[idx ^ 1] += node_bias->in_bias;
bias_add_clamped(&biases[idx], node_bias->out_bias);
bias_add_clamped(&biases[idx ^ 1], node_bias->in_bias);
}
}

for (bias = bias_hash_first(layer->biases, &it);
bias;
bias = bias_hash_next(layer->biases, &it)) {
struct gossmap_chan *c;
u32 idx;

c = gossmap_find_chan(gossmap, &bias->scidd.scid);
if (!c)
continue;
biases[(gossmap_chan_idx(gossmap, c) << 1) | bias->scidd.dir]
+= bias->bias;
idx = (gossmap_chan_idx(gossmap, c) << 1) | bias->scidd.dir;
bias_add_clamped(&biases[idx], bias->bias);
}
}

Expand Down
Loading
Loading