mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
gossipd: implement broadcast_del to delete a specific index.
Required if we want to reorder node_announcement broadcasts. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a38c619486
commit
def18a7bc1
@ -21,10 +21,16 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx)
|
||||
return bstate;
|
||||
}
|
||||
|
||||
void broadcast_del(struct broadcast_state *bstate, u64 index, const u8 *payload)
|
||||
{
|
||||
const struct queued_message *q = uintmap_del(&bstate->broadcasts, index);
|
||||
assert(q->payload == payload);
|
||||
}
|
||||
|
||||
static void destroy_queued_message(struct queued_message *msg,
|
||||
struct broadcast_state *bstate)
|
||||
{
|
||||
uintmap_del(&bstate->broadcasts, msg->index);
|
||||
broadcast_del(bstate, msg->index, msg->payload);
|
||||
}
|
||||
|
||||
static struct queued_message *new_queued_message(const tal_t *ctx,
|
||||
|
@ -20,6 +20,9 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx);
|
||||
u64 insert_broadcast(struct broadcast_state *bstate, const u8 *msg,
|
||||
u32 timestamp);
|
||||
|
||||
/* Manually delete a broadcast: not usually needed, since destructor does it */
|
||||
void broadcast_del(struct broadcast_state *bstate, u64 index, const u8 *payload);
|
||||
|
||||
/* Return the broadcast with index >= *last_index, timestamp >= min and <= max
|
||||
* and update *last_index.
|
||||
* There's no broadcast with index 0. */
|
||||
|
@ -56,6 +56,9 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx UNNEEDED)
|
||||
}
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for broadcast_del */
|
||||
void broadcast_del(struct broadcast_state *bstate UNNEEDED, u64 index UNNEEDED, const u8 *payload UNNEEDED)
|
||||
{ fprintf(stderr, "broadcast_del called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_announcement */
|
||||
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
||||
|
@ -20,6 +20,9 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx UNNEEDED)
|
||||
}
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for broadcast_del */
|
||||
void broadcast_del(struct broadcast_state *bstate UNNEEDED, u64 index UNNEEDED, const u8 *payload UNNEEDED)
|
||||
{ fprintf(stderr, "broadcast_del called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_announcement */
|
||||
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
||||
|
@ -18,6 +18,9 @@ void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
|
||||
}
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for broadcast_del */
|
||||
void broadcast_del(struct broadcast_state *bstate UNNEEDED, u64 index UNNEEDED, const u8 *payload UNNEEDED)
|
||||
{ fprintf(stderr, "broadcast_del called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_announcement */
|
||||
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
||||
|
Loading…
Reference in New Issue
Block a user