webapi: Use GetBlockCount not GetBestBlockHeader.

GetBestBlockHeader is a more demanding RPC so using GetBlockCount offers
a slight performance improvement.
This commit is contained in:
jholdstock 2023-08-31 10:37:08 +01:00 committed by Jamie Holdstock
parent 61911a3f3b
commit fb47e65ef3

View File

@ -61,14 +61,14 @@ func (s *Server) dcrdStatus(c *gin.Context) DcrdStatus {
status.Connected = true
bestBlock, err := dcrdClient.GetBestBlockHeader()
bestBlock, err := dcrdClient.GetBlockCount()
if err != nil {
s.log.Errorf("Could not get dcrd best block header: %v", err)
s.log.Errorf("Could not get dcrd block count: %v", err)
status.BestBlockError = true
return status
}
status.BestBlockHeight = bestBlock.Height
status.BestBlockHeight = uint32(bestBlock)
return status
}