@ -50,9 +50,6 @@ struct pending_cannouncement {
/* Only ever replace with newer updates */
u32 update_timestamps [ 2 ] ;
/* Was this from a peer and should be stored? */
bool store ;
} ;
struct pending_node_announce {
@ -551,8 +548,7 @@ static void add_pending_node_announcement(struct routing_state *rstate, struct p
}
static void process_pending_node_announcement ( struct routing_state * rstate ,
struct pubkey * nodeid ,
bool store )
struct pubkey * nodeid )
{
struct pending_node_announce * pna = pending_node_map_get ( rstate - > pending_node_map , & nodeid - > pubkey ) ;
if ( ! pna )
@ -565,7 +561,7 @@ static void process_pending_node_announcement(struct routing_state *rstate,
type_to_string ( pna , struct pubkey , nodeid ) ) ;
/* Should not error, since we processed it before */
err = handle_node_announcement ( rstate , pna - > node_announcement , store ) ;
err = handle_node_announcement ( rstate , pna - > node_announcement ) ;
if ( err )
status_failed ( STATUS_FAIL_INTERNAL_ERROR ,
" pending node_announcement %s malformed %s? " ,
@ -632,8 +628,7 @@ void routing_add_channel_announcement(struct routing_state *rstate,
u8 * handle_channel_announcement ( struct routing_state * rstate ,
const u8 * announce TAKES ,
const struct short_channel_id * * scid ,
bool store )
const struct short_channel_id * * scid )
{
struct pending_cannouncement * pending ;
struct bitcoin_blkid chain_hash ;
@ -645,7 +640,6 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
pending = tal ( rstate , struct pending_cannouncement ) ;
pending - > updates [ 0 ] = NULL ;
pending - > updates [ 1 ] = NULL ;
pending - > store = store ;
pending - > announce = tal_dup_arr ( pending , u8 ,
announce , tal_len ( announce ) , 0 ) ;
pending - > update_timestamps [ 0 ] = pending - > update_timestamps [ 1 ] = 0 ;
@ -768,7 +762,7 @@ ignored:
static void process_pending_channel_update ( struct routing_state * rstate ,
const struct short_channel_id * scid ,
const u8 * cupdate , bool store )
const u8 * cupdate )
{
u8 * err ;
@ -776,7 +770,7 @@ static void process_pending_channel_update(struct routing_state *rstate,
return ;
/* FIXME: We don't remember who sent us updates, so can't error them */
err = handle_channel_update ( rstate , cupdate , store ) ;
err = handle_channel_update ( rstate , cupdate ) ;
if ( err ) {
status_trace ( " Pending channel_update for %s: %s " ,
type_to_string ( tmpctx , struct short_channel_id , scid ) ,
@ -832,19 +826,18 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
return false ;
}
if ( pending - > store )
gossip_store_add_channel_announcement ( rstate - > store , pending - > announce , satoshis ) ;
gossip_store_add_channel_announcement ( rstate - > store , pending - > announce , satoshis ) ;
routing_add_channel_announcement ( rstate , pending - > announce , satoshis ) ;
local = pubkey_eq ( & pending - > node_id_1 , & rstate - > local_id ) | |
pubkey_eq ( & pending - > node_id_2 , & rstate - > local_id ) ;
/* Did we have an update waiting? If so, apply now. */
process_pending_channel_update ( rstate , scid , pending - > updates [ 0 ] , pending - > store ) ;
process_pending_channel_update ( rstate , scid , pending - > updates [ 1 ] , pending - > store ) ;
process_pending_channel_update ( rstate , scid , pending - > updates [ 0 ] ) ;
process_pending_channel_update ( rstate , scid , pending - > updates [ 1 ] ) ;
process_pending_node_announcement ( rstate , & pending - > node_id_1 , pending - > store ) ;
process_pending_node_announcement ( rstate , & pending - > node_id_2 , pending - > store ) ;
process_pending_node_announcement ( rstate , & pending - > node_id_1 ) ;
process_pending_node_announcement ( rstate , & pending - > node_id_2 ) ;
tal_free ( pending ) ;
return local ;
@ -936,8 +929,7 @@ void routing_add_channel_update(struct routing_state *rstate,
take ( update ) ) ;
}
u8 * handle_channel_update ( struct routing_state * rstate , const u8 * update ,
bool store )
u8 * handle_channel_update ( struct routing_state * rstate , const u8 * update )
{
u8 * serialized ;
struct half_chan * c ;
@ -1100,8 +1092,7 @@ void routing_add_node_announcement(struct routing_state *rstate, const u8 *msg T
take ( msg ) ) ;
}
u8 * handle_node_announcement ( struct routing_state * rstate , const u8 * node_ann ,
bool store )
u8 * handle_node_announcement ( struct routing_state * rstate , const u8 * node_ann )
{
u8 * serialized ;
struct sha256_double hash ;
@ -1225,9 +1216,7 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann,
status_trace ( " Received node_announcement for node %s " ,
type_to_string ( tmpctx , struct pubkey , & node_id ) ) ;
/* FIXME: remove store guard */
if ( store )
gossip_store_add_node_announcement ( rstate - > store , serialized ) ;
gossip_store_add_node_announcement ( rstate - > store , serialized ) ;
routing_add_node_announcement ( rstate , serialized ) ;
return NULL ;
}
@ -1385,7 +1374,7 @@ void routing_failure(struct routing_state *rstate,
( int ) failcode ) ;
return ;
}
err = handle_channel_update ( rstate , channel_update , true ) ;
err = handle_channel_update ( rstate , channel_update ) ;
if ( err ) {
status_unusual ( " routing_failure: "
" bad channel_update %s " ,