Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e5a57d4
pyln-testing: understand `gossip_store_file` arg in get_nodes.
rustyrussell Oct 8, 2024
23fc792
askrene: give notifications back to caller as we go.
rustyrussell Oct 11, 2024
a79e5d6
askrene: populate auto.localchans layer properly.
rustyrussell Oct 11, 2024
ea074bf
askrene: make `auto.sourcefree` a real layer, too.
rustyrussell Oct 11, 2024
e7ac294
gossmap: include cltv_expiry_delta in gossmap_chan_get_update_details…
rustyrussell Oct 11, 2024
373e45e
gossmap: allow gossmap_chan_get_update_details on locally-modified ch…
rustyrussell Oct 11, 2024
19ee27c
askrene: constrain to exact htlc_min/htlc_max values.
rustyrussell Oct 11, 2024
9f8c0be
askrene: don't give up if we hit htlc_max and have no other flows.
rustyrussell Oct 11, 2024
8b2bd8b
askrene: detect and cancel flow cycles
Lagrang3 Oct 11, 2024
f895a26
askrene: don't use tmpctx in minflow()
rustyrussell Oct 11, 2024
3b019e2
pytest: test askrene on real network data.
rustyrussell Oct 11, 2024
302fde5
pytest: test askrene with worse maxfee argument.
rustyrussell Oct 11, 2024
ff7dbdf
mcf: simplify mu -> cost translation.
rustyrussell Oct 11, 2024
514c2c4
askrene: calculate prob_cost_factor using ratio of typical mainnet ch…
rustyrussell Oct 11, 2024
545146f
askrene: fix base fee.
rustyrussell Oct 11, 2024
5763c7d
askrene: debug and check we actually reduce fees when mu increase.
rustyrussell Oct 11, 2024
6786294
askrene: calculate `k` value dynamically, using medians.
rustyrussell Oct 12, 2024
948466e
askrene: don't *completely* ignore fees to start.
rustyrussell Oct 12, 2024
8b83d12
askrene: fix bug with reservations used during refinement.
rustyrussell Oct 12, 2024
2fd767c
askrene: use refine step to calculate flowset probability.
rustyrussell Oct 12, 2024
2eb37d7
askrene: remove flowset_probability() now refine step calculates it.
rustyrussell Oct 12, 2024
2d3c004
askrene: more logging in explain_failure.
rustyrussell Oct 12, 2024
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
292 changes: 179 additions & 113 deletions common/gossmap.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions common/gossmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ u8 *gossmap_chan_get_update(const tal_t *ctx,
bool gossmap_scidd_pubkey(struct gossmap *gossmap,
struct sciddir_or_pubkey *sciddpk);

/* Returns details from channel_update (must be gossmap_chan_set, and
* does not work for local_updatechan)! */
/* Returns details from channel_update (must be gossmap_chan_set)! */
void gossmap_chan_get_update_details(const struct gossmap *map,
const struct gossmap_chan *chan,
int dir,
u32 *timestamp,
u8 *message_flags,
u8 *channel_flags,
u16 *cltv_expiry_delta,
u32 *fee_base_msat,
u32 *fee_proportional_millionths,
struct amount_msat *htlc_minimum_msat,
Expand Down
5 changes: 5 additions & 0 deletions common/test/run-gossmap_canned.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ int main(int argc, char *argv[])
struct amount_msat capacity;
u32 timestamp, fee_base_msat, fee_proportional_millionths;
u8 message_flags, channel_flags;
u16 cltv_expiry_delta;
struct amount_msat htlc_minimum_msat, htlc_maximum_msat;
u8 *cann;

Expand Down Expand Up @@ -345,13 +346,15 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115313);
assert(message_flags == 1);
assert(channel_flags == 0);
assert(cltv_expiry_delta == 6);
assert(fee_base_msat == 20);
assert(fee_proportional_millionths == 1000);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
Expand All @@ -362,13 +365,15 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115313);
assert(message_flags == 1);
assert(channel_flags == 1);
assert(cltv_expiry_delta == 6);
assert(fee_base_msat == 20);
assert(fee_proportional_millionths == 1000);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
Expand Down
49 changes: 49 additions & 0 deletions common/test/run-gossmap_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ int main(int argc, char *argv[])
struct gossmap_localmods *mods;
struct amount_msat capacity;
u32 timestamp, fee_base_msat, fee_proportional_millionths;
u16 cltv_expiry_delta;
u8 message_flags, channel_flags;
struct amount_msat htlc_minimum_msat, htlc_maximum_msat;
u8 *cann, *nann;
Expand Down Expand Up @@ -375,13 +376,15 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115301);
assert(message_flags == 1);
assert(channel_flags == 0);
assert(cltv_expiry_delta == 6);
assert(fee_base_msat == 20);
assert(fee_proportional_millionths == 1000);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
Expand All @@ -392,13 +395,15 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115311);
assert(message_flags == 1);
assert(channel_flags == 1);
assert(cltv_expiry_delta == 6);
assert(fee_base_msat == 20);
assert(fee_proportional_millionths == 1000);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
Expand All @@ -409,13 +414,15 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115313);
assert(message_flags == 1);
assert(channel_flags == 0);
assert(cltv_expiry_delta == 6);
assert(fee_base_msat == 20);
assert(fee_proportional_millionths == 1000);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
Expand All @@ -426,13 +433,15 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115313);
assert(message_flags == 1);
assert(channel_flags == 1);
assert(cltv_expiry_delta == 6);
assert(fee_base_msat == 20);
assert(fee_proportional_millionths == 1000);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
Expand Down Expand Up @@ -519,6 +528,26 @@ int main(int argc, char *argv[])
assert(chan->half[0].proportional_fee == 3);
assert(chan->half[0].delay == 4);

