Ejemplo n.º 1
0
//  makeSetGenerate generates the cmd structure for setgenerate commands.
func makeSetGenerate(args []interface{}) (btcjson.Cmd, error) {
	var optargs = make([]int, 0, 1)
	if len(args) > 1 {
		optargs = append(optargs, args[1].(int))
	}
	return btcjson.NewSetGenerateCmd("btcctl", args[0].(bool), optargs...)
}
Ejemplo n.º 2
0
// SetGenerateAsync 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 SetGenerate for the blocking version and more details.
func (c *Client) SetGenerateAsync(enable bool, numCPUs int) FutureSetGenerateResult {
	id := c.NextID()
	cmd, err := btcjson.NewSetGenerateCmd(id, enable, numCPUs)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}