@ -734,6 +734,7 @@ static void handle_get_update(struct peer *peer, const u8 *msg)
struct short_channel_id scid ;
struct chan * chan ;
const u8 * update ;
struct routing_state * rstate = peer - > daemon - > rstate ;
if ( ! fromwire_gossip_get_update ( msg , & scid ) ) {
status_trace ( " peer %s sent bad gossip_get_update %s " ,
@ -742,7 +743,7 @@ static void handle_get_update(struct peer *peer, const u8 *msg)
return ;
}
chan = get_channel ( peer - > daemon - > rstate , & scid ) ;
chan = get_channel ( rstate , & scid ) ;
if ( ! chan ) {
status_unusual ( " peer %s scid %s: unknown channel " ,
type_to_string ( trc , struct pubkey , & peer - > id ) ,
@ -752,9 +753,13 @@ static void handle_get_update(struct peer *peer, const u8 *msg)
} else {
/* We want update that comes from our end. */
if ( pubkey_eq ( & chan - > nodes [ 0 ] - > id , & peer - > daemon - > id ) )
update = chan - > half [ 0 ] . channel_update ;
update = get_broadcast ( rstate - > broadcasts ,
chan - > half [ 0 ]
. channel_update_msgidx ) ;
else if ( pubkey_eq ( & chan - > nodes [ 1 ] - > id , & peer - > daemon - > id ) )
update = chan - > half [ 1 ] . channel_update ;
update = get_broadcast ( rstate - > broadcasts ,
chan - > half [ 1 ]
. channel_update_msgidx ) ;
else {
status_unusual ( " peer %s scid %s: not our channel? " ,
type_to_string ( trc , struct pubkey ,
@ -1132,7 +1137,7 @@ static void append_half_channel(struct gossip_getchannels_entry **entries,
return ;
/* Don't mention non-public inactive channels. */
if ( ! c - > active & & ! c - > channel_update )
if ( ! c - > active & & ! c - > channel_update_msgidx )
return ;
n = tal_count ( * entries ) ;
@ -1144,9 +1149,9 @@ static void append_half_channel(struct gossip_getchannels_entry **entries,
e - > satoshis = chan - > satoshis ;
e - > active = c - > active ;
e - > flags = c - > flags ;
e - > public = ( c - > channel_update ! = NULL ) ;
e - > public = ( c - > channel_update_msgidx ! = 0 ) ;
e - > short_channel_id = chan - > scid ;
e - > last_update_timestamp = c - > channel_update ? c - > last_timestamp : - 1 ;
e - > last_update_timestamp = c - > channel_update_msgidx ? c - > last_timestamp : - 1 ;
if ( e - > last_update_timestamp > = 0 ) {
e - > base_fee_msat = c - > base_fee ;
e - > fee_per_millionth = c - > proportional_fee ;
@ -1335,10 +1340,14 @@ static void gossip_send_keepalive_update(struct routing_state *rstate,
u64 htlc_minimum_msat ;
u16 flags , cltv_expiry_delta ;
u8 * update , * msg , * err ;
const u8 * old_update ;
/* Parse old update */
old_update = get_broadcast ( rstate - > broadcasts ,
hc - > channel_update_msgidx ) ;
if ( ! fromwire_channel_update (
hc - > channel_update , & sig , & chain_hash , & scid , & timestamp ,
old _update, & sig , & chain_hash , & scid , & timestamp ,
& flags , & cltv_expiry_delta , & htlc_minimum_msat , & fee_base_msat ,
& fee_proportional_millionths ) ) {
status_failed (
@ -1398,7 +1407,7 @@ static void gossip_refresh_network(struct daemon *daemon)
for ( size_t i = 0 ; i < tal_count ( n - > chans ) ; i + + ) {
struct half_chan * hc = half_chan_from ( n , n - > chans [ i ] ) ;
if ( ! hc - > channel_update ) {
if ( ! hc - > channel_update_msgidx ) {
/* Connection is not public yet, so don't even
* try to re - announce it */
continue ;
@ -1869,6 +1878,7 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn,
secp256k1_ecdsa_signature sig ;
u64 htlc_minimum_msat ;
u8 * err ;
const u8 * old_update ;
if ( ! fromwire_gossip_disable_channel ( msg , & scid , & direction , & active ) ) {
status_unusual ( " Unable to parse %s " ,
@ -1891,7 +1901,7 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn,
hc - > active = active ;
if ( ! hc - > channel_update ) {
if ( ! hc - > channel_update_msgidx ) {
status_trace (
" Channel %s/%d doesn't have a channel_update yet, can't "
" disable " ,
@ -1900,8 +1910,11 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn,
goto fail ;
}
old_update = get_broadcast ( daemon - > rstate - > broadcasts ,
hc - > channel_update_msgidx ) ;
if ( ! fromwire_channel_update (
hc - > channel_update , & sig , & chain_hash , & scid , & timestamp ,
old _update, & sig , & chain_hash , & scid , & timestamp ,
& flags , & cltv_expiry_delta , & htlc_minimum_msat , & fee_base_msat ,
& fee_proportional_millionths ) ) {
status_failed (