Merge pull request #5328 from guggero/neutrino-router-fix

rpcserver: check router state only if it is validating
This commit is contained in:
Olaoluwa Osuntokun 2021-05-26 18:25:15 -07:00 committed by GitHub
commit 9163d1a16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2470,8 +2470,8 @@ func (r *rpcServer) AbandonChannel(_ context.Context,
// GetInfo returns general information concerning the lightning node including
// its identity pubkey, alias, the chains it is connected to, and information
// concerning the number of open+pending channels.
func (r *rpcServer) GetInfo(ctx context.Context,
in *lnrpc.GetInfoRequest) (*lnrpc.GetInfoResponse, error) {
func (r *rpcServer) GetInfo(_ context.Context,
_ *lnrpc.GetInfoRequest) (*lnrpc.GetInfoResponse, error) {
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)
}
// The router has a lot of work to do for each block. So it might be
// possible that it isn't yet up to date with the most recent block,
// even if the wallet is. This can happen in environments with high CPU
// load (such as parallel itests). Since the `synced_to_chain` flag in
// the response of this call is used by many wallets (and also our
// itests) to make sure everything's up to date, we add the router's
// state to it. So the flag will only toggle to true once the router was
// also able to catch up.
// If the router does full channel validation, it has a lot of work to
// do for each block. So it might be possible that it isn't yet up to
// date with the most recent block, even if the wallet is. This can
// happen in environments with high CPU load (such as parallel itests).
// Since the `synced_to_chain` flag in the response of this call is used
// by many wallets (and also our itests) to make sure everything's up to
// date, we add the router's state to it. So the flag will only toggle
// to true once the router was also able to catch up.
if !r.cfg.Routing.AssumeChannelValid {
routerHeight := r.server.chanRouter.SyncedHeight()
isSynced = isSynced && uint32(bestHeight) == routerHeight
}
network := lncfg.NormalizeNetwork(r.cfg.ActiveNetParams.Name)
activeChains := make([]*lnrpc.Chain, r.cfg.registeredChains.NumActiveChains())
@ -2529,7 +2531,6 @@ func (r *rpcServer) GetInfo(ctx context.Context,
Chain: chain.String(),
Network: network,
}
}
// Check if external IP addresses were provided to lnd and use them