Summary
As of now, each time pop miner wants to mine they call bfgapi.BitcoinInfoRequest to get the height. Bitcoin height doesn't change that often (not enough to be reaching out to the client in every single request at least).
We have another goroutine that gets the height on a 5 second timer; piggy-back off of this to set a server-value of the btc height from the last success in this goroutine. This way, clients (i.e. pop miners) don't make a call to electrumx when getting bitcoin info.
Changes
use the result of another go routine's btcClient.Height to set a cached height value.
this would be at most 5 seconds out-of-sync with electrumx
Summary As of now, each time pop miner wants to mine they call
bfgapi.BitcoinInfoRequest
to get the height. Bitcoin height doesn't change that often (not enough to be reaching out to the client in every single request at least).We have another goroutine that gets the height on a 5 second timer; piggy-back off of this to set a server-value of the btc height from the last success in this goroutine. This way, clients (i.e. pop miners) don't make a call to electrumx when getting bitcoin info.
Changes use the result of another go routine's
btcClient.Height
to set a cached height value.this would be at most 5 seconds out-of-sync with electrumx