mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
gossmap: fail to get capacity of locally-added chans (don't crash!).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -967,6 +967,10 @@ bool gossmap_chan_get_capacity(const struct gossmap *map,
|
|||||||
size_t off;
|
size_t off;
|
||||||
u16 type;
|
u16 type;
|
||||||
|
|
||||||
|
/* Fail for local channels */
|
||||||
|
if (c->cann_off >= map->map_size)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* For private, we need to go back WIRE_GOSSIP_STORE_PRIVATE_CHANNEL,
|
/* For private, we need to go back WIRE_GOSSIP_STORE_PRIVATE_CHANNEL,
|
||||||
* which is 8 (satoshis) + 2 (len) */
|
* which is 8 (satoshis) + 2 (len) */
|
||||||
if (c->private) {
|
if (c->private) {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ static inline bool gossmap_chan_set(const struct gossmap_chan *chan, int dir)
|
|||||||
return chan->cupdate_off[dir] != 0;
|
return chan->cupdate_off[dir] != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return capacity if it's known (fails only on race condition) */
|
/* Return capacity if it's known (fails only on race condition, or a local mod) */
|
||||||
bool gossmap_chan_get_capacity(const struct gossmap *map,
|
bool gossmap_chan_get_capacity(const struct gossmap *map,
|
||||||
const struct gossmap_chan *c,
|
const struct gossmap_chan *c,
|
||||||
struct amount_sat *amount);
|
struct amount_sat *amount);
|
||||||
|
|||||||
Reference in New Issue
Block a user