/* We can query update_details on locally-generated chans */
gossmap_chan_get_update_details(map, chan,
0,
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 0);
assert(message_flags == ROUTING_OPT_HTLC_MAX_MSAT);
assert(channel_flags == 0);
assert(cltv_expiry_delta == 4);
assert(fee_base_msat == 2);
assert(fee_proportional_millionths == 3);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(1)));
assert(amount_msat_eq(htlc_maximum_msat, AMOUNT_MSAT(100000)));

assert(!gossmap_find_chan(map, &scid_nonexisting));

chan = gossmap_find_chan(map, &scid23);
Expand All @@ -529,6 +558,26 @@ int main(int argc, char *argv[])
assert(chan->half[0].proportional_fee == 102);
assert(chan->half[0].delay == 103);

/* We can query update_details on locally-modified chans */
gossmap_chan_get_update_details(map, chan,
0,
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
&htlc_maximum_msat);
assert(timestamp == 1700115301);
assert(message_flags == ROUTING_OPT_HTLC_MAX_MSAT);
assert(channel_flags == 0);
assert(cltv_expiry_delta == 103);
assert(fee_base_msat == 101);
assert(fee_proportional_millionths == 102);
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(99)));
assert(amount_msat_eq(htlc_maximum_msat, AMOUNT_MSAT(100)));

/* Cleanup leaves everything previous intact */
gossmap_remove_localmods(map, mods);

