mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
paymod: Add invariant verification for constraints on shadowroute
This was highlighted in #3851, so I added an assertion. After the rewrite in the next commit we would simply skip if any of the constraints were not maintained, but this serves as the canary in the coalmine, so we don't paper over.
This commit is contained in:
committed by
Rusty Russell
parent
157e70ffe8
commit
c0d70cdfc7
@@ -1784,6 +1784,11 @@ static struct command_result *shadow_route_listchannels(struct command *cmd,
|
|||||||
const jsmntok_t *sattok, *delaytok, *basefeetok, *propfeetok, *desttok,
|
const jsmntok_t *sattok, *delaytok, *basefeetok, *propfeetok, *desttok,
|
||||||
*channelstok, *chan;
|
*channelstok, *chan;
|
||||||
|
|
||||||
|
/* Check the invariants on the constraints between payment and modifier. */
|
||||||
|
assert(d->constraints.cltv_budget <= p->constraints.cltv_budget / 4);
|
||||||
|
assert(amount_msat_greater_eq(p->constraints.fee_budget,
|
||||||
|
d->constraints.fee_budget));
|
||||||
|
|
||||||
channelstok = json_get_member(buf, result, "channels");
|
channelstok = json_get_member(buf, result, "channels");
|
||||||
json_for_each_arr(i, chan, channelstok) {
|
json_for_each_arr(i, chan, channelstok) {
|
||||||
u64 v = pseudorand(UINT64_MAX);
|
u64 v = pseudorand(UINT64_MAX);
|
||||||
|
|||||||
Reference in New Issue
Block a user