Browse Source

gossip: Store incoming gossip messages to gossip_store

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
03fd5afbc5
  1. 6
      gossipd/routing.c

6
gossipd/routing.c

@ -807,11 +807,13 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
if (replace_broadcast(chan, rstate->broadcasts, if (replace_broadcast(chan, rstate->broadcasts,
&chan->channel_announce_msgidx, &chan->channel_announce_msgidx,
take(pending->announce))) pending->announce))
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Announcement %s was replaced?", "Announcement %s was replaced?",
tal_hex(tmpctx, pending->announce)); tal_hex(tmpctx, pending->announce));
gossip_store_append(rstate->store, pending->announce);
local = pubkey_eq(&pending->node_id_1, &rstate->local_id) || local = pubkey_eq(&pending->node_id_1, &rstate->local_id) ||
pubkey_eq(&pending->node_id_2, &rstate->local_id); pubkey_eq(&pending->node_id_2, &rstate->local_id);
@ -981,6 +983,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update)
timestamp, timestamp,
htlc_minimum_msat); htlc_minimum_msat);
gossip_store_append(rstate->store, serialized);
replace_broadcast(chan, rstate->broadcasts, replace_broadcast(chan, rstate->broadcasts,
&chan->half[direction].channel_update_msgidx, &chan->half[direction].channel_update_msgidx,
take(serialized)); take(serialized));
@ -1155,6 +1158,7 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
tal_free(node->alias); tal_free(node->alias);
node->alias = tal_dup_arr(node, u8, alias, 32, 0); node->alias = tal_dup_arr(node, u8, alias, 32, 0);
gossip_store_append(rstate->store, serialized);
replace_broadcast(node, rstate->broadcasts, replace_broadcast(node, rstate->broadcasts,
&node->node_announce_msgidx, &node->node_announce_msgidx,
take(serialized)); take(serialized));

Loading…
Cancel
Save