Skip to content

Commit b2dcf72

Browse files
committed
askrene: add askrene-bias-channel.
This lets you place annotated biases on channels, to influence routing. Uses include avoiding TOR nodes, slow channels or other local preferences. Signed-off-by: Rusty Russell <[email protected]> Changelog-None: askrene is new anyway.
1 parent bd58355 commit b2dcf72

File tree

12 files changed

+671
-3
lines changed

12 files changed

+671
-3
lines changed

contrib/msggen/msggen/schema.json

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,110 @@
259259
"Main web site: <https://github.com/ElementsProject/lightning>"
260260
]
261261
},
262+
"lightning-askrene-bias-channel.json": {
263+
"$schema": "../rpc-schema-draft.json",
264+
"type": "object",
265+
"rpc": "askrene-bias-channel",
266+
"title": "Command to apply a manual bias to a channel in a layer (EXPERIMENTAL)",
267+
"description": [
268+
"WARNING: experimental, so API may change.",
269+
"",
270+
"The **askrene-bias-channel** RPC command tells askrene to favor or disfavor a channel when considering it for routing."
271+
],
272+
"request": {
273+
"required": [
274+
"layer",
275+
"short_channel_id_dir",
276+
"bias"
277+
],
278+
"additionalProperties": false,
279+
"properties": {
280+
"layer": {
281+
"type": "string",
282+
"description": [
283+
"The name of the layer to apply this bias to."
284+
]
285+
},
286+
"short_channel_id_dir": {
287+
"type": "short_channel_id_dir",
288+
"description": [
289+
"The short channel id and direction to apply this bias to."
290+
]
291+
},
292+
"bias": {
293+
"type": "integer",
294+
"description": [
295+
"The bias, positive being good and negative being bad (0 being no bias). Useful values are +/-1 through +/-10, though -100 through +100 are possible values."
296+
]
297+
},
298+
"description": {
299+
"type": "string",
300+
"description": [
301+
"Description/annotation to display in askrene-listlayers(7)"
302+
]
303+
}
304+
}
305+
},
306+
"response": {
307+
"required": [
308+
"biases"
309+
],
310+
"additionalProperties": false,
311+
"properties": {
312+
"biases": {
313+
"type": "array",
314+
"items": {
315+
"type": "object",
316+
"required": [
317+
"layer",
318+
"short_channel_id_dir",
319+
"bias"
320+
],
321+
"additionalProperties": false,
322+
"properties": {
323+
"layer": {
324+
"type": "string",
325+
"description": [
326+
"The name of the layer this bias applies to."
327+
]
328+
},
329+
"short_channel_id_dir": {
330+
"type": "short_channel_id_dir",
331+
"description": [
332+
"The short channel id and direction"
333+
]
334+
},
335+
"bias": {
336+
"type": "integer",
337+
"description": [
338+
"The bias (-100 to +100)"
339+
]
340+
},
341+
"description": {
342+
"type": "string",
343+
"description": [
344+
"The bias (-100 to +100)"
345+
]
346+
}
347+
}
348+
}
349+
}
350+
}
351+
},
352+
"see_also": [
353+
"lightning-getroutes(7)",
354+
"lightning-askrene-disable-node(7)",
355+
"lightning-askrene-create-channel(7)",
356+
"lightning-askrene-listlayers(7)",
357+
"lightning-askrene-age(7)"
358+
],
359+
"author": [
360+
"Rusty Russell <<[email protected]>> is mainly responsible."
361+
],
362+
"resources": [
363+
"Main web site: <https://github.com/ElementsProject/lightning>"
364+
]
365+
},
262366
"lightning-askrene-create-channel.json": {
263367
"$schema": "../rpc-schema-draft.json",
264368
"type": "object",
@@ -516,6 +620,37 @@
516620
}
517621
}
518622
}
623+
},
624+
"biases": {
625+
"type": "array",
626+
"items": {
627+
"type": "object",
628+
"required": [
629+
"short_channel_id_dir",
630+
"bias"
631+
],
632+
"additionalProperties": false,
633+
"properties": {
634+
"short_channel_id_dir": {
635+
"type": "short_channel_id_dir",
636+
"description": [
637+
"The short channel id and direction"
638+
]
639+
},
640+
"bias": {
641+
"type": "integer",
642+
"description": [
643+
"The bias (-100 to +100)"
644+
]
645+
},
646+
"description": {
647+
"type": "string",
648+
"description": [
649+
"The bias (-100 to +100)"
650+
]
651+
}
652+
}
653+
}
519654
}
520655
}
521656
}
@@ -896,6 +1031,37 @@
8961031
}
8971032
}
8981033
}
1034+
},
1035+
"biases": {
1036+
"type": "array",
1037+
"items": {
1038+
"type": "object",
1039+
"required": [
1040+
"short_channel_id_dir",
1041+
"bias"
1042+
],
1043+
"additionalProperties": false,
1044+
"properties": {
1045+
"short_channel_id_dir": {
1046+
"type": "short_channel_id_dir",
1047+
"description": [
1048+
"The short channel id and direction"
1049+
]
1050+
},
1051+
"bias": {
1052+
"type": "integer",
1053+
"description": [
1054+
"The bias (-100 to +100)"
1055+
]
1056+
},
1057+
"description": {
1058+
"type": "string",
1059+
"description": [
1060+
"The bias (-100 to +100)"
1061+
]
1062+
}
1063+
}
1064+
}
8991065
}
9001066
}
9011067
}
@@ -907,6 +1073,7 @@
9071073
"lightning-askrene-disable-node(7)",
9081074
"lightning-askrene-create-channel(7)",
9091075
"lightning-askrene-inform-channel(7)",
1076+
"lightning-askrene-bias-channel(7)",
9101077
"lightning-askrene-age(7)"
9111078
],
9121079
"author": [

doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ doc-wrongdir:
77
GENERATE_MARKDOWN := doc/lightning-addgossip.7 \
88
doc/lightning-addpsbtoutput.7 \
99
doc/lightning-askrene-age.7 \
10+
doc/lightning-askrene-bias-channel.7 \
1011
doc/lightning-askrene-create-layer.7 \
1112
doc/lightning-askrene-remove-layer.7 \
1213
doc/lightning-askrene-create-channel.7 \

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Core Lightning Documentation
1515
lightning-addgossip <lightning-addgossip.7.md>
1616
lightning-addpsbtoutput <lightning-addpsbtoutput.7.md>
1717
lightning-askrene-age <lightning-askrene-age.7.md>
18+
lightning-askrene-bias-channel <lightning-askrene-bias-channel.7.md>
1819
lightning-askrene-create-channel <lightning-askrene-create-channel.7.md>
1920
lightning-askrene-create-layer <lightning-askrene-create-layer.7.md>
2021
lightning-askrene-disable-node <lightning-askrene-disable-node.7.md>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"$schema": "../rpc-schema-draft.json",
3+
"type": "object",
4+
"rpc": "askrene-bias-channel",
5+
"title": "Command to apply a manual bias to a channel in a layer (EXPERIMENTAL)",
6+
"description": [
7+
"WARNING: experimental, so API may change.",
8+
"",
9+
"The **askrene-bias-channel** RPC command tells askrene to favor or disfavor a channel when considering it for routing."
10+
],
11+
"request": {
12+
"required": [
13+
"layer",
14+
"short_channel_id_dir",
15+
"bias"
16+
],
17+
"additionalProperties": false,
18+
"properties": {
19+
"layer": {
20+
"type": "string",
21+
"description": [
22+
"The name of the layer to apply this bias to."
23+
]
24+
},
25+
"short_channel_id_dir": {
26+
"type": "short_channel_id_dir",
27+
"description": [
28+
"The short channel id and direction to apply this bias to."
29+
]
30+
},
31+
"bias": {
32+
"type": "integer",
33+
"description": [
34+
"The bias, positive being good and negative being bad (0 being no bias). Useful values are +/-1 through +/-10, though -100 through +100 are possible values."
35+
]
36+
},
37+
"description": {
38+
"type": "string",
39+
"description": [
40+
"Description/annotation to display in askrene-listlayers(7)"
41+
]
42+
}
43+
}
44+
},
45+
"response": {
46+
"required": [
47+
"biases"
48+
],
49+
"additionalProperties": false,
50+
"properties": {
51+
"biases": {
52+
"type": "array",
53+
"items": {
54+
"type": "object",
55+
"required": [
56+
"layer",
57+
"short_channel_id_dir",
58+
"bias"
59+
],
60+
"additionalProperties": false,
61+
"properties": {
62+
"layer": {
63+
"type": "string",
64+
"description": [
65+
"The name of the layer this bias applies to."
66+
]
67+
},
68+
"short_channel_id_dir": {
69+
"type": "short_channel_id_dir",
70+
"description": [
71+
"The short channel id and direction"
72+
]
73+
},
74+
"bias": {
75+
"type": "integer",
76+
"description": [
77+
"The bias (-100 to +100)"
78+
]
79+
},
80+
"description": {
81+
"type": "string",
82+
"description": [
83+
"The bias (-100 to +100)"
84+
]
85+
}
86+
}
87+
}
88+
}
89+
}
90+
},
91+
"see_also": [
92+
"lightning-getroutes(7)",
93+
"lightning-askrene-disable-node(7)",
94+
"lightning-askrene-create-channel(7)",
95+
"lightning-askrene-listlayers(7)",
96+
"lightning-askrene-age(7)"
97+
],
98+
"author": [
99+
"Rusty Russell <<[email protected]>> is mainly responsible."
100+
],
101+
"resources": [
102+
"Main web site: <https://github.com/ElementsProject/lightning>"
103+
]
104+
}

