This commit is contained in:
Boris Nagaev 2025-03-10 18:46:37 +01:00 committed by GitHub
commit a60e3c6ae3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -275,8 +275,8 @@ func (c *Client) GetBlockVerboseTx(blockHash *chainhash.Hash) (*btcjson.GetBlock
// GetBlockCountAsync RPC invocation (or an applicable error).
type FutureGetBlockCountResult chan *Response
// Receive waits for the Response promised by the future and returns the number
// of blocks in the longest block chain.
// Receive waits for the Response promised by the future and returns the height
// of the most-work fully-validated chain. The genesis block has height 0.
func (r FutureGetBlockCountResult) Receive() (int64, error) {
res, err := ReceiveFuture(r)
if err != nil {
@ -302,7 +302,8 @@ func (c *Client) GetBlockCountAsync() FutureGetBlockCountResult {
return c.SendCmd(cmd)
}
// GetBlockCount returns the number of blocks in the longest block chain.
// GetBlockCount returns the height of the most-work fully-validated chain.
// The genesis block has height 0.
func (c *Client) GetBlockCount() (int64, error) {
return c.GetBlockCountAsync().Receive()
}