mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 23:24:21 +01:00
lightningd: don't print zero blockheight while we're syncing.
In v0.11 (71f736678f) we changed lightningd to wait for gossipd to
acknowledge blocks before updating blockheight: this resolved a problem
which lnprototest had where it wanted to know when we'd fully digested
a block.
However, it broke the syncing case: until then we don't even tell
gossipd, so this stayed at zero. We should use the current blockheight
for that corner case!
Fixes: #5894
Changelog-Fixed: JSON-RPC: `getinfo` `blockheight` no longer sits on 0 while we sync with bitcoind the first time.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Alex Myers
parent
e29fd2a8e2
commit
7b9f1b72c6
@@ -2418,7 +2418,16 @@ static struct command_result *json_getinfo(struct command *cmd,
|
||||
json_array_end(response);
|
||||
|
||||
json_add_string(response, "version", version());
|
||||
json_add_num(response, "blockheight", cmd->ld->blockheight);
|
||||
/* If we're still syncing, put the height we're up to here, so
|
||||
* they can see progress! Otherwise use the height gossipd knows
|
||||
* about, so tests work properly. */
|
||||
if (!topology_synced(cmd->ld->topology)) {
|
||||
json_add_num(response, "blockheight",
|
||||
get_block_height(cmd->ld->topology));
|
||||
} else {
|
||||
json_add_num(response, "blockheight",
|
||||
cmd->ld->gossip_blockheight);
|
||||
}
|
||||
json_add_string(response, "network", chainparams->network_name);
|
||||
json_add_amount_msat_compat(response,
|
||||
wallet_total_forward_fees(cmd->ld->wallet),
|
||||
|
||||
Reference in New Issue
Block a user