Example #1
0
// GetBlockCountAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See GetBlockCount for the blocking version and more details.
func (c *Client) GetBlockCountAsync() FutureGetBlockCountResult {
	id := c.NextID()
	cmd, err := btcjson.NewGetBlockCountCmd(id)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}
Example #2
0
func getBlockCount() (float64, error) {
	cmd, err := btcjson.NewGetBlockCountCmd("blocksafari")
	if err != nil {
		return -1, err
	}

	msg, err := json.Marshal(cmd)
	if err != nil {
		return -1, err
	}

	reply, err := btcjson.TlsRpcCommand(cfg.RPCUser, cfg.RPCPassword, cfg.RPCServer, msg, pem, false)
	if err != nil {
		return -1, err
	}

	if reply.Error != nil {
		return -1, reply.Error
	}

	return reply.Result.(float64), nil
}
Example #3
0
// makeGetBlockCount generates the cmd structure for getblockcount commands.
func makeGetBlockCount(args []interface{}) (btcjson.Cmd, error) {
	return btcjson.NewGetBlockCountCmd("btcctl")
}