mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +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:
parent
2da5244e83
commit
6a48ed9e82
2 changed files with 5 additions and 1 deletions
|
@ -967,6 +967,10 @@ bool gossmap_chan_get_capacity(const struct gossmap *map,
|
|||
size_t off;
|
||||
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,
|
||||
* which is 8 (satoshis) + 2 (len) */
|
||||
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 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,
|
||||
const struct gossmap_chan *c,
|
||||
struct amount_sat *amount);
|
||||
|
|
Loading…
Add table
Reference in a new issue