gossmap: include cltv_expiry_delta in gossmap_chan_get_update_details for completeness.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-10-11 21:30:38 +10:30
parent 22e7a57557
commit 4ee9d1d2f2
13 changed files with 28 additions and 19 deletions

View File

@ -1485,6 +1485,7 @@ void gossmap_chan_get_update_details(const struct gossmap *map,
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,
@ -1511,6 +1512,8 @@ void gossmap_chan_get_update_details(const struct gossmap *map,
*channel_flags = map_u8(map, channel_flags_off);
if (message_flags)
*message_flags = map_u8(map, message_flags_off);
if (cltv_expiry_delta)
*cltv_expiry_delta = map_be16(map, cltv_expiry_delta_off);
if (fee_base_msat)
*fee_base_msat = map_be32(map, fee_base_off);
if (fee_proportional_millionths)

View File

@ -230,6 +230,7 @@ void gossmap_chan_get_update_details(const struct gossmap *map,
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,

View File

@ -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;
@ -345,6 +346,7 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
@ -352,6 +354,7 @@ int main(int argc, char *argv[])
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)));
@ -362,6 +365,7 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
@ -369,6 +373,7 @@ int main(int argc, char *argv[])
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)));

View File

@ -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;
@ -375,6 +376,7 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
@ -382,6 +384,7 @@ int main(int argc, char *argv[])
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)));
@ -392,6 +395,7 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
@ -399,6 +403,7 @@ int main(int argc, char *argv[])
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)));
@ -409,6 +414,7 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
@ -416,6 +422,7 @@ int main(int argc, char *argv[])
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)));
@ -426,6 +433,7 @@ int main(int argc, char *argv[])
&timestamp,
&message_flags,
&channel_flags,
&cltv_expiry_delta,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,
@ -433,6 +441,7 @@ int main(int argc, char *argv[])
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)));

View File

@ -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;
}

View File

@ -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,

View File

@ -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 */
}
@ -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)) {
@ -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;
}
@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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,

View File

@ -84,12 +84,6 @@ void json_add_amount_msat(struct json_stream *result UNNEEDED,
struct amount_msat msat)
{ fprintf(stderr, "json_add_amount_msat called!\n"); abort(); }
/* Generated stub for json_add_amount_sat */
void json_add_amount_sat(struct json_stream *result UNNEEDED,
const char *satfieldname UNNEEDED,
struct amount_sat sat)
{ fprintf(stderr, "json_add_amount_sat called!\n"); abort(); }
/* Generated stub for json_add_bool */
void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
bool value UNNEEDED)

View File

@ -81,12 +81,6 @@ void json_add_amount_msat(struct json_stream *result UNNEEDED,
struct amount_msat msat)
{ fprintf(stderr, "json_add_amount_msat called!\n"); abort(); }
/* Generated stub for json_add_amount_sat */
void json_add_amount_sat(struct json_stream *result UNNEEDED,
const char *satfieldname UNNEEDED,
struct amount_sat sat)
{ fprintf(stderr, "json_add_amount_sat called!\n"); abort(); }
/* Generated stub for json_add_bool */
void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
bool value UNNEEDED)

View File

@ -279,6 +279,7 @@ static void json_add_halfchan(struct json_stream *response,
&timestamp,
&message_flags,
&channel_flags,
NULL,
&fee_base_msat,
&fee_proportional_millionths,
&htlc_minimum_msat,