Пример #1
0
// GetBestBlockHashAsync 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 GetBestBlockHash for the blocking version and more details.
func (c *Client) GetBestBlockHashAsync() FutureGetBestBlockHashResult {
	id := c.NextID()
	cmd, err := btcjson.NewGetBestBlockHashCmd(id)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}
Пример #2
0
func getBestBlockHash() (string, error) {
	cmd, err := btcjson.NewGetBestBlockHashCmd("blocksafari")
	if err != nil {
		return "", err
	}

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

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

	return reply.Result.(string), nil
}
Пример #3
0
// makeGetBestBlockHash generates the cmd structure for
// makebestblockhash commands.
func makeGetBestBlockHash(args []interface{}) (btcjson.Cmd, error) {
	return btcjson.NewGetBestBlockHashCmd("btcctl")
}