コード例 #1
0
ファイル: chain.go プロジェクト: GeertJohan/btcrpcclient
// 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)
}
コード例 #2
0
ファイル: json.go プロジェクト: hsk81/blocksafari
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
}
コード例 #3
0
ファイル: btcctl.go プロジェクト: RagnarDanneskjold/btcd
// makeGetBlockCount generates the cmd structure for getblockcount commands.
func makeGetBlockCount(args []interface{}) (btcjson.Cmd, error) {
	return btcjson.NewGetBlockCountCmd("btcctl")
}