doc/schemas/lightning-askrene-create-layer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,37 @@
182182
}
183183
}
184184
}
185+
},
186+
"biases": {
187+
"type": "array",
188+
"items": {
189+
"type": "object",
190+
"required": [
191+
"short_channel_id_dir",
192+
"bias"
193+
],
194+
"additionalProperties": false,
195+
"properties": {
196+
"short_channel_id_dir": {
197+
"type": "short_channel_id_dir",
198+
"description": [
199+
"The short channel id and direction"
200+
]
201+
},
202+
"bias": {
203+
"type": "integer",
204+
"description": [
205+
"The bias (-100 to +100)"
206+
]
207+
},
208+
"description": {
209+
"type": "string",
210+
"description": [
211+
"The bias (-100 to +100)"
212+
]
213+
}
214+
}
215+
}
185216
}
186217
}
187218
}

doc/schemas/lightning-askrene-listlayers.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,37 @@
191191
}
192192
}
193193
}
194+
},
195+
"biases": {
196+
"type": "array",
197+
"items": {
198+
"type": "object",
199+
"required": [
200+
"short_channel_id_dir",
201+
"bias"
202+
],
203+
"additionalProperties": false,
204+
"properties": {
205+
"short_channel_id_dir": {
206+
"type": "short_channel_id_dir",
207+
"description": [
208+
"The short channel id and direction"
209+
]
210+
},
211+
"bias": {
212+
"type": "integer",
213+
"description": [
214+
"The bias (-100 to +100)"
215+
]
216+
},
217+
"description": {
218+
"type": "string",
219+
"description": [
220+
"The bias (-100 to +100)"
221+
]
222+
}
223+
}
224+
}
194225
}
195226
}
196227
}
@@ -202,6 +233,7 @@
202233
"lightning-askrene-disable-node(7)",
203234
"lightning-askrene-create-channel(7)",
204235
"lightning-askrene-inform-channel(7)",
236+
"lightning-askrene-bias-channel(7)",
205237
"lightning-askrene-age(7)"
206238
],
207239
"author": [

0 commit comments

Comments
 (0)