mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
gossmap: fix reutrn of gossmap_xxx_has_feature, rename.
1. One place returned false instead of -1. 2. The names implied it returned a bool, and it doesn't. Fix both, and curse C's loose typing a little. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -140,7 +140,7 @@ static int map_feature_test(const struct gossmap *map,
|
|||||||
|
|
||||||
assert(COMPULSORY_FEATURE(compulsory_bit) == compulsory_bit);
|
assert(COMPULSORY_FEATURE(compulsory_bit) == compulsory_bit);
|
||||||
if (bytenum >= len)
|
if (bytenum >= len)
|
||||||
return false;
|
return -1;
|
||||||
|
|
||||||
/* Note reversed! */
|
/* Note reversed! */
|
||||||
bits = map_u8(map, offset + len - 1 - bytenum);
|
bits = map_u8(map, offset + len - 1 - bytenum);
|
||||||
@@ -876,7 +876,7 @@ u8 *gossmap_node_get_announce(const tal_t *ctx,
|
|||||||
* * [`point`:`node_id_1`]
|
* * [`point`:`node_id_1`]
|
||||||
* * [`point`:`node_id_2`]
|
* * [`point`:`node_id_2`]
|
||||||
*/
|
*/
|
||||||
int gossmap_chan_has_feature(const struct gossmap *map,
|
int gossmap_chan_get_feature(const struct gossmap *map,
|
||||||
const struct gossmap_chan *c,
|
const struct gossmap_chan *c,
|
||||||
int fbit)
|
int fbit)
|
||||||
{
|
{
|
||||||
@@ -903,7 +903,7 @@ int gossmap_chan_has_feature(const struct gossmap *map,
|
|||||||
* * [`u16`:`addrlen`]
|
* * [`u16`:`addrlen`]
|
||||||
* * [`addrlen*byte`:`addresses`]
|
* * [`addrlen*byte`:`addresses`]
|
||||||
*/
|
*/
|
||||||
int gossmap_node_has_feature(const struct gossmap *map,
|
int gossmap_node_get_feature(const struct gossmap *map,
|
||||||
const struct gossmap_node *n,
|
const struct gossmap_node *n,
|
||||||
int fbit)
|
int fbit)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,12 +90,12 @@ u8 *gossmap_node_get_announce(const tal_t *ctx,
|
|||||||
const struct gossmap_node *n);
|
const struct gossmap_node *n);
|
||||||
|
|
||||||
/* Return the feature bit (odd or even), or -1 if neither. */
|
/* Return the feature bit (odd or even), or -1 if neither. */
|
||||||
int gossmap_chan_has_feature(const struct gossmap *map,
|
int gossmap_chan_get_feature(const struct gossmap *map,
|
||||||
const struct gossmap_chan *c,
|
const struct gossmap_chan *c,
|
||||||
int fbit);
|
int fbit);
|
||||||
|
|
||||||
/* Return the feature bit (odd or even), or -1 if neither (or no announcement) */
|
/* Return the feature bit (odd or even), or -1 if neither (or no announcement) */
|
||||||
int gossmap_node_has_feature(const struct gossmap *map,
|
int gossmap_node_get_feature(const struct gossmap *map,
|
||||||
const struct gossmap_node *n,
|
const struct gossmap_node *n,
|
||||||
int fbit);
|
int fbit);
|
||||||
|
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ static struct route_hop *route_hops_from_route(const tal_t *ctx,
|
|||||||
/* nodeid is nodeid of *dst* */
|
/* nodeid is nodeid of *dst* */
|
||||||
dst = gossmap_nth_node(gossmap, r[i]->c, !r[i]->dir);
|
dst = gossmap_nth_node(gossmap, r[i]->c, !r[i]->dir);
|
||||||
gossmap_node_get_id(gossmap, dst, &hops[i].nodeid);
|
gossmap_node_get_id(gossmap, dst, &hops[i].nodeid);
|
||||||
if (gossmap_node_has_feature(gossmap, dst, OPT_VAR_ONION) != -1)
|
if (gossmap_node_get_feature(gossmap, dst, OPT_VAR_ONION) != -1)
|
||||||
hops[i].style = ROUTE_HOP_TLV;
|
hops[i].style = ROUTE_HOP_TLV;
|
||||||
else
|
else
|
||||||
hops[i].style = ROUTE_HOP_LEGACY;
|
hops[i].style = ROUTE_HOP_LEGACY;
|
||||||
|
|||||||
Reference in New Issue
Block a user