@@ -114,9 +114,9 @@ static void try_update_feerates(struct lightningd *ld, struct channel *channel)
114
114
}
115
115
116
116
static void try_update_blockheight (struct lightningd * ld ,
117
- struct channel * channel ,
118
- u32 blockheight )
117
+ struct channel * channel )
119
118
{
119
+ u32 blockheight = get_block_height (ld -> topology );
120
120
u8 * msg ;
121
121
122
122
/* We don't update the blockheight for non-leased chans */
@@ -1005,7 +1005,7 @@ void lockin_has_completed(struct channel *channel, bool record_push)
1005
1005
* so update now. */
1006
1006
try_update_feerates (ld , channel );
1007
1007
1008
- try_update_blockheight (ld , channel , get_block_height ( ld -> topology ) );
1008
+ try_update_blockheight (ld , channel );
1009
1009
1010
1010
/* Emit an event for the channel open (or channel proposal if blockheight
1011
1011
* is zero) */
@@ -1878,8 +1878,7 @@ bool peer_start_channeld(struct channel *channel,
1878
1878
* might not be what we expect: adjust now. */
1879
1879
if (channel -> opener == LOCAL ) {
1880
1880
try_update_feerates (ld , channel );
1881
- try_update_blockheight (ld , channel ,
1882
- get_block_height (ld -> topology ));
1881
+ try_update_blockheight (ld , channel );
1883
1882
}
1884
1883
1885
1884
/* "Reestablished" if we've just opened. */
@@ -1925,9 +1924,10 @@ void channeld_tell_depth(struct channel *channel,
1925
1924
* If so, we should forget the channel. */
1926
1925
static bool
1927
1926
is_fundee_should_forget (struct lightningd * ld ,
1928
- struct channel * channel ,
1929
- u32 block_height )
1927
+ struct channel * channel )
1930
1928
{
1929
+ u32 block_height = get_block_height (ld -> topology );
1930
+
1931
1931
/* BOLT #2:
1932
1932
*
1933
1933
* A non-funding node (fundee):
@@ -1967,9 +1967,9 @@ is_fundee_should_forget(struct lightningd *ld,
1967
1967
}
1968
1968
1969
1969
/* 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 )
1972
1971
{
1972
+ u32 block_height = get_block_height (ld -> topology );
1973
1973
struct peer * peer ;
1974
1974
struct channel * channel ;
1975
1975
struct channel * * to_forget = tal_arr (NULL , struct channel * , 0 );
@@ -1983,13 +1983,12 @@ void channel_notify_new_block(struct lightningd *ld,
1983
1983
list_for_each (& peer -> channels , channel , list ) {
1984
1984
if (channel_state_uncommitted (channel -> state ))
1985
1985
continue ;
1986
- if (is_fundee_should_forget (ld , channel , block_height )) {
1986
+ if (is_fundee_should_forget (ld , channel )) {
1987
1987
tal_arr_expand (& to_forget , channel );
1988
1988
} else
1989
1989
/* Let channels know about new blocks,
1990
1990
* required for lease updates */
1991
- try_update_blockheight (ld , channel ,
1992
- block_height );
1991
+ try_update_blockheight (ld , channel );
1993
1992
}
1994
1993
}
1995
1994
0 commit comments