|
@ -1285,9 +1285,7 @@ static struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser) |
|
|
return wireaddrs; |
|
|
return wireaddrs; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool routing_add_node_announcement(struct routing_state *rstate, |
|
|
bool routing_add_node_announcement(struct routing_state *rstate, const u8 *msg TAKES) |
|
|
const u8 *msg TAKES, |
|
|
|
|
|
bool *unknown_node) |
|
|
|
|
|
{ |
|
|
{ |
|
|
struct node *node; |
|
|
struct node *node; |
|
|
secp256k1_ecdsa_signature signature; |
|
|
secp256k1_ecdsa_signature signature; |
|
@ -1301,21 +1299,15 @@ bool routing_add_node_announcement(struct routing_state *rstate, |
|
|
if (!fromwire_node_announcement(tmpctx, msg, |
|
|
if (!fromwire_node_announcement(tmpctx, msg, |
|
|
&signature, &features, ×tamp, |
|
|
&signature, &features, ×tamp, |
|
|
&node_id, rgb_color, alias, |
|
|
&node_id, rgb_color, alias, |
|
|
&addresses)) { |
|
|
&addresses)) |
|
|
if (unknown_node) |
|
|
|
|
|
*unknown_node = false; |
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
node = get_node(rstate, &node_id); |
|
|
node = get_node(rstate, &node_id); |
|
|
|
|
|
|
|
|
/* May happen if we accepted the node_announcement due to a local
|
|
|
/* May happen if we accepted the node_announcement due to a local
|
|
|
* channel, for which we didn't have the announcement yet. */ |
|
|
* channel, for which we didn't have the announcement yet. */ |
|
|
if (node == NULL) { |
|
|
if (node == NULL) |
|
|
if (unknown_node) |
|
|
|
|
|
*unknown_node = true; |
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wireaddrs = read_addresses(tmpctx, addresses); |
|
|
wireaddrs = read_addresses(tmpctx, addresses); |
|
|
tal_free(node->addresses); |
|
|
tal_free(node->addresses); |
|
@ -1468,7 +1460,7 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann) |
|
|
status_trace("Received node_announcement for node %s", |
|
|
status_trace("Received node_announcement for node %s", |
|
|
type_to_string(tmpctx, struct pubkey, &node_id)); |
|
|
type_to_string(tmpctx, struct pubkey, &node_id)); |
|
|
|
|
|
|
|
|
applied = routing_add_node_announcement(rstate, serialized, NULL); |
|
|
applied = routing_add_node_announcement(rstate, serialized); |
|
|
assert(applied); |
|
|
assert(applied); |
|
|
return NULL; |
|
|
return NULL; |
|
|
} |
|
|
} |
|
|