mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
routing: don't store node_announce unannounced nodes.
We enter nodes in the map when we create channels, but those channels could be local and unannounced. This triggered a failure in test_gossip_persistence since the store truncated when it saw the first thing was a node_announce. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
957513666c
commit
4aca909acb
@@ -1099,6 +1099,14 @@ bool routing_add_node_announcement(struct routing_state *rstate, const u8 *msg T
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool node_has_public_channels(struct node *node)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < tal_count(node->chans); i++)
|
||||||
|
if (node->chans[i]->public)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
|
u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
|
||||||
{
|
{
|
||||||
u8 *serialized;
|
u8 *serialized;
|
||||||
@@ -1187,6 +1195,8 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
|
|||||||
/* Beyond this point it's not malformed, so safe if we make it
|
/* Beyond this point it's not malformed, so safe if we make it
|
||||||
* pending and requeue later. */
|
* pending and requeue later. */
|
||||||
node = get_node(rstate, &node_id);
|
node = get_node(rstate, &node_id);
|
||||||
|
if (node && !node_has_public_channels(node))
|
||||||
|
node = NULL;
|
||||||
|
|
||||||
/* Check if we are currently verifying the txout for a
|
/* Check if we are currently verifying the txout for a
|
||||||
* matching channel */
|
* matching channel */
|
||||||
|
|||||||
Reference in New Issue
Block a user