@@ -114,9 +114,9 @@ static void try_update_feerates(struct lightningd *ld, struct channel *channel)
114114}
115115
116116static void try_update_blockheight (struct lightningd * ld ,
117- struct channel * channel ,
118- u32 blockheight )
117+ struct channel * channel )
119118{
119+ u32 blockheight = get_block_height (ld -> topology );
120120 u8 * msg ;
121121
122122 /* We don't update the blockheight for non-leased chans */
@@ -1005,7 +1005,7 @@ void lockin_has_completed(struct channel *channel, bool record_push)
10051005 * so update now. */
10061006 try_update_feerates (ld , channel );
10071007
1008- try_update_blockheight (ld , channel , get_block_height ( ld -> topology ) );
1008+ try_update_blockheight (ld , channel );
10091009
10101010 /* Emit an event for the channel open (or channel proposal if blockheight
10111011 * is zero) */
@@ -1878,8 +1878,7 @@ bool peer_start_channeld(struct channel *channel,
18781878 * might not be what we expect: adjust now. */
18791879 if (channel -> opener == LOCAL ) {
18801880 try_update_feerates (ld , channel );
1881- try_update_blockheight (ld , channel ,
1882- get_block_height (ld -> topology ));
1881+ try_update_blockheight (ld , channel );
18831882 }
18841883
18851884 /* "Reestablished" if we've just opened. */
@@ -1925,9 +1924,10 @@ void channeld_tell_depth(struct channel *channel,
19251924 * If so, we should forget the channel. */
19261925static bool
19271926is_fundee_should_forget (struct lightningd * ld ,
1928- struct channel * channel ,
1929- u32 block_height )
1927+ struct channel * channel )
19301928{
1929+ u32 block_height = get_block_height (ld -> topology );
1930+
19311931 /* BOLT #2:
19321932 *
19331933 * A non-funding node (fundee):
@@ -1967,9 +1967,9 @@ is_fundee_should_forget(struct lightningd *ld,
19671967}
19681968
19691969/* Notify all channels of new blocks. */
1970- void channel_notify_new_block (struct lightningd * ld ,
1971- u32 block_height )
1970+ void channel_notify_new_block (struct lightningd * ld )
19721971{
1972+ u32 block_height = get_block_height (ld -> topology );
19731973 struct peer * peer ;
19741974 struct channel * channel ;
19751975 struct channel * * to_forget = tal_arr (NULL , struct channel * , 0 );
@@ -1983,13 +1983,12 @@ void channel_notify_new_block(struct lightningd *ld,
19831983 list_for_each (& peer -> channels , channel , list ) {
19841984 if (channel_state_uncommitted (channel -> state ))
19851985 continue ;
1986- if (is_fundee_should_forget (ld , channel , block_height )) {
1986+ if (is_fundee_should_forget (ld , channel )) {
19871987 tal_arr_expand (& to_forget , channel );
19881988 } else
19891989 /* Let channels know about new blocks,
19901990 * required for lease updates */
1991- try_update_blockheight (ld , channel ,
1992- block_height );
1991+ try_update_blockheight (ld , channel );
19931992 }
19941993 }
19951994
0 commit comments