2014-01-09 06:49:06 +01:00
|
|
|
// Copyright (c) 2013-2014 Conformal Systems LLC.
|
2013-10-22 16:12:12 +02:00
|
|
|
// Use of this source code is governed by an ISC
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// this has to be in the real json subpackage so we can mock up structs
|
|
|
|
package btcjson
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"reflect"
|
2014-01-08 17:06:54 +01:00
|
|
|
"strings"
|
2013-10-22 16:12:12 +02:00
|
|
|
"testing"
|
2014-07-03 02:41:28 +02:00
|
|
|
|
|
|
|
"github.com/davecgh/go-spew/spew"
|
2013-10-22 16:12:12 +02:00
|
|
|
)
|
|
|
|
|
2014-07-15 16:09:35 +02:00
|
|
|
var testID = float64(1)
|
2014-01-03 23:50:17 +01:00
|
|
|
|
2014-11-18 13:52:10 +01:00
|
|
|
var defaultAccount = ""
|
|
|
|
var testAccount = "account"
|
|
|
|
|
2013-10-22 16:12:12 +02:00
|
|
|
var jsoncmdtests = []struct {
|
|
|
|
name string
|
2014-01-06 16:12:35 +01:00
|
|
|
cmd string
|
2013-10-22 16:12:12 +02:00
|
|
|
f func() (Cmd, error)
|
|
|
|
result Cmd // after marshal and unmarshal
|
|
|
|
}{
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "addmultisigaddress",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewAddMultisigAddressCmd(testID, 1,
|
2013-10-22 16:12:12 +02:00
|
|
|
[]string{"foo", "bar"})
|
|
|
|
},
|
|
|
|
result: &AddMultisigAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
NRequired: 1,
|
|
|
|
Keys: []string{"foo", "bar"},
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: defaultAccount,
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "+ optional",
|
|
|
|
cmd: "addmultisigaddress",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewAddMultisigAddressCmd(testID, 1,
|
2013-10-22 16:12:12 +02:00
|
|
|
[]string{"foo", "bar"}, "address")
|
|
|
|
},
|
|
|
|
result: &AddMultisigAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
NRequired: 1,
|
|
|
|
Keys: []string{"foo", "bar"},
|
|
|
|
Account: "address",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// TODO(oga) Too many arguments to newaddmultisigaddress
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic add",
|
|
|
|
cmd: "addnode",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewAddNodeCmd(testID, "address",
|
2013-10-22 16:12:12 +02:00
|
|
|
"add")
|
|
|
|
},
|
|
|
|
result: &AddNodeCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
Addr: "address",
|
|
|
|
SubCmd: "add",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic remove",
|
|
|
|
cmd: "addnode",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewAddNodeCmd(testID, "address",
|
2013-10-22 16:12:12 +02:00
|
|
|
"remove")
|
|
|
|
},
|
|
|
|
result: &AddNodeCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
Addr: "address",
|
|
|
|
SubCmd: "remove",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic onetry",
|
|
|
|
cmd: "addnode",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewAddNodeCmd(testID, "address",
|
2013-10-22 16:12:12 +02:00
|
|
|
"onetry")
|
|
|
|
},
|
|
|
|
result: &AddNodeCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
Addr: "address",
|
|
|
|
SubCmd: "onetry",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// TODO(oga) try invalid subcmds
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "backupwallet",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewBackupWalletCmd(testID, "destination")
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
result: &BackupWalletCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
Destination: "destination",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "createmultisig",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewCreateMultisigCmd(testID, 1,
|
2013-10-22 16:12:12 +02:00
|
|
|
[]string{"key1", "key2", "key3"})
|
|
|
|
},
|
|
|
|
result: &CreateMultisigCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
NRequired: 1,
|
|
|
|
Keys: []string{"key1", "key2", "key3"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "createrawtransaction",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewCreateRawTransactionCmd(testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
[]TransactionInput{
|
2014-02-04 22:13:24 +01:00
|
|
|
{Txid: "tx1", Vout: 1},
|
|
|
|
{Txid: "tx2", Vout: 3}},
|
2013-10-22 16:12:12 +02:00
|
|
|
map[string]int64{"bob": 1, "bill": 2})
|
|
|
|
},
|
|
|
|
result: &CreateRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
Inputs: []TransactionInput{
|
2014-02-04 22:13:24 +01:00
|
|
|
{Txid: "tx1", Vout: 1},
|
|
|
|
{Txid: "tx2", Vout: 3},
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
Amounts: map[string]int64{
|
|
|
|
"bob": 1,
|
|
|
|
"bill": 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2013-11-22 17:01:41 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "debuglevel",
|
2013-11-22 17:01:41 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewDebugLevelCmd(testID, "debug")
|
2013-11-22 17:01:41 +01:00
|
|
|
},
|
|
|
|
result: &DebugLevelCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-22 17:01:41 +01:00
|
|
|
LevelSpec: "debug",
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 18:22:07 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "decoderawtransaction",
|
2013-10-25 18:22:07 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewDecodeRawTransactionCmd(testID,
|
2013-10-25 18:22:07 +02:00
|
|
|
"thisisahexidecimaltransaction")
|
|
|
|
},
|
|
|
|
result: &DecodeRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 18:22:07 +02:00
|
|
|
HexTx: "thisisahexidecimaltransaction",
|
|
|
|
},
|
|
|
|
},
|
2013-10-31 21:37:14 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "decodescript",
|
2013-10-31 21:37:14 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewDecodeScriptCmd(testID,
|
2013-10-31 21:37:14 +01:00
|
|
|
"a bunch of hex")
|
|
|
|
},
|
|
|
|
result: &DecodeScriptCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 21:37:14 +01:00
|
|
|
HexScript: "a bunch of hex",
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 18:47:11 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "dumpprivkey",
|
2013-10-25 18:47:11 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewDumpPrivKeyCmd(testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
"address")
|
|
|
|
},
|
|
|
|
result: &DumpPrivKeyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
Address: "address",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "dumpwallet",
|
2013-10-25 18:47:11 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewDumpWalletCmd(testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
"filename")
|
|
|
|
},
|
|
|
|
result: &DumpWalletCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
Filename: "filename",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "encryptwallet",
|
2013-10-25 18:47:11 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewEncryptWalletCmd(testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
"passphrase")
|
|
|
|
},
|
|
|
|
result: &EncryptWalletCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
Passphrase: "passphrase",
|
|
|
|
},
|
|
|
|
},
|
2014-06-11 17:05:13 +02:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "estimatefee",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewEstimateFeeCmd(testID, 1234)
|
2014-06-11 17:05:13 +02:00
|
|
|
},
|
|
|
|
result: &EstimateFeeCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-06-11 17:05:13 +02:00
|
|
|
NumBlocks: 1234,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "estimatepriority",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewEstimatePriorityCmd(testID, 1234)
|
2014-06-11 17:05:13 +02:00
|
|
|
},
|
|
|
|
result: &EstimatePriorityCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-06-11 17:05:13 +02:00
|
|
|
NumBlocks: 1234,
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 18:47:11 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getaccount",
|
2013-10-25 18:47:11 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetAccountCmd(testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
"address")
|
|
|
|
},
|
|
|
|
result: &GetAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 18:47:11 +02:00
|
|
|
Address: "address",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getaccountaddress",
|
2013-10-25 18:47:11 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetAccountAddressCmd(testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
testAccount)
|
2013-10-25 18:47:11 +02:00
|
|
|
},
|
|
|
|
result: &GetAccountAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: testAccount,
|
2013-10-25 18:47:11 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 19:23:28 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic true",
|
|
|
|
cmd: "getaddednodeinfo",
|
2013-10-25 19:23:28 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetAddedNodeInfoCmd(testID, true)
|
2013-10-25 19:23:28 +02:00
|
|
|
},
|
|
|
|
result: &GetAddedNodeInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:23:28 +02:00
|
|
|
Dns: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic false",
|
|
|
|
cmd: "getaddednodeinfo",
|
2013-10-25 19:23:28 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetAddedNodeInfoCmd(testID, false)
|
2013-10-25 19:23:28 +02:00
|
|
|
},
|
|
|
|
result: &GetAddedNodeInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:23:28 +02:00
|
|
|
Dns: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic withnode",
|
|
|
|
cmd: "getaddednodeinfo",
|
2013-10-25 19:23:28 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetAddedNodeInfoCmd(testID, true,
|
2013-10-25 19:23:28 +02:00
|
|
|
"thisisanode")
|
|
|
|
},
|
|
|
|
result: &GetAddedNodeInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:23:53 +02:00
|
|
|
Dns: true,
|
2013-10-25 19:23:28 +02:00
|
|
|
Node: "thisisanode",
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 19:32:51 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getaddressesbyaccount",
|
2013-10-25 19:32:51 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetAddressesByAccountCmd(testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
testAccount)
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
result: &GetAddressesByAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: testAccount,
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getbalance",
|
2013-10-25 19:32:51 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBalanceCmd(testID)
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
result: &GetBalanceCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
MinConf: 1, // the default
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + account",
|
|
|
|
cmd: "getbalance",
|
2013-10-25 19:32:51 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewGetBalanceCmd(testID, testAccount)
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
result: &GetBalanceCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: &testAccount,
|
2013-10-25 21:41:23 +02:00
|
|
|
MinConf: 1, // the default
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + minconf",
|
|
|
|
cmd: "getbalance",
|
2013-10-25 19:32:51 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewGetBalanceCmd(testID, defaultAccount, 2)
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
result: &GetBalanceCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: &defaultAccount,
|
2013-10-25 21:41:23 +02:00
|
|
|
MinConf: 2,
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + account + minconf",
|
|
|
|
cmd: "getbalance",
|
2013-10-25 19:32:51 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewGetBalanceCmd(testID, testAccount, 2)
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
result: &GetBalanceCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: &testAccount,
|
2013-10-25 21:41:23 +02:00
|
|
|
MinConf: 2,
|
2013-10-25 19:32:51 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-22 16:12:12 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getbestblockhash",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBestBlockHashCmd(testID)
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
2013-10-25 19:36:27 +02:00
|
|
|
result: &GetBestBlockHashCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 19:36:27 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getblock",
|
2013-10-25 19:36:27 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockCmd(testID,
|
2013-10-25 19:36:27 +02:00
|
|
|
"somehash")
|
|
|
|
},
|
|
|
|
result: &GetBlockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-12-11 00:13:42 +01:00
|
|
|
Hash: "somehash",
|
|
|
|
Verbose: true,
|
2013-10-25 19:36:27 +02:00
|
|
|
},
|
|
|
|
},
|
2014-05-12 18:53:34 +02:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "getblockchaininfo",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockChainInfoCmd(testID)
|
2014-05-12 18:53:34 +02:00
|
|
|
},
|
|
|
|
result: &GetBlockChainInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-05-12 18:53:34 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-22 16:12:12 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getblockcount",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockCountCmd(testID)
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
result: &GetBlockCountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 20:00:33 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getblockhash",
|
2013-10-25 20:00:33 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockHashCmd(testID, 1234)
|
2013-10-25 20:00:33 +02:00
|
|
|
},
|
|
|
|
result: &GetBlockHashCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:00:33 +02:00
|
|
|
Index: 1234,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getblocktemplate",
|
2013-10-25 20:00:33 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockTemplateCmd(testID)
|
2013-10-25 20:00:33 +02:00
|
|
|
},
|
|
|
|
result: &GetBlockTemplateCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:00:33 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + request",
|
|
|
|
cmd: "getblocktemplate",
|
2013-10-25 20:00:33 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockTemplateCmd(testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
&TemplateRequest{Mode: "mode",
|
|
|
|
Capabilities: []string{"one", "two", "three"}})
|
2013-10-25 20:00:33 +02:00
|
|
|
},
|
|
|
|
result: &GetBlockTemplateCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
Request: &TemplateRequest{
|
|
|
|
Mode: "mode",
|
2013-10-25 20:00:33 +02:00
|
|
|
Capabilities: []string{
|
|
|
|
"one",
|
|
|
|
"two",
|
|
|
|
"three",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + request no mode",
|
|
|
|
cmd: "getblocktemplate",
|
2013-10-25 20:00:33 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetBlockTemplateCmd(testID,
|
2013-10-25 20:00:33 +02:00
|
|
|
&TemplateRequest{
|
2013-10-25 20:50:39 +02:00
|
|
|
Capabilities: []string{"one", "two", "three"}})
|
2013-10-25 20:00:33 +02:00
|
|
|
},
|
|
|
|
result: &GetBlockTemplateCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
Request: &TemplateRequest{
|
2013-10-25 20:00:33 +02:00
|
|
|
Capabilities: []string{
|
|
|
|
"one",
|
|
|
|
"two",
|
|
|
|
"three",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 20:42:25 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getconnectioncount",
|
2013-10-25 20:42:25 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetConnectionCountCmd(testID)
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
result: &GetConnectionCountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getdifficulty",
|
2013-10-25 20:42:25 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetDifficultyCmd(testID)
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
result: &GetDifficultyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getgenerate",
|
2013-10-25 20:42:25 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetGenerateCmd(testID)
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
result: &GetGenerateCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "gethashespersec",
|
2013-10-25 20:42:25 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetHashesPerSecCmd(testID)
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
result: &GetHashesPerSecCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getinfo",
|
2013-10-25 20:42:25 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetInfoCmd(testID)
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
result: &GetInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getmininginfo",
|
2013-10-25 21:02:13 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetMiningInfoCmd(testID)
|
2013-10-25 21:02:13 +02:00
|
|
|
},
|
|
|
|
result: &GetMiningInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:02:13 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 20:42:25 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getnettotals",
|
2013-10-25 20:42:25 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetNetTotalsCmd(testID)
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
result: &GetNetTotalsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:42:25 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 20:50:39 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getnetworkhashps",
|
2013-10-25 20:50:39 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetNetworkHashPSCmd(testID)
|
2013-10-25 20:50:39 +02:00
|
|
|
},
|
|
|
|
result: &GetNetworkHashPSCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
Blocks: 120,
|
|
|
|
Height: -1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + blocks",
|
|
|
|
cmd: "getnetworkhashps",
|
2013-10-25 20:50:39 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetNetworkHashPSCmd(testID, 5000)
|
2013-10-25 20:50:39 +02:00
|
|
|
},
|
|
|
|
result: &GetNetworkHashPSCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
Blocks: 5000,
|
|
|
|
Height: -1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + blocks + height",
|
|
|
|
cmd: "getnetworkhashps",
|
2013-10-25 20:50:39 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetNetworkHashPSCmd(testID, 5000, 1000)
|
2013-10-25 20:50:39 +02:00
|
|
|
},
|
|
|
|
result: &GetNetworkHashPSCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
Blocks: 5000,
|
|
|
|
Height: 1000,
|
|
|
|
},
|
|
|
|
},
|
2014-05-14 17:45:13 +02:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "getnetworkinfo",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetNetworkInfoCmd(testID)
|
2014-05-14 17:45:13 +02:00
|
|
|
},
|
|
|
|
result: &GetNetworkInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-05-14 17:45:13 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 20:50:39 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getnewaddress",
|
2013-10-25 20:50:39 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewGetNewAddressCmd(testID, testAccount)
|
2013-10-25 20:50:39 +02:00
|
|
|
},
|
2013-10-25 21:02:13 +02:00
|
|
|
result: &GetNewAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: testAccount,
|
2013-10-25 21:02:13 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getpeerinfo",
|
2013-10-25 21:02:13 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetPeerInfoCmd(testID)
|
2013-10-25 21:02:13 +02:00
|
|
|
},
|
|
|
|
result: &GetPeerInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 20:50:39 +02:00
|
|
|
},
|
|
|
|
},
|
2013-10-31 14:31:32 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getrawchangeaddress",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawChangeAddressCmd(testID)
|
2013-10-31 14:31:32 +01:00
|
|
|
},
|
|
|
|
result: &GetRawChangeAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + account",
|
|
|
|
cmd: "getrawchangeaddress",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawChangeAddressCmd(testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
"accountname")
|
|
|
|
},
|
|
|
|
result: &GetRawChangeAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
Account: "accountname",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getrawmempool",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawMempoolCmd(testID)
|
2013-10-31 14:31:32 +01:00
|
|
|
},
|
|
|
|
result: &GetRawMempoolCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
},
|
|
|
|
},
|
2013-12-11 09:44:26 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic noverbose",
|
|
|
|
cmd: "getrawmempool",
|
2013-12-11 09:44:26 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawMempoolCmd(testID, false)
|
2013-12-11 09:44:26 +01:00
|
|
|
},
|
|
|
|
result: &GetRawMempoolCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-12-11 09:44:26 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic verbose",
|
|
|
|
cmd: "getrawmempool",
|
2013-12-11 09:44:26 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawMempoolCmd(testID, true)
|
2013-12-11 09:44:26 +01:00
|
|
|
},
|
|
|
|
result: &GetRawMempoolCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-12-11 09:44:26 +01:00
|
|
|
Verbose: true,
|
|
|
|
},
|
|
|
|
},
|
2013-10-31 14:31:32 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getrawtransaction",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawTransactionCmd(testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
"sometxid")
|
|
|
|
},
|
|
|
|
result: &GetRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
Txid: "sometxid",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + verbose",
|
|
|
|
cmd: "getrawtransaction",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetRawTransactionCmd(testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
"sometxid",
|
2014-01-30 03:19:07 +01:00
|
|
|
1)
|
2013-10-31 14:31:32 +01:00
|
|
|
},
|
|
|
|
result: &GetRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
Txid: "sometxid",
|
2014-01-30 03:19:07 +01:00
|
|
|
Verbose: 1,
|
2013-10-31 14:31:32 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getreceivedbyaccount",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetReceivedByAccountCmd(testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
"abtcaccount",
|
|
|
|
1)
|
|
|
|
},
|
|
|
|
result: &GetReceivedByAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
Account: "abtcaccount",
|
|
|
|
MinConf: 1,
|
|
|
|
},
|
|
|
|
},
|
2014-01-08 16:31:54 +01:00
|
|
|
{
|
|
|
|
name: "basic + opt",
|
|
|
|
cmd: "getreceivedbyaccount",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetReceivedByAccountCmd(testID,
|
2014-01-08 16:31:54 +01:00
|
|
|
"abtcaccount",
|
|
|
|
2)
|
|
|
|
},
|
|
|
|
result: &GetReceivedByAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-08 16:31:54 +01:00
|
|
|
Account: "abtcaccount",
|
|
|
|
MinConf: 2,
|
|
|
|
},
|
|
|
|
},
|
2013-10-31 14:31:32 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getreceivedbyaddress",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetReceivedByAddressCmd(testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
"abtcaddress",
|
|
|
|
1)
|
|
|
|
},
|
|
|
|
result: &GetReceivedByAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
Address: "abtcaddress",
|
|
|
|
MinConf: 1,
|
|
|
|
},
|
|
|
|
},
|
2014-01-08 16:31:54 +01:00
|
|
|
{
|
|
|
|
name: "basic + opt",
|
|
|
|
cmd: "getreceivedbyaddress",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetReceivedByAddressCmd(testID,
|
2014-01-08 16:31:54 +01:00
|
|
|
"abtcaddress",
|
|
|
|
2)
|
|
|
|
},
|
|
|
|
result: &GetReceivedByAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-08 16:31:54 +01:00
|
|
|
Address: "abtcaddress",
|
|
|
|
MinConf: 2,
|
|
|
|
},
|
|
|
|
},
|
2013-10-31 14:31:32 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "gettransaction",
|
2013-10-31 14:31:32 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetTransactionCmd(testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
"atxid")
|
|
|
|
},
|
|
|
|
result: &GetTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 14:31:32 +01:00
|
|
|
Txid: "atxid",
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "gettxout",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetTxOutCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"sometx",
|
|
|
|
10)
|
|
|
|
},
|
|
|
|
result: &GetTxOutCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-07-04 05:12:13 +02:00
|
|
|
Txid: "sometx",
|
|
|
|
Output: 10,
|
|
|
|
IncludeMempool: true,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optional",
|
|
|
|
cmd: "gettxout",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetTxOutCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"sometx",
|
|
|
|
10,
|
|
|
|
false)
|
|
|
|
},
|
|
|
|
result: &GetTxOutCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
Txid: "sometx",
|
|
|
|
Output: 10,
|
|
|
|
IncludeMempool: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "gettxoutsetinfo",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetTxOutSetInfoCmd(testID)
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &GetTxOutSetInfoCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "getwork",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewGetWorkCmd(testID, "some data")
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &GetWorkCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-02-11 23:26:47 +01:00
|
|
|
Data: "some data",
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "help",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewHelpCmd(testID)
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &HelpCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optional cmd",
|
|
|
|
cmd: "help",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewHelpCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"getinfo")
|
|
|
|
},
|
|
|
|
result: &HelpCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
Command: "getinfo",
|
|
|
|
},
|
|
|
|
},
|
2015-01-27 09:38:03 +01:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "importaddress",
|
|
|
|
f: func() (Cmd, error) {
|
|
|
|
return NewImportAddressCmd(testID,
|
|
|
|
"address")
|
|
|
|
},
|
|
|
|
result: &ImportAddressCmd{
|
|
|
|
id: testID,
|
|
|
|
Address: "address",
|
|
|
|
Rescan: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + optional cmd",
|
|
|
|
cmd: "importaddress",
|
|
|
|
f: func() (Cmd, error) {
|
|
|
|
return NewImportAddressCmd(testID,
|
|
|
|
"address", false)
|
|
|
|
},
|
|
|
|
result: &ImportAddressCmd{
|
|
|
|
id: testID,
|
|
|
|
Address: "address",
|
|
|
|
Rescan: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "importpubkey",
|
|
|
|
f: func() (Cmd, error) {
|
|
|
|
return NewImportPubKeyCmd(testID,
|
|
|
|
"pubkey")
|
|
|
|
},
|
|
|
|
result: &ImportPubKeyCmd{
|
|
|
|
id: testID,
|
|
|
|
PubKey: "pubkey",
|
|
|
|
Rescan: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + optional cmd",
|
|
|
|
cmd: "importpubkey",
|
|
|
|
f: func() (Cmd, error) {
|
|
|
|
return NewImportPubKeyCmd(testID,
|
|
|
|
"pubkey", false)
|
|
|
|
},
|
|
|
|
result: &ImportPubKeyCmd{
|
|
|
|
id: testID,
|
|
|
|
PubKey: "pubkey",
|
|
|
|
Rescan: false,
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "importprivkey",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewImportPrivKeyCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"somereallongprivatekey")
|
|
|
|
},
|
|
|
|
result: &ImportPrivKeyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
PrivKey: "somereallongprivatekey",
|
2013-11-19 21:26:47 +01:00
|
|
|
Rescan: true,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + 1 opt",
|
|
|
|
cmd: "importprivkey",
|
2013-11-20 17:08:20 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewImportPrivKeyCmd(testID,
|
2013-11-20 17:08:20 +01:00
|
|
|
"somereallongprivatekey",
|
|
|
|
"some text")
|
|
|
|
},
|
|
|
|
result: &ImportPrivKeyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-20 17:08:20 +01:00
|
|
|
PrivKey: "somereallongprivatekey",
|
|
|
|
Label: "some text",
|
|
|
|
Rescan: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + 2 opts",
|
|
|
|
cmd: "importprivkey",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewImportPrivKeyCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"somereallongprivatekey",
|
|
|
|
"some text",
|
|
|
|
false)
|
|
|
|
},
|
|
|
|
result: &ImportPrivKeyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
PrivKey: "somereallongprivatekey",
|
|
|
|
Label: "some text",
|
2013-11-18 15:13:02 +01:00
|
|
|
Rescan: false,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "importwallet",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewImportWalletCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"walletfilename.dat")
|
|
|
|
},
|
|
|
|
result: &ImportWalletCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
Filename: "walletfilename.dat",
|
|
|
|
},
|
|
|
|
},
|
2014-12-02 14:58:23 +01:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "invalidateblock",
|
|
|
|
f: func() (Cmd, error) {
|
|
|
|
return NewInvalidateBlockCmd(testID,
|
|
|
|
"lotsofhex")
|
|
|
|
},
|
|
|
|
result: &InvalidateBlockCmd{
|
|
|
|
id: testID,
|
|
|
|
BlockHash: "lotsofhex",
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "keypoolrefill",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewKeyPoolRefillCmd(testID)
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &KeyPoolRefillCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
2014-01-17 18:18:34 +01:00
|
|
|
{
|
|
|
|
name: "newsize",
|
|
|
|
cmd: "keypoolrefill",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewKeyPoolRefillCmd(testID, 1000000)
|
2014-01-17 18:18:34 +01:00
|
|
|
},
|
|
|
|
result: &KeyPoolRefillCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-17 18:18:34 +01:00
|
|
|
NewSize: 1000000,
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "listaccounts",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListAccountsCmd(testID, 1)
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &ListAccountsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
MinConf: 1,
|
|
|
|
},
|
|
|
|
},
|
2014-01-08 16:31:54 +01:00
|
|
|
{
|
|
|
|
name: "basic + opt",
|
|
|
|
cmd: "listaccounts",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListAccountsCmd(testID, 2)
|
2014-01-08 16:31:54 +01:00
|
|
|
},
|
|
|
|
result: &ListAccountsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-08 16:31:54 +01:00
|
|
|
MinConf: 2,
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "listaddressgroupings",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListAddressGroupingsCmd(testID)
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &ListAddressGroupingsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
},
|
2013-11-07 20:11:50 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "listlockunspent",
|
2013-11-07 20:11:50 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListLockUnspentCmd(testID)
|
2013-11-07 20:11:50 +01:00
|
|
|
},
|
|
|
|
result: &ListLockUnspentCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-07 20:11:50 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "listreceivedbyaccount",
|
2013-11-07 20:11:50 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListReceivedByAccountCmd(testID)
|
2013-11-07 20:11:50 +01:00
|
|
|
},
|
|
|
|
result: &ListReceivedByAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-07 20:11:50 +01:00
|
|
|
MinConf: 1,
|
|
|
|
},
|
|
|
|
},
|
2014-01-07 19:49:45 +01:00
|
|
|
{
|
|
|
|
name: "basic + 1 opt",
|
|
|
|
cmd: "listreceivedbyaccount",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListReceivedByAccountCmd(testID, 2)
|
2014-01-07 19:49:45 +01:00
|
|
|
},
|
|
|
|
result: &ListReceivedByAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-07 19:49:45 +01:00
|
|
|
MinConf: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + 2 opt",
|
|
|
|
cmd: "listreceivedbyaccount",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListReceivedByAccountCmd(testID, 2, true)
|
2014-01-07 19:49:45 +01:00
|
|
|
},
|
|
|
|
result: &ListReceivedByAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-07 19:49:45 +01:00
|
|
|
MinConf: 2,
|
|
|
|
IncludeEmpty: true,
|
|
|
|
},
|
|
|
|
},
|
2014-01-07 16:22:17 +01:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "listreceivedbyaddress",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListReceivedByAddressCmd(testID)
|
2014-01-07 16:22:17 +01:00
|
|
|
},
|
|
|
|
result: &ListReceivedByAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-07 16:22:17 +01:00
|
|
|
MinConf: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + 1 opt",
|
|
|
|
cmd: "listreceivedbyaddress",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListReceivedByAddressCmd(testID, 2)
|
2014-01-07 16:22:17 +01:00
|
|
|
},
|
|
|
|
result: &ListReceivedByAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-07 16:22:17 +01:00
|
|
|
MinConf: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + 2 opt",
|
|
|
|
cmd: "listreceivedbyaddress",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListReceivedByAddressCmd(testID, 2, true)
|
2014-01-07 16:22:17 +01:00
|
|
|
},
|
|
|
|
result: &ListReceivedByAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-07 16:22:17 +01:00
|
|
|
MinConf: 2,
|
|
|
|
IncludeEmpty: true,
|
|
|
|
},
|
|
|
|
},
|
2014-01-06 17:02:32 +01:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "listsinceblock",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListSinceBlockCmd(testID)
|
2014-01-06 17:02:32 +01:00
|
|
|
},
|
|
|
|
result: &ListSinceBlockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-06 17:02:32 +01:00
|
|
|
TargetConfirmations: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + 1 ops",
|
|
|
|
cmd: "listsinceblock",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListSinceBlockCmd(testID, "someblockhash")
|
2014-01-06 17:02:32 +01:00
|
|
|
},
|
|
|
|
result: &ListSinceBlockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-06 17:02:32 +01:00
|
|
|
BlockHash: "someblockhash",
|
|
|
|
TargetConfirmations: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "basic + 2 ops",
|
|
|
|
cmd: "listsinceblock",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListSinceBlockCmd(testID, "someblockhash", 3)
|
2014-01-06 17:02:32 +01:00
|
|
|
},
|
|
|
|
result: &ListSinceBlockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-06 17:02:32 +01:00
|
|
|
BlockHash: "someblockhash",
|
|
|
|
TargetConfirmations: 3,
|
|
|
|
},
|
|
|
|
},
|
2013-11-26 22:08:31 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "listtransactions",
|
2013-11-26 22:08:31 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListTransactionsCmd(testID)
|
2013-11-26 22:08:31 +01:00
|
|
|
},
|
|
|
|
result: &ListTransactionsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: nil,
|
2013-11-26 22:08:31 +01:00
|
|
|
Count: 10,
|
|
|
|
From: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "+ 1 optarg",
|
|
|
|
cmd: "listtransactions",
|
2013-11-26 22:08:31 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewListTransactionsCmd(testID, testAccount)
|
2013-11-26 22:08:31 +01:00
|
|
|
},
|
|
|
|
result: &ListTransactionsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: &testAccount,
|
2013-11-26 22:08:31 +01:00
|
|
|
Count: 10,
|
|
|
|
From: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "+ 2 optargs",
|
|
|
|
cmd: "listtransactions",
|
2013-11-26 22:08:31 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewListTransactionsCmd(testID, testAccount, 123)
|
2013-11-26 22:08:31 +01:00
|
|
|
},
|
|
|
|
result: &ListTransactionsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: &testAccount,
|
2013-11-26 22:08:31 +01:00
|
|
|
Count: 123,
|
|
|
|
From: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "+ 3 optargs",
|
|
|
|
cmd: "listtransactions",
|
2013-11-26 22:08:31 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-11-18 13:52:10 +01:00
|
|
|
return NewListTransactionsCmd(testID, testAccount, 123, 456)
|
2013-11-26 22:08:31 +01:00
|
|
|
},
|
|
|
|
result: &ListTransactionsCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
Account: &testAccount,
|
2013-11-26 22:08:31 +01:00
|
|
|
Count: 123,
|
|
|
|
From: 456,
|
|
|
|
},
|
|
|
|
},
|
2013-11-07 20:11:50 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "listunspent",
|
2013-11-07 20:11:50 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListUnspentCmd(testID)
|
2013-11-07 20:11:50 +01:00
|
|
|
},
|
|
|
|
result: &ListUnspentCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-07 20:11:50 +01:00
|
|
|
MinConf: 1,
|
|
|
|
MaxConf: 999999,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + opts",
|
|
|
|
cmd: "listunspent",
|
2013-11-07 20:11:50 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListUnspentCmd(testID, 0, 6)
|
2013-11-07 20:11:50 +01:00
|
|
|
},
|
|
|
|
result: &ListUnspentCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-07 20:11:50 +01:00
|
|
|
MinConf: 0,
|
|
|
|
MaxConf: 6,
|
|
|
|
},
|
|
|
|
},
|
2014-01-17 18:04:49 +01:00
|
|
|
{
|
|
|
|
name: "basic + opts + addresses",
|
|
|
|
cmd: "listunspent",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewListUnspentCmd(testID, 0, 6, []string{
|
2014-01-17 18:04:49 +01:00
|
|
|
"a", "b", "c",
|
|
|
|
})
|
|
|
|
},
|
|
|
|
result: &ListUnspentCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-17 18:04:49 +01:00
|
|
|
MinConf: 0,
|
|
|
|
MaxConf: 6,
|
|
|
|
Addresses: []string{"a", "b", "c"},
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "lockunspent",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewLockUnspentCmd(testID, true)
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
|
|
|
result: &LockUnspentCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
Unlock: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "move",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewMoveCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"account1",
|
|
|
|
"account2",
|
|
|
|
12,
|
|
|
|
1)
|
|
|
|
},
|
|
|
|
result: &MoveCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
FromAccount: "account1",
|
|
|
|
ToAccount: "account2",
|
|
|
|
Amount: 12,
|
|
|
|
MinConf: 1, // the default
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optionals",
|
|
|
|
cmd: "move",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewMoveCmd(testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
"account1",
|
|
|
|
"account2",
|
|
|
|
12,
|
|
|
|
1,
|
|
|
|
"some comment")
|
|
|
|
},
|
|
|
|
result: &MoveCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
FromAccount: "account1",
|
|
|
|
ToAccount: "account2",
|
|
|
|
Amount: 12,
|
|
|
|
MinConf: 1, // the default
|
|
|
|
Comment: "some comment",
|
|
|
|
},
|
|
|
|
},
|
2013-10-22 16:12:12 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "ping",
|
2013-10-22 16:12:12 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewPingCmd(testID)
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
2013-10-25 19:36:27 +02:00
|
|
|
result: &PingCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-22 16:12:12 +02:00
|
|
|
},
|
|
|
|
},
|
2014-12-02 14:58:23 +01:00
|
|
|
{
|
|
|
|
name: "basic",
|
|
|
|
cmd: "reconsiderblock",
|
|
|
|
f: func() (Cmd, error) {
|
|
|
|
return NewReconsiderBlockCmd(testID,
|
|
|
|
"lotsofhex")
|
|
|
|
},
|
|
|
|
result: &ReconsiderBlockCmd{
|
|
|
|
id: testID,
|
|
|
|
BlockHash: "lotsofhex",
|
|
|
|
},
|
|
|
|
},
|
2014-12-29 04:21:40 +01:00
|
|
|
{
|
|
|
|
name: "basic + optionals",
|
2015-02-05 20:35:18 +01:00
|
|
|
cmd: "searchrawtransactions",
|
2014-12-29 04:21:40 +01:00
|
|
|
f: func() (Cmd, error) {
|
2015-02-05 20:35:18 +01:00
|
|
|
return NewSearchRawTransactionsCmd(testID,
|
|
|
|
"someaddr", 1, 5, 200)
|
2014-12-29 04:21:40 +01:00
|
|
|
},
|
2015-02-05 20:35:18 +01:00
|
|
|
result: &SearchRawTransactionsCmd{
|
2014-12-29 04:21:40 +01:00
|
|
|
id: testID,
|
|
|
|
Address: "someaddr",
|
2015-02-05 20:35:18 +01:00
|
|
|
Verbose: 1,
|
2014-12-29 04:21:40 +01:00
|
|
|
Skip: 5,
|
|
|
|
Count: 200,
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 21:41:23 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "sendfrom",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendFromCmd(testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
testAccount,
|
2013-10-25 21:41:23 +02:00
|
|
|
"address",
|
|
|
|
12,
|
|
|
|
1)
|
|
|
|
},
|
|
|
|
result: &SendFromCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
FromAccount: testAccount,
|
2013-10-25 21:41:23 +02:00
|
|
|
ToAddress: "address",
|
|
|
|
Amount: 12,
|
|
|
|
MinConf: 1, // the default
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + options",
|
|
|
|
cmd: "sendfrom",
|
2013-10-30 14:58:57 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendFromCmd(testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
testAccount,
|
2013-10-30 14:58:57 +01:00
|
|
|
"address",
|
|
|
|
12,
|
|
|
|
1,
|
|
|
|
"a comment",
|
|
|
|
"comment to")
|
|
|
|
},
|
|
|
|
result: &SendFromCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
FromAccount: testAccount,
|
2013-10-30 14:58:57 +01:00
|
|
|
ToAddress: "address",
|
|
|
|
Amount: 12,
|
|
|
|
MinConf: 1, // the default
|
|
|
|
Comment: "a comment",
|
|
|
|
CommentTo: "comment to",
|
|
|
|
},
|
|
|
|
},
|
2013-11-28 01:27:46 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "sendmany",
|
2013-11-28 01:27:46 +01:00
|
|
|
f: func() (Cmd, error) {
|
|
|
|
pairs := map[string]int64{
|
|
|
|
"address A": 1000,
|
|
|
|
"address B": 2000,
|
|
|
|
"address C": 3000,
|
|
|
|
}
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendManyCmd(testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
testAccount,
|
2013-11-28 01:27:46 +01:00
|
|
|
pairs)
|
|
|
|
},
|
|
|
|
result: &SendManyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
FromAccount: testAccount,
|
2013-11-28 01:27:46 +01:00
|
|
|
Amounts: map[string]int64{
|
|
|
|
"address A": 1000,
|
|
|
|
"address B": 2000,
|
|
|
|
"address C": 3000,
|
|
|
|
},
|
|
|
|
MinConf: 1, // the default
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "+ options",
|
|
|
|
cmd: "sendmany",
|
2013-11-28 01:27:46 +01:00
|
|
|
f: func() (Cmd, error) {
|
|
|
|
pairs := map[string]int64{
|
|
|
|
"address A": 1000,
|
|
|
|
"address B": 2000,
|
|
|
|
"address C": 3000,
|
|
|
|
}
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendManyCmd(testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
testAccount,
|
2013-11-28 01:27:46 +01:00
|
|
|
pairs,
|
|
|
|
10,
|
|
|
|
"comment")
|
|
|
|
},
|
|
|
|
result: &SendManyCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-11-18 13:52:10 +01:00
|
|
|
FromAccount: testAccount,
|
2013-11-28 01:27:46 +01:00
|
|
|
Amounts: map[string]int64{
|
|
|
|
"address A": 1000,
|
|
|
|
"address B": 2000,
|
|
|
|
"address C": 3000,
|
|
|
|
},
|
|
|
|
MinConf: 10,
|
|
|
|
Comment: "comment",
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 21:41:23 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "sendrawtransaction",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendRawTransactionCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"hexstringofatx")
|
|
|
|
},
|
|
|
|
result: &SendRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
HexTx: "hexstringofatx",
|
|
|
|
},
|
|
|
|
},
|
2014-01-17 18:11:35 +01:00
|
|
|
{
|
|
|
|
name: "allowhighfees: false",
|
|
|
|
cmd: "sendrawtransaction",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendRawTransactionCmd(testID,
|
2014-01-17 18:11:35 +01:00
|
|
|
"hexstringofatx", false)
|
|
|
|
},
|
|
|
|
result: &SendRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-17 18:11:35 +01:00
|
|
|
HexTx: "hexstringofatx",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "allowhighfees: true",
|
|
|
|
cmd: "sendrawtransaction",
|
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendRawTransactionCmd(testID,
|
2014-01-17 18:11:35 +01:00
|
|
|
"hexstringofatx", true)
|
|
|
|
},
|
|
|
|
result: &SendRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-01-17 18:11:35 +01:00
|
|
|
HexTx: "hexstringofatx",
|
|
|
|
AllowHighFees: true,
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 21:41:23 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "sendtoaddress",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendToAddressCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"somebtcaddress",
|
|
|
|
1)
|
|
|
|
},
|
|
|
|
result: &SendToAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
Address: "somebtcaddress",
|
|
|
|
Amount: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optional",
|
|
|
|
cmd: "sendtoaddress",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSendToAddressCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"somebtcaddress",
|
|
|
|
1,
|
|
|
|
"a comment",
|
|
|
|
"comment to")
|
|
|
|
},
|
|
|
|
result: &SendToAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
Address: "somebtcaddress",
|
|
|
|
Amount: 1,
|
|
|
|
Comment: "a comment",
|
|
|
|
CommentTo: "comment to",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "setaccount",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSetAccountCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"somebtcaddress",
|
|
|
|
"account name")
|
|
|
|
},
|
|
|
|
result: &SetAccountCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
Address: "somebtcaddress",
|
|
|
|
Account: "account name",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "setgenerate",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSetGenerateCmd(testID, true)
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
result: &SetGenerateCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2014-06-12 04:56:59 +02:00
|
|
|
Generate: true,
|
|
|
|
GenProcLimit: -1,
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optional",
|
|
|
|
cmd: "setgenerate",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSetGenerateCmd(testID, true, 10)
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
result: &SetGenerateCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
Generate: true,
|
|
|
|
GenProcLimit: 10,
|
|
|
|
},
|
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "settxfee",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSetTxFeeCmd(testID, 10)
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
result: &SetTxFeeCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-30 14:58:57 +01:00
|
|
|
Amount: 10,
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
2013-10-30 14:58:57 +01:00
|
|
|
},
|
2013-11-05 22:51:37 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "signmessage",
|
2013-11-05 22:51:37 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSignMessageCmd(testID,
|
2013-11-05 22:51:37 +01:00
|
|
|
"btcaddress",
|
|
|
|
"a message")
|
|
|
|
},
|
|
|
|
result: &SignMessageCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-11-05 22:51:37 +01:00
|
|
|
Address: "btcaddress",
|
|
|
|
Message: "a message",
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 21:41:23 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "signrawtransaction",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSignRawTransactionCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"sometxstring")
|
|
|
|
},
|
|
|
|
result: &SignRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
RawTx: "sometxstring",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/* {
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optional",
|
|
|
|
cmd: "signrawtransaction",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSignRawTransactionCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"sometxstring",
|
|
|
|
[]RawTxInput{
|
|
|
|
RawTxInput{
|
|
|
|
Txid: "test",
|
|
|
|
Vout: 1,
|
|
|
|
ScriptPubKey: "test",
|
|
|
|
RedeemScript: "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[]string{"aprivatekey", "privkey2"},
|
|
|
|
"flags")
|
|
|
|
},
|
|
|
|
result: &SignRawTransactionCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
RawTx: "sometxstring",
|
|
|
|
Inputs: []RawTxInput{
|
|
|
|
RawTxInput{
|
|
|
|
Txid: "test",
|
|
|
|
Vout: 1,
|
|
|
|
ScriptPubKey: "test",
|
|
|
|
RedeemScript: "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
PrivKeys: []string{"aprivatekey", "privkey2"},
|
|
|
|
Flags: "flags",
|
|
|
|
},
|
|
|
|
},*/
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "stop",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewStopCmd(testID)
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
result: &StopCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "submitblock",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSubmitBlockCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"lotsofhex")
|
|
|
|
},
|
|
|
|
result: &SubmitBlockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
HexBlock: "lotsofhex",
|
|
|
|
},
|
|
|
|
},
|
2013-10-31 21:37:14 +01:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "+ optional object",
|
|
|
|
cmd: "submitblock",
|
2013-10-31 21:37:14 +01:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewSubmitBlockCmd(testID,
|
2013-10-31 21:37:14 +01:00
|
|
|
"lotsofhex",
|
2014-06-27 07:25:00 +02:00
|
|
|
&SubmitBlockOptions{WorkID: "otherstuff"})
|
2013-10-31 21:37:14 +01:00
|
|
|
},
|
|
|
|
result: &SubmitBlockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-31 21:37:14 +01:00
|
|
|
HexBlock: "lotsofhex",
|
2014-06-27 07:25:00 +02:00
|
|
|
Options: &SubmitBlockOptions{WorkID: "otherstuff"},
|
2013-10-31 21:37:14 +01:00
|
|
|
},
|
|
|
|
},
|
2013-10-25 21:41:23 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "validateaddress",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewValidateAddressCmd(testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
"somebtcaddress")
|
|
|
|
},
|
|
|
|
result: &ValidateAddressCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
Address: "somebtcaddress",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "verifychain",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewVerifyChainCmd(testID)
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
result: &VerifyChainCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
CheckLevel: 3,
|
|
|
|
CheckDepth: 288,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic + optional",
|
|
|
|
cmd: "verifychain",
|
2013-10-25 21:41:23 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewVerifyChainCmd(testID, 4, 1)
|
2013-10-25 21:41:23 +02:00
|
|
|
},
|
|
|
|
result: &VerifyChainCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 21:41:23 +02:00
|
|
|
CheckLevel: 4,
|
|
|
|
CheckDepth: 1,
|
|
|
|
},
|
|
|
|
},
|
2013-10-25 19:07:45 +02:00
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "verifymessage",
|
2013-10-25 19:07:45 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewVerifyMessageCmd(testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
"someaddress",
|
|
|
|
"somesig",
|
|
|
|
"a message")
|
|
|
|
},
|
|
|
|
result: &VerifyMessageCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
Address: "someaddress",
|
|
|
|
Signature: "somesig",
|
|
|
|
Message: "a message",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "walletlock",
|
2013-10-25 19:07:45 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewWalletLockCmd(testID)
|
2013-10-25 19:07:45 +02:00
|
|
|
},
|
|
|
|
result: &WalletLockCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "walletpassphrase",
|
2013-10-25 19:07:45 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewWalletPassphraseCmd(testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
"phrase1",
|
|
|
|
10)
|
|
|
|
},
|
|
|
|
result: &WalletPassphraseCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
Passphrase: "phrase1",
|
|
|
|
Timeout: 10,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2014-01-06 16:12:35 +01:00
|
|
|
name: "basic",
|
|
|
|
cmd: "walletpassphrasechange",
|
2013-10-25 19:07:45 +02:00
|
|
|
f: func() (Cmd, error) {
|
2014-07-15 16:09:35 +02:00
|
|
|
return NewWalletPassphraseChangeCmd(testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
"phrase1", "phrase2")
|
|
|
|
},
|
|
|
|
result: &WalletPassphraseChangeCmd{
|
2014-07-15 16:09:35 +02:00
|
|
|
id: testID,
|
2013-10-25 19:07:45 +02:00
|
|
|
OldPassphrase: "phrase1",
|
|
|
|
NewPassphrase: "phrase2",
|
|
|
|
},
|
|
|
|
},
|
2013-10-22 16:12:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCmds(t *testing.T) {
|
|
|
|
for _, test := range jsoncmdtests {
|
|
|
|
c, err := test.f()
|
2014-01-06 16:12:35 +01:00
|
|
|
name := test.cmd + " " + test.name
|
2013-10-22 16:12:12 +02:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("%s: failed to run func: %v",
|
2014-01-06 16:12:35 +01:00
|
|
|
name, err)
|
2013-10-22 16:12:12 +02:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
msg, err := json.Marshal(c)
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("%s: failed to marshal cmd: %v",
|
2014-01-06 16:12:35 +01:00
|
|
|
name, err)
|
2013-10-22 16:12:12 +02:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
c2, err := ParseMarshaledCmd(msg)
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("%s: failed to ummarshal cmd: %v",
|
2014-01-06 16:12:35 +01:00
|
|
|
name, err)
|
2013-10-22 16:12:12 +02:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2014-01-03 23:50:17 +01:00
|
|
|
id, ok := (c.Id()).(float64)
|
2014-07-15 16:09:35 +02:00
|
|
|
if !ok || id != testID {
|
2014-01-06 16:12:35 +01:00
|
|
|
t.Errorf("%s: id not returned properly", name)
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.Method() != test.cmd {
|
|
|
|
t.Errorf("%s: Method name not returned properly: "+
|
|
|
|
"%s vs. %s", name, c.Method(), test.cmd)
|
2014-01-03 23:50:17 +01:00
|
|
|
}
|
|
|
|
|
2013-10-22 16:12:12 +02:00
|
|
|
if !reflect.DeepEqual(test.result, c2) {
|
|
|
|
t.Errorf("%s: unmarshal not as expected. "+
|
2014-01-06 16:12:35 +01:00
|
|
|
"got %v wanted %v", name, spew.Sdump(c2),
|
2013-10-22 16:12:12 +02:00
|
|
|
spew.Sdump(test.result))
|
|
|
|
}
|
|
|
|
if !reflect.DeepEqual(c, c2) {
|
|
|
|
t.Errorf("%s: unmarshal not as we started with. "+
|
2014-01-06 16:12:35 +01:00
|
|
|
"got %v wanted %v", name, spew.Sdump(c2),
|
2013-10-22 16:12:12 +02:00
|
|
|
spew.Sdump(c))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-01-08 17:06:54 +01:00
|
|
|
|
|
|
|
func TestHelps(t *testing.T) {
|
|
|
|
helpTests := []string{
|
|
|
|
"addmultisigaddress",
|
|
|
|
"addnode",
|
|
|
|
"backupwallet",
|
|
|
|
"createmultisig",
|
|
|
|
"createrawtransaction",
|
|
|
|
"debuglevel",
|
|
|
|
"decoderawtransaction",
|
|
|
|
"decodescript",
|
|
|
|
"dumpprivkey",
|
|
|
|
"dumpwallet",
|
|
|
|
"encryptwallet",
|
2014-06-11 17:05:13 +02:00
|
|
|
"estimatefee",
|
|
|
|
"estimatepriority",
|
2014-01-08 17:06:54 +01:00
|
|
|
"getaccount",
|
|
|
|
"getaccountaddress",
|
|
|
|
"getaddednodeinfo",
|
|
|
|
"getaddressesbyaccount",
|
|
|
|
"getbalance",
|
|
|
|
"getbestblockhash",
|
|
|
|
"getblock",
|
|
|
|
"getblockcount",
|
|
|
|
"getblockhash",
|
|
|
|
"getblocktemplate",
|
|
|
|
"getconnectioncount",
|
|
|
|
"getdifficulty",
|
|
|
|
"getgenerate",
|
|
|
|
"gethashespersec",
|
|
|
|
"getinfo",
|
|
|
|
"getmininginfo",
|
|
|
|
"getnettotals",
|
|
|
|
"getnetworkhashps",
|
|
|
|
"getnewaddress",
|
|
|
|
"getpeerinfo",
|
|
|
|
"getrawchangeaddress",
|
|
|
|
"getrawmempool",
|
|
|
|
"getrawtransaction",
|
|
|
|
"getreceivedbyaccount",
|
|
|
|
"getreceivedbyaddress",
|
|
|
|
"gettransaction",
|
|
|
|
"gettxout",
|
|
|
|
"gettxoutsetinfo",
|
|
|
|
"getwork",
|
|
|
|
"help",
|
|
|
|
"importprivkey",
|
|
|
|
"importwallet",
|
2014-12-02 14:58:23 +01:00
|
|
|
"invalidateblock",
|
2014-01-08 17:06:54 +01:00
|
|
|
"keypoolrefill",
|
|
|
|
"listaccounts",
|
|
|
|
"listaddressgroupings",
|
|
|
|
"listlockunspent",
|
|
|
|
"listreceivedbyaccount",
|
|
|
|
"listreceivedbyaddress",
|
|
|
|
"listsinceblock",
|
|
|
|
"listtransactions",
|
|
|
|
"listunspent",
|
|
|
|
"lockunspent",
|
|
|
|
"move",
|
|
|
|
"ping",
|
2014-12-02 14:58:23 +01:00
|
|
|
"reconsiderblock",
|
2015-02-05 20:35:18 +01:00
|
|
|
"searchrawtransactions",
|
2014-01-08 17:06:54 +01:00
|
|
|
"sendfrom",
|
|
|
|
"sendmany",
|
|
|
|
"sendrawtransaction",
|
|
|
|
"sendtoaddress",
|
|
|
|
"setaccount",
|
|
|
|
"setgenerate",
|
|
|
|
"settxfee",
|
|
|
|
"signmessage",
|
|
|
|
"signrawtransaction",
|
|
|
|
"stop",
|
|
|
|
"submitblock",
|
|
|
|
"validateaddress",
|
|
|
|
"verifychain",
|
|
|
|
"verifymessage",
|
|
|
|
"walletlock",
|
|
|
|
"walletpassphrase",
|
|
|
|
"walletpassphrasechange",
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, test := range helpTests {
|
|
|
|
helpStr, err := GetHelpString(test)
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("%s: failed to get help string: %v",
|
|
|
|
test, err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if !strings.HasPrefix(helpStr, test) {
|
|
|
|
t.Errorf("%s: help string doesn't begin with command "+
|
|
|
|
"name: \"%s\"", test, helpStr)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|