mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-15 04:11:37 +01:00
Merge 0c40dd075d
into 6afce8d608
This commit is contained in:
commit
a60e3c6ae3
1 changed files with 4 additions and 3 deletions
|
@ -275,8 +275,8 @@ func (c *Client) GetBlockVerboseTx(blockHash *chainhash.Hash) (*btcjson.GetBlock
|
||||||
// GetBlockCountAsync RPC invocation (or an applicable error).
|
// GetBlockCountAsync RPC invocation (or an applicable error).
|
||||||
type FutureGetBlockCountResult chan *Response
|
type FutureGetBlockCountResult chan *Response
|
||||||
|
|
||||||
// Receive waits for the Response promised by the future and returns the number
|
// Receive waits for the Response promised by the future and returns the height
|
||||||
// of blocks in the longest block chain.
|
// of the most-work fully-validated chain. The genesis block has height 0.
|
||||||
func (r FutureGetBlockCountResult) Receive() (int64, error) {
|
func (r FutureGetBlockCountResult) Receive() (int64, error) {
|
||||||
res, err := ReceiveFuture(r)
|
res, err := ReceiveFuture(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -302,7 +302,8 @@ func (c *Client) GetBlockCountAsync() FutureGetBlockCountResult {
|
||||||
return c.SendCmd(cmd)
|
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) {
|
func (c *Client) GetBlockCount() (int64, error) {
|
||||||
return c.GetBlockCountAsync().Receive()
|
return c.GetBlockCountAsync().Receive()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue