diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 11fc69317..f68d5c00b 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -432,7 +432,7 @@ static void send_node_announcement(struct daemon *daemon) * from the HSM, create the real announcement and forward it to * gossipd so it can take care of forwarding it. */ nannounce = create_node_announcement(tmpctx, daemon, &sig, timestamp); - handle_node_announcement(daemon->rstate, take(nannounce), tal_len(nannounce)); + handle_node_announcement(daemon->rstate, take(nannounce)); tal_free(tmpctx); } @@ -445,17 +445,17 @@ static void handle_gossip_msg(struct daemon *daemon, u8 *msg) /* Add the channel_announcement to the routing state, * it'll tell us whether this is local and signed, so * we can hand in a node_announcement as well. */ - if(handle_channel_announcement(rstate, msg, tal_count(msg))) { + if(handle_channel_announcement(rstate, msg)) { send_node_announcement(daemon); } break; case WIRE_NODE_ANNOUNCEMENT: - handle_node_announcement(rstate, msg, tal_count(msg)); + handle_node_announcement(rstate, msg); break; case WIRE_CHANNEL_UPDATE: - handle_channel_update(rstate, msg, tal_count(msg)); + handle_channel_update(rstate, msg); break; } } diff --git a/gossipd/routing.c b/gossipd/routing.c index 3911569ca..a02361f48 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -467,7 +467,7 @@ static bool check_channel_announcement( bool handle_channel_announcement( struct routing_state *rstate, - const u8 *announce, size_t len) + const u8 *announce) { u8 *serialized; bool forward = false, local, sigfail; @@ -484,6 +484,7 @@ bool handle_channel_announcement( struct node_connection *c0, *c1; const tal_t *tmpctx = tal_tmpctx(rstate); u8 *features; + size_t len = tal_len(announce); serialized = tal_dup_arr(tmpctx, u8, announce, len, 0); if (!fromwire_channel_announcement(tmpctx, serialized, NULL, @@ -563,7 +564,7 @@ bool handle_channel_announcement( return local; } -void handle_channel_update(struct routing_state *rstate, const u8 *update, size_t len) +void handle_channel_update(struct routing_state *rstate, const u8 *update) { u8 *serialized; struct node_connection *c; @@ -577,6 +578,7 @@ void handle_channel_update(struct routing_state *rstate, const u8 *update, size_ u32 fee_proportional_millionths; const tal_t *tmpctx = tal_tmpctx(rstate); struct sha256_double chain_hash; + size_t len = tal_len(update); serialized = tal_dup_arr(tmpctx, u8, update, len, 0); if (!fromwire_channel_update(serialized, NULL, &signature, @@ -684,7 +686,7 @@ static struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser) } void handle_node_announcement( - struct routing_state *rstate, const u8 *node_ann, size_t len) + struct routing_state *rstate, const u8 *node_ann) { u8 *serialized; struct sha256_double hash; @@ -697,6 +699,7 @@ void handle_node_announcement( u8 *features, *addresses; const tal_t *tmpctx = tal_tmpctx(rstate); struct wireaddr *wireaddrs; + size_t len = tal_len(node_ann); serialized = tal_dup_arr(tmpctx, u8, node_ann, len, 0); if (!fromwire_node_announcement(tmpctx, serialized, NULL, diff --git a/gossipd/routing.h b/gossipd/routing.h index 8a931333a..c35741a94 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -128,9 +128,9 @@ struct node_connection *get_connection_by_scid(const struct routing_state *rstat * means that if we haven't sent a node_announcement just yet, now * would be a good time. */ -bool handle_channel_announcement(struct routing_state *rstate, const u8 *announce, size_t len); -void handle_channel_update(struct routing_state *rstate, const u8 *update, size_t len); -void handle_node_announcement(struct routing_state *rstate, const u8 *node, size_t len); +bool handle_channel_announcement(struct routing_state *rstate, const u8 *announce); +void handle_channel_update(struct routing_state *rstate, const u8 *update); +void handle_node_announcement(struct routing_state *rstate, const u8 *node); /* Compute a route to a destination, for a given amount and riskfactor. */ struct route_hop *get_route(tal_t *ctx, struct routing_state *rstate,