rpcserver: check router state only if it is validating
Fixes #5325. Corrects a problem introduced in #5281 that caused the synced_to_chain flag in the GetInfo call to never become true when the router subsystem is running in Neutrino mode (channel validation turned off).
This commit is contained in:
parent
f15961f764
commit
3f2d4f108d
27
rpcserver.go
27
rpcserver.go
@ -2470,8 +2470,8 @@ func (r *rpcServer) AbandonChannel(_ context.Context,
|
|||||||
// GetInfo returns general information concerning the lightning node including
|
// GetInfo returns general information concerning the lightning node including
|
||||||
// its identity pubkey, alias, the chains it is connected to, and information
|
// its identity pubkey, alias, the chains it is connected to, and information
|
||||||
// concerning the number of open+pending channels.
|
// concerning the number of open+pending channels.
|
||||||
func (r *rpcServer) GetInfo(ctx context.Context,
|
func (r *rpcServer) GetInfo(_ context.Context,
|
||||||
in *lnrpc.GetInfoRequest) (*lnrpc.GetInfoResponse, error) {
|
_ *lnrpc.GetInfoRequest) (*lnrpc.GetInfoResponse, error) {
|
||||||
|
|
||||||
serverPeers := r.server.Peers()
|
serverPeers := r.server.Peers()
|
||||||
|
|
||||||
@ -2511,16 +2511,18 @@ func (r *rpcServer) GetInfo(ctx context.Context,
|
|||||||
"with current best block in the main chain: %v", err)
|
"with current best block in the main chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The router has a lot of work to do for each block. So it might be
|
// If the router does full channel validation, it has a lot of work to
|
||||||
// possible that it isn't yet up to date with the most recent block,
|
// do for each block. So it might be possible that it isn't yet up to
|
||||||
// even if the wallet is. This can happen in environments with high CPU
|
// date with the most recent block, even if the wallet is. This can
|
||||||
// load (such as parallel itests). Since the `synced_to_chain` flag in
|
// happen in environments with high CPU load (such as parallel itests).
|
||||||
// the response of this call is used by many wallets (and also our
|
// Since the `synced_to_chain` flag in the response of this call is used
|
||||||
// itests) to make sure everything's up to date, we add the router's
|
// by many wallets (and also our itests) to make sure everything's up to
|
||||||
// state to it. So the flag will only toggle to true once the router was
|
// date, we add the router's state to it. So the flag will only toggle
|
||||||
// also able to catch up.
|
// to true once the router was also able to catch up.
|
||||||
routerHeight := r.server.chanRouter.SyncedHeight()
|
if !r.cfg.Routing.AssumeChannelValid {
|
||||||
isSynced = isSynced && uint32(bestHeight) == routerHeight
|
routerHeight := r.server.chanRouter.SyncedHeight()
|
||||||
|
isSynced = isSynced && uint32(bestHeight) == routerHeight
|
||||||
|
}
|
||||||
|
|
||||||
network := lncfg.NormalizeNetwork(r.cfg.ActiveNetParams.Name)
|
network := lncfg.NormalizeNetwork(r.cfg.ActiveNetParams.Name)
|
||||||
activeChains := make([]*lnrpc.Chain, r.cfg.registeredChains.NumActiveChains())
|
activeChains := make([]*lnrpc.Chain, r.cfg.registeredChains.NumActiveChains())
|
||||||
@ -2529,7 +2531,6 @@ func (r *rpcServer) GetInfo(ctx context.Context,
|
|||||||
Chain: chain.String(),
|
Chain: chain.String(),
|
||||||
Network: network,
|
Network: network,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if external IP addresses were provided to lnd and use them
|
// Check if external IP addresses were provided to lnd and use them
|
||||||
|
Loading…
Reference in New Issue
Block a user