Expand Down
2 changes: 1 addition & 1 deletion connectd/queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ static u32 get_timestamp(struct gossmap *gossmap,
return 0;

gossmap_chan_get_update_details(gossmap, chan, dir, &timestamp,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return timestamp;
}

Expand Down
1 change: 1 addition & 0 deletions connectd/test/run-crc32_of_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ void gossmap_chan_get_update_details(const struct gossmap *map UNNEEDED,
u32 *timestamp UNNEEDED,
u8 *message_flags UNNEEDED,
u8 *channel_flags UNNEEDED,
u16 *cltv_expiry_delta UNNEEDED,
u32 *fee_base_msat UNNEEDED,
u32 *fee_proportional_millionths UNNEEDED,
struct amount_msat *htlc_minimum_msat UNNEEDED,
Expand Down
2 changes: 1 addition & 1 deletion contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14647,7 +14647,7 @@
"",
"Layers are generally maintained by plugins, either to contain persistent information about capacities which have been discovered, or to contain transient information for this particular payment (such as blinded paths or routehints).",
"",
"There are two automatic layers: *auto.localchans* contains information on local channels from this node (including non-public ones), and their exact current spendable capacities, and *auto.sourcefree* overrides all channels leading out of the *source* to be zero fee and zero delay. These are both useful in the case where the source is the current node."
"There are two automatic layers: *auto.localchans* contains information on local channels from this node (including non-public ones), and their exact current spendable capacities, and *auto.sourcefree* overrides all channels (including those from previous layers) leading out of the *source* to be zero fee and zero delay. These are both useful in the case where the source is the current node."
],
"categories": [
"readonly"
Expand Down
1 change: 1 addition & 0 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,7 @@ def split_options(self, opts):
'wait_for_bitcoind_sync',
'allow_bad_gossip',
'start',
'gossip_store_file',
]
node_opts = {k: v for k, v in opts.items() if k in node_opt_keys}
cli_opts = {k: v for k, v in opts.items() if k not in node_opt_keys}
Expand Down
8 changes: 4 additions & 4 deletions devtools/gossmap-compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static u64 get_htlc_min(struct gossmap *gossmap,
{
struct amount_msat msat;
gossmap_chan_get_update_details(gossmap, chan, dir,
NULL, NULL, NULL, NULL, NULL, &msat, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, &msat, NULL);
return msat.millisatoshis; /* Raw: compressed format */
}

Expand All @@ -237,7 +237,7 @@ static u64 get_htlc_max(struct gossmap *gossmap,

capacity_msat = gossmap_chan_get_capacity(gossmap, chan);
gossmap_chan_get_update_details(gossmap, chan, dir,
NULL, NULL, NULL, NULL, NULL, NULL, &msat);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, &msat);

/* Special value for the common case of "max_htlc == capacity" */
if (amount_msat_eq(msat, capacity_msat)) {
Expand All @@ -257,7 +257,7 @@ static u64 get_basefee(struct gossmap *gossmap,
{
u32 basefee;
gossmap_chan_get_update_details(gossmap, chan, dir,
NULL, NULL, NULL, &basefee, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, &basefee, NULL, NULL, NULL);
return basefee;
}

Expand All @@ -267,7 +267,7 @@ static u64 get_propfee(struct gossmap *gossmap,
{
u32 propfee;
gossmap_chan_get_update_details(gossmap, chan, dir,
NULL, NULL, NULL, NULL, &propfee, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, &propfee, NULL, NULL);
return propfee;
}

Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/lightning-getroutes.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"",
"Layers are generally maintained by plugins, either to contain persistent information about capacities which have been discovered, or to contain transient information for this particular payment (such as blinded paths or routehints).",
"",
"There are two automatic layers: *auto.localchans* contains information on local channels from this node (including non-public ones), and their exact current spendable capacities, and *auto.sourcefree* overrides all channels leading out of the *source* to be zero fee and zero delay. These are both useful in the case where the source is the current node."
"There are two automatic layers: *auto.localchans* contains information on local channels from this node (including non-public ones), and their exact current spendable capacities, and *auto.sourcefree* overrides all channels (including those from previous layers) leading out of the *source* to be zero fee and zero delay. These are both useful in the case where the source is the current node."
],
"categories": [
"readonly"
Expand Down
2 changes: 1 addition & 1 deletion gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static u32 get_timestamp(struct gossmap *gossmap,

gossmap_chan_get_update_details(gossmap, chan, dir,
&timestamp,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return timestamp;
}

Expand Down
2 changes: 1 addition & 1 deletion gossipd/seeker.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ static bool want_update(struct gossmap *gossmap,
return timestamp != 0;

gossmap_chan_get_update_details(gossmap, chan, dir, &our_timestamp,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (timestamp <= our_timestamp)
return false;

Expand Down
1 change: 1 addition & 0 deletions gossipd/test/run-next_block_range.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void gossmap_chan_get_update_details(const struct gossmap *map UNNEEDED,
u32 *timestamp UNNEEDED,
u8 *message_flags UNNEEDED,
u8 *channel_flags UNNEEDED,
u16 *cltv_expiry_delta UNNEEDED,
u32 *fee_base_msat UNNEEDED,
u32 *fee_proportional_millionths UNNEEDED,
struct amount_msat *htlc_minimum_msat UNNEEDED,
Expand Down
Loading
Loading