diff --git a/gossipd/broadcast.c b/gossipd/broadcast.c index 696d05e86..ae981c059 100644 --- a/gossipd/broadcast.c +++ b/gossipd/broadcast.c @@ -11,26 +11,24 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx) } static struct queued_message *new_queued_message(tal_t *ctx, - const int type, const u8 *tag, const u8 *payload) { struct queued_message *msg = tal(ctx, struct queued_message); - msg->type = type; msg->tag = tal_dup_arr(msg, u8, tag, tal_len(tag), 0); msg->payload = tal_dup_arr(msg, u8, payload, tal_len(payload), 0); return msg; } bool replace_broadcast(struct broadcast_state *bstate, u64 *index, - const int type, const u8 *tag, const u8 *payload) + const u8 *tag, const u8 *payload) { struct queued_message *msg; bool evicted = false; msg = uintmap_get(&bstate->broadcasts, *index); - if (msg && msg->type == type && - memeq(msg->tag, tal_len(msg->tag), tag, tal_len(tag))) { + if (msg) { + assert(memeq(msg->tag, tal_len(msg->tag), tag, tal_len(tag))); uintmap_del(&bstate->broadcasts, *index); tal_free(msg); evicted = true; @@ -38,7 +36,7 @@ bool replace_broadcast(struct broadcast_state *bstate, u64 *index, *index = bstate->next_index; /* Now add the message to the queue */ - msg = new_queued_message(bstate, type, tag, payload); + msg = new_queued_message(bstate, tag, payload); uintmap_add(&bstate->broadcasts, *index, msg); bstate->next_index++; return evicted; diff --git a/gossipd/broadcast.h b/gossipd/broadcast.h index cfec0924d..9da74d36f 100644 --- a/gossipd/broadcast.h +++ b/gossipd/broadcast.h @@ -10,8 +10,6 @@ /* Common functionality to implement staggered broadcasts with replacement. */ struct queued_message { - int type; - /* Unique tag specifying the msg origin */ void *tag; @@ -32,7 +30,6 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx); * newly queued message*/ bool replace_broadcast(struct broadcast_state *bstate, u64 *index, - const int type, const u8 *tag, const u8 *payload); diff --git a/gossipd/routing.c b/gossipd/routing.c index 57c72ff80..badad2f83 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -818,7 +818,6 @@ bool handle_pending_cannouncement(struct routing_state *rstate, if (replace_broadcast(rstate->broadcasts, &chan->channel_announce_msgidx, - WIRE_CHANNEL_ANNOUNCEMENT, tag, pending->announce)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Announcement %s was replaced?", @@ -1005,9 +1004,8 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update) towire_u16(&tag, direction); replace_broadcast(rstate->broadcasts, &chan->half[direction].channel_update_msgidx, - WIRE_CHANNEL_UPDATE, - tag, - serialized); + tag, + serialized); tal_free(c->channel_update); c->channel_update = tal_steal(chan, serialized); @@ -1194,7 +1192,6 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann) towire_pubkey(&tag, &node_id); replace_broadcast(rstate->broadcasts, &node->announcement_idx, - WIRE_NODE_ANNOUNCEMENT, tag, serialized); tal_free(node->node_announcement); diff --git a/gossipd/test/run-bench-find_route.c b/gossipd/test/run-bench-find_route.c index b29b8d314..6820f6078 100644 --- a/gossipd/test/run-bench-find_route.c +++ b/gossipd/test/run-bench-find_route.c @@ -64,9 +64,6 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature * /* Generated stub for fromwire_node_announcement */ bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED) { fprintf(stderr, "fromwire_node_announcement called!\n"); abort(); } -/* Generated stub for fromwire_peektype */ -int fromwire_peektype(const u8 *cursor UNNEEDED) -{ fprintf(stderr, "fromwire_peektype called!\n"); abort(); } /* Generated stub for fromwire_u8 */ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u8 called!\n"); abort(); } @@ -79,7 +76,6 @@ const char *onion_type_name(int e UNNEEDED) /* Generated stub for replace_broadcast */ bool replace_broadcast(struct broadcast_state *bstate UNNEEDED, u64 *index UNNEEDED, - const int type UNNEEDED, const u8 *tag UNNEEDED, const u8 *payload UNNEEDED) { fprintf(stderr, "replace_broadcast called!\n"); abort(); } diff --git a/gossipd/test/run-find_route-specific.c b/gossipd/test/run-find_route-specific.c index 9005ce8a1..cb18ff315 100644 --- a/gossipd/test/run-find_route-specific.c +++ b/gossipd/test/run-find_route-specific.c @@ -28,9 +28,6 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature * /* Generated stub for fromwire_node_announcement */ bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED) { fprintf(stderr, "fromwire_node_announcement called!\n"); abort(); } -/* Generated stub for fromwire_peektype */ -int fromwire_peektype(const u8 *cursor UNNEEDED) -{ fprintf(stderr, "fromwire_peektype called!\n"); abort(); } /* Generated stub for fromwire_u8 */ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u8 called!\n"); abort(); } @@ -43,7 +40,6 @@ const char *onion_type_name(int e UNNEEDED) /* Generated stub for replace_broadcast */ bool replace_broadcast(struct broadcast_state *bstate UNNEEDED, u64 *index UNNEEDED, - const int type UNNEEDED, const u8 *tag UNNEEDED, const u8 *payload UNNEEDED) { fprintf(stderr, "replace_broadcast called!\n"); abort(); } diff --git a/gossipd/test/run-find_route.c b/gossipd/test/run-find_route.c index da9951799..381272cf8 100644 --- a/gossipd/test/run-find_route.c +++ b/gossipd/test/run-find_route.c @@ -26,9 +26,6 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature * /* Generated stub for fromwire_node_announcement */ bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED) { fprintf(stderr, "fromwire_node_announcement called!\n"); abort(); } -/* Generated stub for fromwire_peektype */ -int fromwire_peektype(const u8 *cursor UNNEEDED) -{ fprintf(stderr, "fromwire_peektype called!\n"); abort(); } /* Generated stub for fromwire_u8 */ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u8 called!\n"); abort(); } @@ -41,7 +38,6 @@ const char *onion_type_name(int e UNNEEDED) /* Generated stub for replace_broadcast */ bool replace_broadcast(struct broadcast_state *bstate UNNEEDED, u64 *index UNNEEDED, - const int type UNNEEDED, const u8 *tag UNNEEDED, const u8 *payload UNNEEDED) { fprintf(stderr, "replace_broadcast called!\n"); abort(); }