[DEV-213] Converted all RPC commands to lowercaseCamelCase. (#106)

This commit is contained in:
stasatdaglabs 2018-10-23 12:24:57 +03:00 committed by Ori Newman
parent 5e41d83015
commit ac01babfb1
24 changed files with 1410 additions and 1410 deletions

View File

@ -44,14 +44,14 @@ func NewNodeCmd(subCmd NodeSubCmd, target string, connectSubCmd *string) *NodeCm
}
}
// DebugLevelCmd defines the debuglevel JSON-RPC command. This command is not a
// DebugLevelCmd defines the debugLevel JSON-RPC command. This command is not a
// standard Bitcoin command. It is an extension for btcd.
type DebugLevelCmd struct {
LevelSpec string
}
// NewDebugLevelCmd returns a new DebugLevelCmd which can be used to issue a
// debuglevel JSON-RPC command. This command is not a standard Bitcoin command.
// debugLevel JSON-RPC command. This command is not a standard Bitcoin command.
// It is an extension for btcd.
func NewDebugLevelCmd(levelSpec string) *DebugLevelCmd {
return &DebugLevelCmd{
@ -72,25 +72,25 @@ func NewGenerateCmd(numBlocks uint32) *GenerateCmd {
}
}
// GetBestBlockCmd defines the getbestblock JSON-RPC command.
// GetBestBlockCmd defines the getBestBlock JSON-RPC command.
type GetBestBlockCmd struct{}
// NewGetBestBlockCmd returns a new instance which can be used to issue a
// getbestblock JSON-RPC command.
// getBestBlock JSON-RPC command.
func NewGetBestBlockCmd() *GetBestBlockCmd {
return &GetBestBlockCmd{}
}
// GetCurrentNetCmd defines the getcurrentnet JSON-RPC command.
// GetCurrentNetCmd defines the getCurrentNet JSON-RPC command.
type GetCurrentNetCmd struct{}
// NewGetCurrentNetCmd returns a new instance which can be used to issue a
// getcurrentnet JSON-RPC command.
// getCurrentNet JSON-RPC command.
func NewGetCurrentNetCmd() *GetCurrentNetCmd {
return &GetCurrentNetCmd{}
}
// GetHeadersCmd defines the getheaders JSON-RPC command.
// GetHeadersCmd defines the getHeaders JSON-RPC command.
//
// NOTE: This is a btcsuite extension ported from
// github.com/decred/dcrd/dcrjson.
@ -100,7 +100,7 @@ type GetHeadersCmd struct {
}
// NewGetHeadersCmd returns a new instance which can be used to issue a
// getheaders JSON-RPC command.
// getHeaders JSON-RPC command.
//
// NOTE: This is a btcsuite extension ported from
// github.com/decred/dcrd/dcrjson.
@ -128,11 +128,11 @@ func init() {
// No special flags for commands in this file.
flags := UsageFlag(0)
MustRegisterCmd("debuglevel", (*DebugLevelCmd)(nil), flags)
MustRegisterCmd("debugLevel", (*DebugLevelCmd)(nil), flags)
MustRegisterCmd("node", (*NodeCmd)(nil), flags)
MustRegisterCmd("generate", (*GenerateCmd)(nil), flags)
MustRegisterCmd("getbestblock", (*GetBestBlockCmd)(nil), flags)
MustRegisterCmd("getcurrentnet", (*GetCurrentNetCmd)(nil), flags)
MustRegisterCmd("getheaders", (*GetHeadersCmd)(nil), flags)
MustRegisterCmd("getBestBlock", (*GetBestBlockCmd)(nil), flags)
MustRegisterCmd("getCurrentNet", (*GetCurrentNetCmd)(nil), flags)
MustRegisterCmd("getHeaders", (*GetHeadersCmd)(nil), flags)
MustRegisterCmd("version", (*VersionCmd)(nil), flags)
}

View File

@ -31,14 +31,14 @@ func TestBtcdExtCmds(t *testing.T) {
unmarshalled interface{}
}{
{
name: "debuglevel",
name: "debugLevel",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("debuglevel", "trace")
return btcjson.NewCmd("debugLevel", "trace")
},
staticCmd: func() interface{} {
return btcjson.NewDebugLevelCmd("trace")
},
marshalled: `{"jsonrpc":"1.0","method":"debuglevel","params":["trace"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"debugLevel","params":["trace"],"id":1}`,
unmarshalled: &btcjson.DebugLevelCmd{
LevelSpec: "trace",
},
@ -115,31 +115,31 @@ func TestBtcdExtCmds(t *testing.T) {
},
},
{
name: "getbestblock",
name: "getBestBlock",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getbestblock")
return btcjson.NewCmd("getBestBlock")
},
staticCmd: func() interface{} {
return btcjson.NewGetBestBlockCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"getbestblock","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getBestBlock","params":[],"id":1}`,
unmarshalled: &btcjson.GetBestBlockCmd{},
},
{
name: "getcurrentnet",
name: "getCurrentNet",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getcurrentnet")
return btcjson.NewCmd("getCurrentNet")
},
staticCmd: func() interface{} {
return btcjson.NewGetCurrentNetCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"getcurrentnet","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getCurrentNet","params":[],"id":1}`,
unmarshalled: &btcjson.GetCurrentNetCmd{},
},
{
name: "getheaders",
name: "getHeaders",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getheaders", []string{}, "")
return btcjson.NewCmd("getHeaders", []string{}, "")
},
staticCmd: func() interface{} {
return btcjson.NewGetHeadersCmd(
@ -147,16 +147,16 @@ func TestBtcdExtCmds(t *testing.T) {
"",
)
},
marshalled: `{"jsonrpc":"1.0","method":"getheaders","params":[[],""],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getHeaders","params":[[],""],"id":1}`,
unmarshalled: &btcjson.GetHeadersCmd{
BlockLocators: []string{},
HashStop: "",
},
},
{
name: "getheaders - with arguments",
name: "getHeaders - with arguments",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getheaders", []string{"000000000000000001f1739002418e2f9a84c47a4fd2a0eb7a787a6b7dc12f16", "0000000000000000026f4b7f56eef057b32167eb5ad9ff62006f1807b7336d10"}, "000000000000000000ba33b33e1fad70b69e234fc24414dd47113bff38f523f7")
return btcjson.NewCmd("getHeaders", []string{"000000000000000001f1739002418e2f9a84c47a4fd2a0eb7a787a6b7dc12f16", "0000000000000000026f4b7f56eef057b32167eb5ad9ff62006f1807b7336d10"}, "000000000000000000ba33b33e1fad70b69e234fc24414dd47113bff38f523f7")
},
staticCmd: func() interface{} {
return btcjson.NewGetHeadersCmd(
@ -167,7 +167,7 @@ func TestBtcdExtCmds(t *testing.T) {
"000000000000000000ba33b33e1fad70b69e234fc24414dd47113bff38f523f7",
)
},
marshalled: `{"jsonrpc":"1.0","method":"getheaders","params":[["000000000000000001f1739002418e2f9a84c47a4fd2a0eb7a787a6b7dc12f16","0000000000000000026f4b7f56eef057b32167eb5ad9ff62006f1807b7336d10"],"000000000000000000ba33b33e1fad70b69e234fc24414dd47113bff38f523f7"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getHeaders","params":[["000000000000000001f1739002418e2f9a84c47a4fd2a0eb7a787a6b7dc12f16","0000000000000000026f4b7f56eef057b32167eb5ad9ff62006f1807b7336d10"],"000000000000000000ba33b33e1fad70b69e234fc24414dd47113bff38f523f7"],"id":1}`,
unmarshalled: &btcjson.GetHeadersCmd{
BlockLocators: []string{
"000000000000000001f1739002418e2f9a84c47a4fd2a0eb7a787a6b7dc12f16",

View File

@ -7,40 +7,40 @@
package btcjson
// CreateNewAccountCmd defines the createnewaccount JSON-RPC command.
// CreateNewAccountCmd defines the createNewAccount JSON-RPC command.
type CreateNewAccountCmd struct {
Account string
}
// NewCreateNewAccountCmd returns a new instance which can be used to issue a
// createnewaccount JSON-RPC command.
// createNewAccount JSON-RPC command.
func NewCreateNewAccountCmd(account string) *CreateNewAccountCmd {
return &CreateNewAccountCmd{
Account: account,
}
}
// DumpWalletCmd defines the dumpwallet JSON-RPC command.
// DumpWalletCmd defines the dumpWallet JSON-RPC command.
type DumpWalletCmd struct {
Filename string
}
// NewDumpWalletCmd returns a new instance which can be used to issue a
// dumpwallet JSON-RPC command.
// dumpWallet JSON-RPC command.
func NewDumpWalletCmd(filename string) *DumpWalletCmd {
return &DumpWalletCmd{
Filename: filename,
}
}
// ImportAddressCmd defines the importaddress JSON-RPC command.
// ImportAddressCmd defines the importAddress JSON-RPC command.
type ImportAddressCmd struct {
Address string
Rescan *bool `jsonrpcdefault:"true"`
}
// NewImportAddressCmd returns a new instance which can be used to issue an
// importaddress JSON-RPC command.
// importAddress JSON-RPC command.
func NewImportAddressCmd(address string, rescan *bool) *ImportAddressCmd {
return &ImportAddressCmd{
Address: address,
@ -48,14 +48,14 @@ func NewImportAddressCmd(address string, rescan *bool) *ImportAddressCmd {
}
}
// ImportPubKeyCmd defines the importpubkey JSON-RPC command.
// ImportPubKeyCmd defines the importPubKey JSON-RPC command.
type ImportPubKeyCmd struct {
PubKey string
Rescan *bool `jsonrpcdefault:"true"`
}
// NewImportPubKeyCmd returns a new instance which can be used to issue an
// importpubkey JSON-RPC command.
// importPubKey JSON-RPC command.
func NewImportPubKeyCmd(pubKey string, rescan *bool) *ImportPubKeyCmd {
return &ImportPubKeyCmd{
PubKey: pubKey,
@ -63,27 +63,27 @@ func NewImportPubKeyCmd(pubKey string, rescan *bool) *ImportPubKeyCmd {
}
}
// ImportWalletCmd defines the importwallet JSON-RPC command.
// ImportWalletCmd defines the importWallet JSON-RPC command.
type ImportWalletCmd struct {
Filename string
}
// NewImportWalletCmd returns a new instance which can be used to issue a
// importwallet JSON-RPC command.
// importWallet JSON-RPC command.
func NewImportWalletCmd(filename string) *ImportWalletCmd {
return &ImportWalletCmd{
Filename: filename,
}
}
// RenameAccountCmd defines the renameaccount JSON-RPC command.
// RenameAccountCmd defines the renameAccount JSON-RPC command.
type RenameAccountCmd struct {
OldAccount string
NewAccount string
}
// NewRenameAccountCmd returns a new instance which can be used to issue a
// renameaccount JSON-RPC command.
// renameAccount JSON-RPC command.
func NewRenameAccountCmd(oldAccount, newAccount string) *RenameAccountCmd {
return &RenameAccountCmd{
OldAccount: oldAccount,
@ -95,10 +95,10 @@ func init() {
// The commands in this file are only usable with a wallet server.
flags := UFWalletOnly
MustRegisterCmd("createnewaccount", (*CreateNewAccountCmd)(nil), flags)
MustRegisterCmd("dumpwallet", (*DumpWalletCmd)(nil), flags)
MustRegisterCmd("importaddress", (*ImportAddressCmd)(nil), flags)
MustRegisterCmd("importpubkey", (*ImportPubKeyCmd)(nil), flags)
MustRegisterCmd("importwallet", (*ImportWalletCmd)(nil), flags)
MustRegisterCmd("renameaccount", (*RenameAccountCmd)(nil), flags)
MustRegisterCmd("createNewAccount", (*CreateNewAccountCmd)(nil), flags)
MustRegisterCmd("dumpWallet", (*DumpWalletCmd)(nil), flags)
MustRegisterCmd("importAddress", (*ImportAddressCmd)(nil), flags)
MustRegisterCmd("importPubKey", (*ImportPubKeyCmd)(nil), flags)
MustRegisterCmd("importWallet", (*ImportWalletCmd)(nil), flags)
MustRegisterCmd("renameAccount", (*RenameAccountCmd)(nil), flags)
}

View File

@ -30,109 +30,109 @@ func TestBtcWalletExtCmds(t *testing.T) {
unmarshalled interface{}
}{
{
name: "createnewaccount",
name: "createNewAccount",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("createnewaccount", "acct")
return btcjson.NewCmd("createNewAccount", "acct")
},
staticCmd: func() interface{} {
return btcjson.NewCreateNewAccountCmd("acct")
},
marshalled: `{"jsonrpc":"1.0","method":"createnewaccount","params":["acct"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"createNewAccount","params":["acct"],"id":1}`,
unmarshalled: &btcjson.CreateNewAccountCmd{
Account: "acct",
},
},
{
name: "dumpwallet",
name: "dumpWallet",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("dumpwallet", "filename")
return btcjson.NewCmd("dumpWallet", "filename")
},
staticCmd: func() interface{} {
return btcjson.NewDumpWalletCmd("filename")
},
marshalled: `{"jsonrpc":"1.0","method":"dumpwallet","params":["filename"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"dumpWallet","params":["filename"],"id":1}`,
unmarshalled: &btcjson.DumpWalletCmd{
Filename: "filename",
},
},
{
name: "importaddress",
name: "importAddress",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("importaddress", "1Address")
return btcjson.NewCmd("importAddress", "1Address")
},
staticCmd: func() interface{} {
return btcjson.NewImportAddressCmd("1Address", nil)
},
marshalled: `{"jsonrpc":"1.0","method":"importaddress","params":["1Address"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"importAddress","params":["1Address"],"id":1}`,
unmarshalled: &btcjson.ImportAddressCmd{
Address: "1Address",
Rescan: btcjson.Bool(true),
},
},
{
name: "importaddress optional",
name: "importAddress optional",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("importaddress", "1Address", false)
return btcjson.NewCmd("importAddress", "1Address", false)
},
staticCmd: func() interface{} {
return btcjson.NewImportAddressCmd("1Address", btcjson.Bool(false))
},
marshalled: `{"jsonrpc":"1.0","method":"importaddress","params":["1Address",false],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"importAddress","params":["1Address",false],"id":1}`,
unmarshalled: &btcjson.ImportAddressCmd{
Address: "1Address",
Rescan: btcjson.Bool(false),
},
},
{
name: "importpubkey",
name: "importPubKey",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("importpubkey", "031234")
return btcjson.NewCmd("importPubKey", "031234")
},
staticCmd: func() interface{} {
return btcjson.NewImportPubKeyCmd("031234", nil)
},
marshalled: `{"jsonrpc":"1.0","method":"importpubkey","params":["031234"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"importPubKey","params":["031234"],"id":1}`,
unmarshalled: &btcjson.ImportPubKeyCmd{
PubKey: "031234",
Rescan: btcjson.Bool(true),
},
},
{
name: "importpubkey optional",
name: "importPubKey optional",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("importpubkey", "031234", false)
return btcjson.NewCmd("importPubKey", "031234", false)
},
staticCmd: func() interface{} {
return btcjson.NewImportPubKeyCmd("031234", btcjson.Bool(false))
},
marshalled: `{"jsonrpc":"1.0","method":"importpubkey","params":["031234",false],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"importPubKey","params":["031234",false],"id":1}`,
unmarshalled: &btcjson.ImportPubKeyCmd{
PubKey: "031234",
Rescan: btcjson.Bool(false),
},
},
{
name: "importwallet",
name: "importWallet",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("importwallet", "filename")
return btcjson.NewCmd("importWallet", "filename")
},
staticCmd: func() interface{} {
return btcjson.NewImportWalletCmd("filename")
},
marshalled: `{"jsonrpc":"1.0","method":"importwallet","params":["filename"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"importWallet","params":["filename"],"id":1}`,
unmarshalled: &btcjson.ImportWalletCmd{
Filename: "filename",
},
},
{
name: "renameaccount",
name: "renameAccount",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("renameaccount", "oldacct", "newacct")
return btcjson.NewCmd("renameAccount", "oldacct", "newacct")
},
staticCmd: func() interface{} {
return btcjson.NewRenameAccountCmd("oldacct", "newacct")
},
marshalled: `{"jsonrpc":"1.0","method":"renameaccount","params":["oldacct","newacct"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"renameAccount","params":["oldacct","newacct"],"id":1}`,
unmarshalled: &btcjson.RenameAccountCmd{
OldAccount: "oldacct",
NewAccount: "newacct",

View File

@ -30,12 +30,12 @@ func TestCmdMethod(t *testing.T) {
{
name: "nil pointer of registered type",
cmd: (*btcjson.GetBlockCmd)(nil),
method: "getblock",
method: "getBlock",
},
{
name: "nil instance of registered type",
cmd: &btcjson.GetBlockCountCmd{},
method: "getblockcount",
method: "getBlockCount",
},
}
@ -82,17 +82,17 @@ func TestMethodUsageFlags(t *testing.T) {
}{
{
name: "unregistered type",
method: "bogusmethod",
method: "bogusMethod",
err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod},
},
{
name: "getblock",
method: "getblock",
name: "getBlock",
method: "getBlock",
flags: 0,
},
{
name: "walletpassphrase",
method: "walletpassphrase",
name: "walletPassphrase",
method: "walletPassphrase",
flags: btcjson.UFWalletOnly,
},
}
@ -140,18 +140,18 @@ func TestMethodUsageText(t *testing.T) {
}{
{
name: "unregistered type",
method: "bogusmethod",
method: "bogusMethod",
err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod},
},
{
name: "getblockcount",
method: "getblockcount",
expected: "getblockcount",
name: "getBlockCount",
method: "getBlockCount",
expected: "getBlockCount",
},
{
name: "getblock",
method: "getblock",
expected: `getblock "hash" (verbose=true verbosetx=false)`,
name: "getBlock",
method: "getBlock",
expected: `getBlock "hash" (verbose=true verbosetx=false)`,
},
}

View File

@ -359,25 +359,25 @@ func TestNewCmdErrors(t *testing.T) {
}{
{
name: "unregistered command",
method: "boguscommand",
method: "bogusCommand",
args: []interface{}{},
err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod},
},
{
name: "too few parameters to command with required + optional",
method: "getblock",
method: "getBlock",
args: []interface{}{},
err: btcjson.Error{ErrorCode: btcjson.ErrNumParams},
},
{
name: "too many parameters to command with no optional",
method: "getblockcount",
method: "getBlockCount",
args: []interface{}{"123"},
err: btcjson.Error{ErrorCode: btcjson.ErrNumParams},
},
{
name: "incorrect parameter type",
method: "getblock",
method: "getBlock",
args: []interface{}{1},
err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType},
},
@ -462,7 +462,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
name: "unregistered type",
request: btcjson.Request{
Jsonrpc: "1.0",
Method: "bogusmethod",
Method: "bogusMethod",
Params: nil,
ID: nil,
},
@ -472,7 +472,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
name: "incorrect number of params",
request: btcjson.Request{
Jsonrpc: "1.0",
Method: "getblockcount",
Method: "getBlockCount",
Params: []json.RawMessage{[]byte(`"bogusparam"`)},
ID: nil,
},
@ -482,7 +482,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
name: "invalid type for a parameter",
request: btcjson.Request{
Jsonrpc: "1.0",
Method: "getblock",
Method: "getBlock",
Params: []json.RawMessage{[]byte("1")},
ID: nil,
},
@ -492,7 +492,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
name: "invalid JSON for a parameter",
request: btcjson.Request{
Jsonrpc: "1.0",
Method: "getblock",
Method: "getBlock",
Params: []json.RawMessage{[]byte(`"1`)},
ID: nil,
},

View File

@ -14,13 +14,13 @@ import (
"github.com/daglabs/btcd/wire"
)
// AddManualNodeCmd defines the addmanualnode JSON-RPC command.
// AddManualNodeCmd defines the addManualNode JSON-RPC command.
type AddManualNodeCmd struct {
Addr string
OneTry *bool `jsonrpcdefault:"false"`
}
// NewAddManualNodeCmd returns a new instance which can be used to issue an addmanualnode
// NewAddManualNodeCmd returns a new instance which can be used to issue an addManualNode
// JSON-RPC command.
func NewAddManualNodeCmd(addr string, oneTry *bool) *AddManualNodeCmd {
return &AddManualNodeCmd{
@ -29,12 +29,12 @@ func NewAddManualNodeCmd(addr string, oneTry *bool) *AddManualNodeCmd {
}
}
// RemoveManualNodeCmd defines the removemanualnode JSON-RPC command.
// RemoveManualNodeCmd defines the removeManualNode JSON-RPC command.
type RemoveManualNodeCmd struct {
Addr string
}
// NewRemoveManualNodeCmd returns a new instance which can be used to issue an removemanualnode
// NewRemoveManualNodeCmd returns a new instance which can be used to issue an removeManualNode
// JSON-RPC command.
func NewRemoveManualNodeCmd(addr string) *RemoveManualNodeCmd {
return &RemoveManualNodeCmd{
@ -49,7 +49,7 @@ type TransactionInput struct {
Vout uint32 `json:"vout"`
}
// CreateRawTransactionCmd defines the createrawtransaction JSON-RPC command.
// CreateRawTransactionCmd defines the createRawTransaction JSON-RPC command.
type CreateRawTransactionCmd struct {
Inputs []TransactionInput
Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
@ -57,7 +57,7 @@ type CreateRawTransactionCmd struct {
}
// NewCreateRawTransactionCmd returns a new instance which can be used to issue
// a createrawtransaction JSON-RPC command.
// a createRawTransaction JSON-RPC command.
//
// Amounts are in BTC.
func NewCreateRawTransactionCmd(inputs []TransactionInput, amounts map[string]float64,
@ -70,40 +70,40 @@ func NewCreateRawTransactionCmd(inputs []TransactionInput, amounts map[string]fl
}
}
// DecodeRawTransactionCmd defines the decoderawtransaction JSON-RPC command.
// DecodeRawTransactionCmd defines the decodeRawTransaction JSON-RPC command.
type DecodeRawTransactionCmd struct {
HexTx string
}
// NewDecodeRawTransactionCmd returns a new instance which can be used to issue
// a decoderawtransaction JSON-RPC command.
// a decodeRawTransaction JSON-RPC command.
func NewDecodeRawTransactionCmd(hexTx string) *DecodeRawTransactionCmd {
return &DecodeRawTransactionCmd{
HexTx: hexTx,
}
}
// DecodeScriptCmd defines the decodescript JSON-RPC command.
// DecodeScriptCmd defines the decodeScript JSON-RPC command.
type DecodeScriptCmd struct {
HexScript string
}
// NewDecodeScriptCmd returns a new instance which can be used to issue a
// decodescript JSON-RPC command.
// decodeScript JSON-RPC command.
func NewDecodeScriptCmd(hexScript string) *DecodeScriptCmd {
return &DecodeScriptCmd{
HexScript: hexScript,
}
}
// GetManualNodeInfoCmd defines the getmanualnodeinfo JSON-RPC command.
// GetManualNodeInfoCmd defines the getManualNodeInfo JSON-RPC command.
type GetManualNodeInfoCmd struct {
Node string
Details *bool `jsonrpcdefault:"true"`
}
// NewGetManualNodeInfoCmd returns a new instance which can be used to issue a
// getmanualnodeinfo JSON-RPC command.
// getManualNodeInfo JSON-RPC command.
func NewGetManualNodeInfoCmd(node string, details *bool) *GetManualNodeInfoCmd {
return &GetManualNodeInfoCmd{
Details: details,
@ -111,36 +111,36 @@ func NewGetManualNodeInfoCmd(node string, details *bool) *GetManualNodeInfoCmd {
}
}
// GetAllManualNodesInfoCmd defines the getallmanualnodesinfo JSON-RPC command.
// GetAllManualNodesInfoCmd defines the getAllManualNodesInfo JSON-RPC command.
type GetAllManualNodesInfoCmd struct {
Details *bool `jsonrpcdefault:"true"`
}
// NewGetAllManualNodesInfoCmd returns a new instance which can be used to issue a
// getallmanualnodesinfo JSON-RPC command.
// getAllManualNodesInfo JSON-RPC command.
func NewGetAllManualNodesInfoCmd(details *bool) *GetAllManualNodesInfoCmd {
return &GetAllManualNodesInfoCmd{
Details: details,
}
}
// GetBestBlockHashCmd defines the getbestblockhash JSON-RPC command.
// GetBestBlockHashCmd defines the getBestBlockHash JSON-RPC command.
type GetBestBlockHashCmd struct{}
// NewGetBestBlockHashCmd returns a new instance which can be used to issue a
// getbestblockhash JSON-RPC command.
// getBestBlockHash JSON-RPC command.
func NewGetBestBlockHashCmd() *GetBestBlockHashCmd {
return &GetBestBlockHashCmd{}
}
// GetBlockCmd defines the getblock JSON-RPC command.
// GetBlockCmd defines the getBlock JSON-RPC command.
type GetBlockCmd struct {
Hash string
Verbose *bool `jsonrpcdefault:"true"`
VerboseTx *bool `jsonrpcdefault:"false"`
}
// NewGetBlockCmd returns a new instance which can be used to issue a getblock
// NewGetBlockCmd returns a new instance which can be used to issue a getBlock
// JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
@ -153,45 +153,45 @@ func NewGetBlockCmd(hash string, verbose, verboseTx *bool) *GetBlockCmd {
}
}
// GetBlockDAGInfoCmd defines the getblockdaginfo JSON-RPC command.
// GetBlockDAGInfoCmd defines the getBlockDagInfo JSON-RPC command.
type GetBlockDAGInfoCmd struct{}
// NewGetBlockDAGInfoCmd returns a new instance which can be used to issue a
// getblockdaginfo JSON-RPC command.
// getBlockDagInfo JSON-RPC command.
func NewGetBlockDAGInfoCmd() *GetBlockDAGInfoCmd {
return &GetBlockDAGInfoCmd{}
}
// GetBlockCountCmd defines the getblockcount JSON-RPC command.
// GetBlockCountCmd defines the getBlockCount JSON-RPC command.
type GetBlockCountCmd struct{}
// NewGetBlockCountCmd returns a new instance which can be used to issue a
// getblockcount JSON-RPC command.
// getBlockCount JSON-RPC command.
func NewGetBlockCountCmd() *GetBlockCountCmd {
return &GetBlockCountCmd{}
}
// GetBlockHashCmd defines the getblockhash JSON-RPC command.
// GetBlockHashCmd defines the getBlockHash JSON-RPC command.
type GetBlockHashCmd struct {
Index int64
}
// NewGetBlockHashCmd returns a new instance which can be used to issue a
// getblockhash JSON-RPC command.
// getBlockHash JSON-RPC command.
func NewGetBlockHashCmd(index int64) *GetBlockHashCmd {
return &GetBlockHashCmd{
Index: index,
}
}
// GetBlockHeaderCmd defines the getblockheader JSON-RPC command.
// GetBlockHeaderCmd defines the getBlockHeader JSON-RPC command.
type GetBlockHeaderCmd struct {
Hash string
Verbose *bool `jsonrpcdefault:"true"`
}
// NewGetBlockHeaderCmd returns a new instance which can be used to issue a
// getblockheader JSON-RPC command.
// getBlockHeader JSON-RPC command.
func NewGetBlockHeaderCmd(hash string, verbose *bool) *GetBlockHeaderCmd {
return &GetBlockHeaderCmd{
Hash: hash,
@ -271,13 +271,13 @@ func (t *TemplateRequest) UnmarshalJSON(data []byte) error {
return nil
}
// GetBlockTemplateCmd defines the getblocktemplate JSON-RPC command.
// GetBlockTemplateCmd defines the getBlockTemplate JSON-RPC command.
type GetBlockTemplateCmd struct {
Request *TemplateRequest
}
// NewGetBlockTemplateCmd returns a new instance which can be used to issue a
// getblocktemplate JSON-RPC command.
// getBlockTemplate JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -287,14 +287,14 @@ func NewGetBlockTemplateCmd(request *TemplateRequest) *GetBlockTemplateCmd {
}
}
// GetCFilterCmd defines the getcfilter JSON-RPC command.
// GetCFilterCmd defines the getCFilter JSON-RPC command.
type GetCFilterCmd struct {
Hash string
FilterType wire.FilterType
}
// NewGetCFilterCmd returns a new instance which can be used to issue a
// getcfilter JSON-RPC command.
// getCFilter JSON-RPC command.
func NewGetCFilterCmd(hash string, filterType wire.FilterType) *GetCFilterCmd {
return &GetCFilterCmd{
Hash: hash,
@ -302,14 +302,14 @@ func NewGetCFilterCmd(hash string, filterType wire.FilterType) *GetCFilterCmd {
}
}
// GetCFilterHeaderCmd defines the getcfilterheader JSON-RPC command.
// GetCFilterHeaderCmd defines the getCFilterHeader JSON-RPC command.
type GetCFilterHeaderCmd struct {
Hash string
FilterType wire.FilterType
}
// NewGetCFilterHeaderCmd returns a new instance which can be used to issue a
// getcfilterheader JSON-RPC command.
// getCFilterHeader JSON-RPC command.
func NewGetCFilterHeaderCmd(hash string,
filterType wire.FilterType) *GetCFilterHeaderCmd {
return &GetCFilterHeaderCmd{
@ -318,74 +318,74 @@ func NewGetCFilterHeaderCmd(hash string,
}
}
// GetDAGTipsCmd defines the getdagtips JSON-RPC command.
// GetDAGTipsCmd defines the getDagTips JSON-RPC command.
type GetDAGTipsCmd struct{}
// NewGetDAGTipsCmd returns a new instance which can be used to issue a
// getdagtips JSON-RPC command.
// getDagTips JSON-RPC command.
func NewGetDAGTipsCmd() *GetDAGTipsCmd {
return &GetDAGTipsCmd{}
}
// GetConnectionCountCmd defines the getconnectioncount JSON-RPC command.
// GetConnectionCountCmd defines the getConnectionCount JSON-RPC command.
type GetConnectionCountCmd struct{}
// NewGetConnectionCountCmd returns a new instance which can be used to issue a
// getconnectioncount JSON-RPC command.
// getConnectionCount JSON-RPC command.
func NewGetConnectionCountCmd() *GetConnectionCountCmd {
return &GetConnectionCountCmd{}
}
// GetDifficultyCmd defines the getdifficulty JSON-RPC command.
// GetDifficultyCmd defines the getDifficulty JSON-RPC command.
type GetDifficultyCmd struct{}
// NewGetDifficultyCmd returns a new instance which can be used to issue a
// getdifficulty JSON-RPC command.
// getDifficulty JSON-RPC command.
func NewGetDifficultyCmd() *GetDifficultyCmd {
return &GetDifficultyCmd{}
}
// GetGenerateCmd defines the getgenerate JSON-RPC command.
// GetGenerateCmd defines the getGenerate JSON-RPC command.
type GetGenerateCmd struct{}
// NewGetGenerateCmd returns a new instance which can be used to issue a
// getgenerate JSON-RPC command.
// getGenerate JSON-RPC command.
func NewGetGenerateCmd() *GetGenerateCmd {
return &GetGenerateCmd{}
}
// GetHashesPerSecCmd defines the gethashespersec JSON-RPC command.
// GetHashesPerSecCmd defines the getHashesPerSec JSON-RPC command.
type GetHashesPerSecCmd struct{}
// NewGetHashesPerSecCmd returns a new instance which can be used to issue a
// gethashespersec JSON-RPC command.
// getHashesPerSec JSON-RPC command.
func NewGetHashesPerSecCmd() *GetHashesPerSecCmd {
return &GetHashesPerSecCmd{}
}
// GetInfoCmd defines the getinfo JSON-RPC command.
// GetInfoCmd defines the getInfo JSON-RPC command.
type GetInfoCmd struct{}
// NewGetInfoCmd returns a new instance which can be used to issue a
// getinfo JSON-RPC command.
// getInfo JSON-RPC command.
func NewGetInfoCmd() *GetInfoCmd {
return &GetInfoCmd{}
}
// GetMempoolEntryCmd defines the getmempoolentry JSON-RPC command.
// GetMempoolEntryCmd defines the getMempoolEntry JSON-RPC command.
type GetMempoolEntryCmd struct {
TxID string
}
// NewGetMempoolEntryCmd returns a new instance which can be used to issue a
// getmempoolentry JSON-RPC command.
// getMempoolEntry JSON-RPC command.
func NewGetMempoolEntryCmd(txHash string) *GetMempoolEntryCmd {
return &GetMempoolEntryCmd{
TxID: txHash,
}
}
// GetMempoolInfoCmd defines the getmempoolinfo JSON-RPC command.
// GetMempoolInfoCmd defines the getMempoolInfo JSON-RPC command.
type GetMempoolInfoCmd struct{}
// NewGetMempoolInfoCmd returns a new instance which can be used to issue a
@ -394,41 +394,41 @@ func NewGetMempoolInfoCmd() *GetMempoolInfoCmd {
return &GetMempoolInfoCmd{}
}
// GetMiningInfoCmd defines the getmininginfo JSON-RPC command.
// GetMiningInfoCmd defines the getMiningInfo JSON-RPC command.
type GetMiningInfoCmd struct{}
// NewGetMiningInfoCmd returns a new instance which can be used to issue a
// getmininginfo JSON-RPC command.
// getMiningInfo JSON-RPC command.
func NewGetMiningInfoCmd() *GetMiningInfoCmd {
return &GetMiningInfoCmd{}
}
// GetNetworkInfoCmd defines the getnetworkinfo JSON-RPC command.
// GetNetworkInfoCmd defines the getNetworkInfo JSON-RPC command.
type GetNetworkInfoCmd struct{}
// NewGetNetworkInfoCmd returns a new instance which can be used to issue a
// getnetworkinfo JSON-RPC command.
// getNetworkInfo JSON-RPC command.
func NewGetNetworkInfoCmd() *GetNetworkInfoCmd {
return &GetNetworkInfoCmd{}
}
// GetNetTotalsCmd defines the getnettotals JSON-RPC command.
// GetNetTotalsCmd defines the getNetTotals JSON-RPC command.
type GetNetTotalsCmd struct{}
// NewGetNetTotalsCmd returns a new instance which can be used to issue a
// getnettotals JSON-RPC command.
// getNetTotals JSON-RPC command.
func NewGetNetTotalsCmd() *GetNetTotalsCmd {
return &GetNetTotalsCmd{}
}
// GetNetworkHashPSCmd defines the getnetworkhashps JSON-RPC command.
// GetNetworkHashPSCmd defines the getNetworkHashPs JSON-RPC command.
type GetNetworkHashPSCmd struct {
Blocks *int `jsonrpcdefault:"120"`
Height *int `jsonrpcdefault:"-1"`
}
// NewGetNetworkHashPSCmd returns a new instance which can be used to issue a
// getnetworkhashps JSON-RPC command.
// getNetworkHashPs JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -439,7 +439,7 @@ func NewGetNetworkHashPSCmd(numBlocks, height *int) *GetNetworkHashPSCmd {
}
}
// GetPeerInfoCmd defines the getpeerinfo JSON-RPC command.
// GetPeerInfoCmd defines the getPeerInfo JSON-RPC command.
type GetPeerInfoCmd struct{}
// NewGetPeerInfoCmd returns a new instance which can be used to issue a getpeer
@ -454,7 +454,7 @@ type GetRawMempoolCmd struct {
}
// NewGetRawMempoolCmd returns a new instance which can be used to issue a
// getrawmempool JSON-RPC command.
// getRawMempool JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -464,7 +464,7 @@ func NewGetRawMempoolCmd(verbose *bool) *GetRawMempoolCmd {
}
}
// GetRawTransactionCmd defines the getrawtransaction JSON-RPC command.
// GetRawTransactionCmd defines the getRawTransaction JSON-RPC command.
//
// NOTE: This field is an int versus a bool to remain compatible with Bitcoin
// Core even though it really should be a bool.
@ -474,7 +474,7 @@ type GetRawTransactionCmd struct {
}
// NewGetRawTransactionCmd returns a new instance which can be used to issue a
// getrawtransaction JSON-RPC command.
// getRawTransaction JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -485,14 +485,14 @@ func NewGetRawTransactionCmd(txHash string, verbose *int) *GetRawTransactionCmd
}
}
// GetTxOutCmd defines the gettxout JSON-RPC command.
// GetTxOutCmd defines the getTxOut JSON-RPC command.
type GetTxOutCmd struct {
Txid string
Vout uint32
IncludeMempool *bool `jsonrpcdefault:"true"`
}
// NewGetTxOutCmd returns a new instance which can be used to issue a gettxout
// NewGetTxOutCmd returns a new instance which can be used to issue a getTxOut
// JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
@ -505,14 +505,14 @@ func NewGetTxOutCmd(txHash string, vout uint32, includeMempool *bool) *GetTxOutC
}
}
// GetTxOutProofCmd defines the gettxoutproof JSON-RPC command.
// GetTxOutProofCmd defines the getTxOutProof JSON-RPC command.
type GetTxOutProofCmd struct {
TxIDs []string
BlockHash *string
}
// NewGetTxOutProofCmd returns a new instance which can be used to issue a
// gettxoutproof JSON-RPC command.
// getTxOutProof JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -523,11 +523,11 @@ func NewGetTxOutProofCmd(txIDs []string, blockHash *string) *GetTxOutProofCmd {
}
}
// GetTxOutSetInfoCmd defines the gettxoutsetinfo JSON-RPC command.
// GetTxOutSetInfoCmd defines the getTxOutSetInfo JSON-RPC command.
type GetTxOutSetInfoCmd struct{}
// NewGetTxOutSetInfoCmd returns a new instance which can be used to issue a
// gettxoutsetinfo JSON-RPC command.
// getTxOutSetInfo JSON-RPC command.
func NewGetTxOutSetInfoCmd() *GetTxOutSetInfoCmd {
return &GetTxOutSetInfoCmd{}
}
@ -548,13 +548,13 @@ func NewHelpCmd(command *string) *HelpCmd {
}
}
// InvalidateBlockCmd defines the invalidateblock JSON-RPC command.
// InvalidateBlockCmd defines the invalidateBlock JSON-RPC command.
type InvalidateBlockCmd struct {
BlockHash string
}
// NewInvalidateBlockCmd returns a new instance which can be used to issue a
// invalidateblock JSON-RPC command.
// invalidateBlock JSON-RPC command.
func NewInvalidateBlockCmd(blockHash string) *InvalidateBlockCmd {
return &InvalidateBlockCmd{
BlockHash: blockHash,
@ -570,33 +570,33 @@ func NewPingCmd() *PingCmd {
return &PingCmd{}
}
// PreciousBlockCmd defines the preciousblock JSON-RPC command.
// PreciousBlockCmd defines the preciousBlock JSON-RPC command.
type PreciousBlockCmd struct {
BlockHash string
}
// NewPreciousBlockCmd returns a new instance which can be used to issue a
// preciousblock JSON-RPC command.
// preciousBlock JSON-RPC command.
func NewPreciousBlockCmd(blockHash string) *PreciousBlockCmd {
return &PreciousBlockCmd{
BlockHash: blockHash,
}
}
// ReconsiderBlockCmd defines the reconsiderblock JSON-RPC command.
// ReconsiderBlockCmd defines the reconsiderBlock JSON-RPC command.
type ReconsiderBlockCmd struct {
BlockHash string
}
// NewReconsiderBlockCmd returns a new instance which can be used to issue a
// reconsiderblock JSON-RPC command.
// reconsiderBlock JSON-RPC command.
func NewReconsiderBlockCmd(blockHash string) *ReconsiderBlockCmd {
return &ReconsiderBlockCmd{
BlockHash: blockHash,
}
}
// SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command.
// SearchRawTransactionsCmd defines the searchRawTransactions JSON-RPC command.
type SearchRawTransactionsCmd struct {
Address string
Verbose *bool `jsonrpcdefault:"true"`
@ -608,7 +608,7 @@ type SearchRawTransactionsCmd struct {
}
// NewSearchRawTransactionsCmd returns a new instance which can be used to issue a
// sendrawtransaction JSON-RPC command.
// sendRawTransaction JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -624,14 +624,14 @@ func NewSearchRawTransactionsCmd(address string, verbose *bool, skip, count *int
}
}
// SendRawTransactionCmd defines the sendrawtransaction JSON-RPC command.
// SendRawTransactionCmd defines the sendRawTransaction JSON-RPC command.
type SendRawTransactionCmd struct {
HexTx string
AllowHighFees *bool `jsonrpcdefault:"false"`
}
// NewSendRawTransactionCmd returns a new instance which can be used to issue a
// sendrawtransaction JSON-RPC command.
// sendRawTransaction JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -642,14 +642,14 @@ func NewSendRawTransactionCmd(hexTx string, allowHighFees *bool) *SendRawTransac
}
}
// SetGenerateCmd defines the setgenerate JSON-RPC command.
// SetGenerateCmd defines the setGenerate JSON-RPC command.
type SetGenerateCmd struct {
Generate bool
GenProcLimit *int `jsonrpcdefault:"-1"`
}
// NewSetGenerateCmd returns a new instance which can be used to issue a
// setgenerate JSON-RPC command.
// setGenerate JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -676,14 +676,14 @@ type SubmitBlockOptions struct {
WorkID string `json:"workid,omitempty"`
}
// SubmitBlockCmd defines the submitblock JSON-RPC command.
// SubmitBlockCmd defines the submitBlock JSON-RPC command.
type SubmitBlockCmd struct {
HexBlock string
Options *SubmitBlockOptions
}
// NewSubmitBlockCmd returns a new instance which can be used to issue a
// submitblock JSON-RPC command.
// submitBlock JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -702,27 +702,27 @@ func NewUptimeCmd() *UptimeCmd {
return &UptimeCmd{}
}
// ValidateAddressCmd defines the validateaddress JSON-RPC command.
// ValidateAddressCmd defines the validateAddress JSON-RPC command.
type ValidateAddressCmd struct {
Address string
}
// NewValidateAddressCmd returns a new instance which can be used to issue a
// validateaddress JSON-RPC command.
// validateAddress JSON-RPC command.
func NewValidateAddressCmd(address string) *ValidateAddressCmd {
return &ValidateAddressCmd{
Address: address,
}
}
// VerifyDAGCmd defines the verifydag JSON-RPC command.
// VerifyDAGCmd defines the verifyDag JSON-RPC command.
type VerifyDAGCmd struct {
CheckLevel *int32 `jsonrpcdefault:"3"`
CheckDepth *int32 `jsonrpcdefault:"288"` // 0 = all
}
// NewVerifyDAGCmd returns a new instance which can be used to issue a
// verifydag JSON-RPC command.
// verifyDag JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -733,7 +733,7 @@ func NewVerifyDAGCmd(checkLevel, checkDepth *int32) *VerifyDAGCmd {
}
}
// VerifyMessageCmd defines the verifymessage JSON-RPC command.
// VerifyMessageCmd defines the verifyMessage JSON-RPC command.
type VerifyMessageCmd struct {
Address string
Signature string
@ -741,7 +741,7 @@ type VerifyMessageCmd struct {
}
// NewVerifyMessageCmd returns a new instance which can be used to issue a
// verifymessage JSON-RPC command.
// verifyMessage JSON-RPC command.
func NewVerifyMessageCmd(address, signature, message string) *VerifyMessageCmd {
return &VerifyMessageCmd{
Address: address,
@ -750,13 +750,13 @@ func NewVerifyMessageCmd(address, signature, message string) *VerifyMessageCmd {
}
}
// VerifyTxOutProofCmd defines the verifytxoutproof JSON-RPC command.
// VerifyTxOutProofCmd defines the verifyTxOutProof JSON-RPC command.
type VerifyTxOutProofCmd struct {
Proof string
}
// NewVerifyTxOutProofCmd returns a new instance which can be used to issue a
// verifytxoutproof JSON-RPC command.
// verifyTxOutProof JSON-RPC command.
func NewVerifyTxOutProofCmd(proof string) *VerifyTxOutProofCmd {
return &VerifyTxOutProofCmd{
Proof: proof,
@ -767,53 +767,53 @@ func init() {
// No special flags for commands in this file.
flags := UsageFlag(0)
MustRegisterCmd("addmanualnode", (*AddManualNodeCmd)(nil), flags)
MustRegisterCmd("createrawtransaction", (*CreateRawTransactionCmd)(nil), flags)
MustRegisterCmd("decoderawtransaction", (*DecodeRawTransactionCmd)(nil), flags)
MustRegisterCmd("decodescript", (*DecodeScriptCmd)(nil), flags)
MustRegisterCmd("getallmanualnodesinfo", (*GetAllManualNodesInfoCmd)(nil), flags)
MustRegisterCmd("getbestblockhash", (*GetBestBlockHashCmd)(nil), flags)
MustRegisterCmd("getblock", (*GetBlockCmd)(nil), flags)
MustRegisterCmd("getblockdaginfo", (*GetBlockDAGInfoCmd)(nil), flags)
MustRegisterCmd("getblockcount", (*GetBlockCountCmd)(nil), flags)
MustRegisterCmd("getblockhash", (*GetBlockHashCmd)(nil), flags)
MustRegisterCmd("getblockheader", (*GetBlockHeaderCmd)(nil), flags)
MustRegisterCmd("getblocktemplate", (*GetBlockTemplateCmd)(nil), flags)
MustRegisterCmd("getcfilter", (*GetCFilterCmd)(nil), flags)
MustRegisterCmd("getcfilterheader", (*GetCFilterHeaderCmd)(nil), flags)
MustRegisterCmd("getdagtips", (*GetDAGTipsCmd)(nil), flags)
MustRegisterCmd("getconnectioncount", (*GetConnectionCountCmd)(nil), flags)
MustRegisterCmd("getdifficulty", (*GetDifficultyCmd)(nil), flags)
MustRegisterCmd("getgenerate", (*GetGenerateCmd)(nil), flags)
MustRegisterCmd("gethashespersec", (*GetHashesPerSecCmd)(nil), flags)
MustRegisterCmd("getinfo", (*GetInfoCmd)(nil), flags)
MustRegisterCmd("getmanualnodeinfo", (*GetManualNodeInfoCmd)(nil), flags)
MustRegisterCmd("getmempoolentry", (*GetMempoolEntryCmd)(nil), flags)
MustRegisterCmd("getmempoolinfo", (*GetMempoolInfoCmd)(nil), flags)
MustRegisterCmd("getmininginfo", (*GetMiningInfoCmd)(nil), flags)
MustRegisterCmd("getnetworkinfo", (*GetNetworkInfoCmd)(nil), flags)
MustRegisterCmd("getnettotals", (*GetNetTotalsCmd)(nil), flags)
MustRegisterCmd("getnetworkhashps", (*GetNetworkHashPSCmd)(nil), flags)
MustRegisterCmd("getpeerinfo", (*GetPeerInfoCmd)(nil), flags)
MustRegisterCmd("getrawmempool", (*GetRawMempoolCmd)(nil), flags)
MustRegisterCmd("getrawtransaction", (*GetRawTransactionCmd)(nil), flags)
MustRegisterCmd("gettxout", (*GetTxOutCmd)(nil), flags)
MustRegisterCmd("gettxoutproof", (*GetTxOutProofCmd)(nil), flags)
MustRegisterCmd("gettxoutsetinfo", (*GetTxOutSetInfoCmd)(nil), flags)
MustRegisterCmd("addManualNode", (*AddManualNodeCmd)(nil), flags)
MustRegisterCmd("createRawTransaction", (*CreateRawTransactionCmd)(nil), flags)
MustRegisterCmd("decodeRawTransaction", (*DecodeRawTransactionCmd)(nil), flags)
MustRegisterCmd("decodeScript", (*DecodeScriptCmd)(nil), flags)
MustRegisterCmd("getAllManualNodesInfo", (*GetAllManualNodesInfoCmd)(nil), flags)
MustRegisterCmd("getBestBlockHash", (*GetBestBlockHashCmd)(nil), flags)
MustRegisterCmd("getBlock", (*GetBlockCmd)(nil), flags)
MustRegisterCmd("getBlockDagInfo", (*GetBlockDAGInfoCmd)(nil), flags)
MustRegisterCmd("getBlockCount", (*GetBlockCountCmd)(nil), flags)
MustRegisterCmd("getBlockHash", (*GetBlockHashCmd)(nil), flags)
MustRegisterCmd("getBlockHeader", (*GetBlockHeaderCmd)(nil), flags)
MustRegisterCmd("getBlockTemplate", (*GetBlockTemplateCmd)(nil), flags)
MustRegisterCmd("getCFilter", (*GetCFilterCmd)(nil), flags)
MustRegisterCmd("getCFilterHeader", (*GetCFilterHeaderCmd)(nil), flags)
MustRegisterCmd("getDagTips", (*GetDAGTipsCmd)(nil), flags)
MustRegisterCmd("getConnectionCount", (*GetConnectionCountCmd)(nil), flags)
MustRegisterCmd("getDifficulty", (*GetDifficultyCmd)(nil), flags)
MustRegisterCmd("getGenerate", (*GetGenerateCmd)(nil), flags)
MustRegisterCmd("getHashesPerSec", (*GetHashesPerSecCmd)(nil), flags)
MustRegisterCmd("getInfo", (*GetInfoCmd)(nil), flags)
MustRegisterCmd("getManualNodeInfo", (*GetManualNodeInfoCmd)(nil), flags)
MustRegisterCmd("getMempoolEntry", (*GetMempoolEntryCmd)(nil), flags)
MustRegisterCmd("getMempoolInfo", (*GetMempoolInfoCmd)(nil), flags)
MustRegisterCmd("getMiningInfo", (*GetMiningInfoCmd)(nil), flags)
MustRegisterCmd("getNetworkInfo", (*GetNetworkInfoCmd)(nil), flags)
MustRegisterCmd("getNetTotals", (*GetNetTotalsCmd)(nil), flags)
MustRegisterCmd("getNetworkHashPs", (*GetNetworkHashPSCmd)(nil), flags)
MustRegisterCmd("getPeerInfo", (*GetPeerInfoCmd)(nil), flags)
MustRegisterCmd("getRawMempool", (*GetRawMempoolCmd)(nil), flags)
MustRegisterCmd("getRawTransaction", (*GetRawTransactionCmd)(nil), flags)
MustRegisterCmd("getTxOut", (*GetTxOutCmd)(nil), flags)
MustRegisterCmd("getTxOutProof", (*GetTxOutProofCmd)(nil), flags)
MustRegisterCmd("getTxOutSetInfo", (*GetTxOutSetInfoCmd)(nil), flags)
MustRegisterCmd("help", (*HelpCmd)(nil), flags)
MustRegisterCmd("invalidateblock", (*InvalidateBlockCmd)(nil), flags)
MustRegisterCmd("invalidateBlock", (*InvalidateBlockCmd)(nil), flags)
MustRegisterCmd("ping", (*PingCmd)(nil), flags)
MustRegisterCmd("preciousblock", (*PreciousBlockCmd)(nil), flags)
MustRegisterCmd("reconsiderblock", (*ReconsiderBlockCmd)(nil), flags)
MustRegisterCmd("removemanualnode", (*RemoveManualNodeCmd)(nil), flags)
MustRegisterCmd("searchrawtransactions", (*SearchRawTransactionsCmd)(nil), flags)
MustRegisterCmd("sendrawtransaction", (*SendRawTransactionCmd)(nil), flags)
MustRegisterCmd("setgenerate", (*SetGenerateCmd)(nil), flags)
MustRegisterCmd("preciousBlock", (*PreciousBlockCmd)(nil), flags)
MustRegisterCmd("reconsiderBlock", (*ReconsiderBlockCmd)(nil), flags)
MustRegisterCmd("removeManualNode", (*RemoveManualNodeCmd)(nil), flags)
MustRegisterCmd("searchRawTransactions", (*SearchRawTransactionsCmd)(nil), flags)
MustRegisterCmd("sendRawTransaction", (*SendRawTransactionCmd)(nil), flags)
MustRegisterCmd("setGenerate", (*SetGenerateCmd)(nil), flags)
MustRegisterCmd("stop", (*StopCmd)(nil), flags)
MustRegisterCmd("submitblock", (*SubmitBlockCmd)(nil), flags)
MustRegisterCmd("submitBlock", (*SubmitBlockCmd)(nil), flags)
MustRegisterCmd("uptime", (*UptimeCmd)(nil), flags)
MustRegisterCmd("validateaddress", (*ValidateAddressCmd)(nil), flags)
MustRegisterCmd("verifydag", (*VerifyDAGCmd)(nil), flags)
MustRegisterCmd("verifymessage", (*VerifyMessageCmd)(nil), flags)
MustRegisterCmd("verifytxoutproof", (*VerifyTxOutProofCmd)(nil), flags)
MustRegisterCmd("validateAddress", (*ValidateAddressCmd)(nil), flags)
MustRegisterCmd("verifyDag", (*VerifyDAGCmd)(nil), flags)
MustRegisterCmd("verifyMessage", (*VerifyMessageCmd)(nil), flags)
MustRegisterCmd("verifyTxOutProof", (*VerifyTxOutProofCmd)(nil), flags)
}

File diff suppressed because it is too large Load Diff

View File

@ -23,31 +23,31 @@ func NewAuthenticateCmd(username, passphrase string) *AuthenticateCmd {
}
}
// NotifyBlocksCmd defines the notifyblocks JSON-RPC command.
// NotifyBlocksCmd defines the notifyBlocks JSON-RPC command.
type NotifyBlocksCmd struct{}
// NewNotifyBlocksCmd returns a new instance which can be used to issue a
// notifyblocks JSON-RPC command.
// notifyBlocks JSON-RPC command.
func NewNotifyBlocksCmd() *NotifyBlocksCmd {
return &NotifyBlocksCmd{}
}
// StopNotifyBlocksCmd defines the stopnotifyblocks JSON-RPC command.
// StopNotifyBlocksCmd defines the stopNotifyBlocks JSON-RPC command.
type StopNotifyBlocksCmd struct{}
// NewStopNotifyBlocksCmd returns a new instance which can be used to issue a
// stopnotifyblocks JSON-RPC command.
// stopNotifyBlocks JSON-RPC command.
func NewStopNotifyBlocksCmd() *StopNotifyBlocksCmd {
return &StopNotifyBlocksCmd{}
}
// NotifyNewTransactionsCmd defines the notifynewtransactions JSON-RPC command.
// NotifyNewTransactionsCmd defines the notifyNewTransactions JSON-RPC command.
type NotifyNewTransactionsCmd struct {
Verbose *bool `jsonrpcdefault:"false"`
}
// NewNotifyNewTransactionsCmd returns a new instance which can be used to issue
// a notifynewtransactions JSON-RPC command.
// a notifyNewTransactions JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -66,11 +66,11 @@ func NewSessionCmd() *SessionCmd {
return &SessionCmd{}
}
// StopNotifyNewTransactionsCmd defines the stopnotifynewtransactions JSON-RPC command.
// StopNotifyNewTransactionsCmd defines the stopNotifyNewTransactions JSON-RPC command.
type StopNotifyNewTransactionsCmd struct{}
// NewStopNotifyNewTransactionsCmd returns a new instance which can be used to issue
// a stopnotifynewtransactions JSON-RPC command.
// a stopNotifyNewTransactions JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -78,7 +78,7 @@ func NewStopNotifyNewTransactionsCmd() *StopNotifyNewTransactionsCmd {
return &StopNotifyNewTransactionsCmd{}
}
// NotifyReceivedCmd defines the notifyreceived JSON-RPC command.
// NotifyReceivedCmd defines the notifyReceived JSON-RPC command.
//
// NOTE: Deprecated. Use LoadTxFilterCmd instead.
type NotifyReceivedCmd struct {
@ -86,7 +86,7 @@ type NotifyReceivedCmd struct {
}
// NewNotifyReceivedCmd returns a new instance which can be used to issue a
// notifyreceived JSON-RPC command.
// notifyReceived JSON-RPC command.
//
// NOTE: Deprecated. Use NewLoadTxFilterCmd instead.
func NewNotifyReceivedCmd(addresses []string) *NotifyReceivedCmd {
@ -102,7 +102,7 @@ type OutPoint struct {
Index uint32 `json:"index"`
}
// LoadTxFilterCmd defines the loadtxfilter request parameters to load or
// LoadTxFilterCmd defines the loadTxFilter request parameters to load or
// reload a transaction filter.
//
// NOTE: This is a btcd extension ported from github.com/decred/dcrd/dcrjson
@ -114,7 +114,7 @@ type LoadTxFilterCmd struct {
}
// NewLoadTxFilterCmd returns a new instance which can be used to issue a
// loadtxfilter JSON-RPC command.
// loadTxFilter JSON-RPC command.
//
// NOTE: This is a btcd extension ported from github.com/decred/dcrd/dcrjson
// and requires a websocket connection.
@ -126,7 +126,7 @@ func NewLoadTxFilterCmd(reload bool, addresses []string, outPoints []OutPoint) *
}
}
// NotifySpentCmd defines the notifyspent JSON-RPC command.
// NotifySpentCmd defines the notifySpent JSON-RPC command.
//
// NOTE: Deprecated. Use LoadTxFilterCmd instead.
type NotifySpentCmd struct {
@ -134,7 +134,7 @@ type NotifySpentCmd struct {
}
// NewNotifySpentCmd returns a new instance which can be used to issue a
// notifyspent JSON-RPC command.
// notifySpent JSON-RPC command.
//
// NOTE: Deprecated. Use NewLoadTxFilterCmd instead.
func NewNotifySpentCmd(outPoints []OutPoint) *NotifySpentCmd {
@ -143,7 +143,7 @@ func NewNotifySpentCmd(outPoints []OutPoint) *NotifySpentCmd {
}
}
// StopNotifyReceivedCmd defines the stopnotifyreceived JSON-RPC command.
// StopNotifyReceivedCmd defines the stopNotifyReceived JSON-RPC command.
//
// NOTE: Deprecated. Use LoadTxFilterCmd instead.
type StopNotifyReceivedCmd struct {
@ -151,7 +151,7 @@ type StopNotifyReceivedCmd struct {
}
// NewStopNotifyReceivedCmd returns a new instance which can be used to issue a
// stopnotifyreceived JSON-RPC command.
// stopNotifyReceived JSON-RPC command.
//
// NOTE: Deprecated. Use NewLoadTxFilterCmd instead.
func NewStopNotifyReceivedCmd(addresses []string) *StopNotifyReceivedCmd {
@ -160,7 +160,7 @@ func NewStopNotifyReceivedCmd(addresses []string) *StopNotifyReceivedCmd {
}
}
// StopNotifySpentCmd defines the stopnotifyspent JSON-RPC command.
// StopNotifySpentCmd defines the stopNotifySpent JSON-RPC command.
//
// NOTE: Deprecated. Use LoadTxFilterCmd instead.
type StopNotifySpentCmd struct {
@ -168,7 +168,7 @@ type StopNotifySpentCmd struct {
}
// NewStopNotifySpentCmd returns a new instance which can be used to issue a
// stopnotifyspent JSON-RPC command.
// stopNotifySpent JSON-RPC command.
//
// NOTE: Deprecated. Use NewLoadTxFilterCmd instead.
func NewStopNotifySpentCmd(outPoints []OutPoint) *StopNotifySpentCmd {
@ -200,15 +200,15 @@ func init() {
flags := UFWebsocketOnly
MustRegisterCmd("authenticate", (*AuthenticateCmd)(nil), flags)
MustRegisterCmd("loadtxfilter", (*LoadTxFilterCmd)(nil), flags)
MustRegisterCmd("notifyblocks", (*NotifyBlocksCmd)(nil), flags)
MustRegisterCmd("notifynewtransactions", (*NotifyNewTransactionsCmd)(nil), flags)
MustRegisterCmd("notifyreceived", (*NotifyReceivedCmd)(nil), flags)
MustRegisterCmd("notifyspent", (*NotifySpentCmd)(nil), flags)
MustRegisterCmd("loadTxFilter", (*LoadTxFilterCmd)(nil), flags)
MustRegisterCmd("notifyBlocks", (*NotifyBlocksCmd)(nil), flags)
MustRegisterCmd("notifyNewTransactions", (*NotifyNewTransactionsCmd)(nil), flags)
MustRegisterCmd("notifyReceived", (*NotifyReceivedCmd)(nil), flags)
MustRegisterCmd("notifySpent", (*NotifySpentCmd)(nil), flags)
MustRegisterCmd("session", (*SessionCmd)(nil), flags)
MustRegisterCmd("stopnotifyblocks", (*StopNotifyBlocksCmd)(nil), flags)
MustRegisterCmd("stopnotifynewtransactions", (*StopNotifyNewTransactionsCmd)(nil), flags)
MustRegisterCmd("stopnotifyspent", (*StopNotifySpentCmd)(nil), flags)
MustRegisterCmd("stopnotifyreceived", (*StopNotifyReceivedCmd)(nil), flags)
MustRegisterCmd("rescanblocks", (*RescanBlocksCmd)(nil), flags)
MustRegisterCmd("stopNotifyBlocks", (*StopNotifyBlocksCmd)(nil), flags)
MustRegisterCmd("stopNotifyNewTransactions", (*StopNotifyNewTransactionsCmd)(nil), flags)
MustRegisterCmd("stopNotifySpent", (*StopNotifySpentCmd)(nil), flags)
MustRegisterCmd("stopNotifyReceived", (*StopNotifyReceivedCmd)(nil), flags)
MustRegisterCmd("rescanBlocks", (*RescanBlocksCmd)(nil), flags)
}

View File

@ -42,122 +42,122 @@ func TestDAGSvrWsCmds(t *testing.T) {
unmarshalled: &btcjson.AuthenticateCmd{Username: "user", Passphrase: "pass"},
},
{
name: "notifyblocks",
name: "notifyBlocks",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("notifyblocks")
return btcjson.NewCmd("notifyBlocks")
},
staticCmd: func() interface{} {
return btcjson.NewNotifyBlocksCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"notifyblocks","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"notifyBlocks","params":[],"id":1}`,
unmarshalled: &btcjson.NotifyBlocksCmd{},
},
{
name: "stopnotifyblocks",
name: "stopNotifyBlocks",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifyblocks")
return btcjson.NewCmd("stopNotifyBlocks")
},
staticCmd: func() interface{} {
return btcjson.NewStopNotifyBlocksCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifyblocks","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"stopNotifyBlocks","params":[],"id":1}`,
unmarshalled: &btcjson.StopNotifyBlocksCmd{},
},
{
name: "notifynewtransactions",
name: "notifyNewTransactions",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("notifynewtransactions")
return btcjson.NewCmd("notifyNewTransactions")
},
staticCmd: func() interface{} {
return btcjson.NewNotifyNewTransactionsCmd(nil)
},
marshalled: `{"jsonrpc":"1.0","method":"notifynewtransactions","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"notifyNewTransactions","params":[],"id":1}`,
unmarshalled: &btcjson.NotifyNewTransactionsCmd{
Verbose: btcjson.Bool(false),
},
},
{
name: "notifynewtransactions optional",
name: "notifyNewTransactions optional",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("notifynewtransactions", true)
return btcjson.NewCmd("notifyNewTransactions", true)
},
staticCmd: func() interface{} {
return btcjson.NewNotifyNewTransactionsCmd(btcjson.Bool(true))
},
marshalled: `{"jsonrpc":"1.0","method":"notifynewtransactions","params":[true],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"notifyNewTransactions","params":[true],"id":1}`,
unmarshalled: &btcjson.NotifyNewTransactionsCmd{
Verbose: btcjson.Bool(true),
},
},
{
name: "stopnotifynewtransactions",
name: "stopNotifyNewTransactions",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifynewtransactions")
return btcjson.NewCmd("stopNotifyNewTransactions")
},
staticCmd: func() interface{} {
return btcjson.NewStopNotifyNewTransactionsCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifynewtransactions","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"stopNotifyNewTransactions","params":[],"id":1}`,
unmarshalled: &btcjson.StopNotifyNewTransactionsCmd{},
},
{
name: "notifyreceived",
name: "notifyReceived",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("notifyreceived", []string{"1Address"})
return btcjson.NewCmd("notifyReceived", []string{"1Address"})
},
staticCmd: func() interface{} {
return btcjson.NewNotifyReceivedCmd([]string{"1Address"})
},
marshalled: `{"jsonrpc":"1.0","method":"notifyreceived","params":[["1Address"]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"notifyReceived","params":[["1Address"]],"id":1}`,
unmarshalled: &btcjson.NotifyReceivedCmd{
Addresses: []string{"1Address"},
},
},
{
name: "stopnotifyreceived",
name: "stopNotifyReceived",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifyreceived", []string{"1Address"})
return btcjson.NewCmd("stopNotifyReceived", []string{"1Address"})
},
staticCmd: func() interface{} {
return btcjson.NewStopNotifyReceivedCmd([]string{"1Address"})
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifyreceived","params":[["1Address"]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"stopNotifyReceived","params":[["1Address"]],"id":1}`,
unmarshalled: &btcjson.StopNotifyReceivedCmd{
Addresses: []string{"1Address"},
},
},
{
name: "notifyspent",
name: "notifySpent",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("notifyspent", `[{"hash":"123","index":0}]`)
return btcjson.NewCmd("notifySpent", `[{"hash":"123","index":0}]`)
},
staticCmd: func() interface{} {
ops := []btcjson.OutPoint{{Hash: "123", Index: 0}}
return btcjson.NewNotifySpentCmd(ops)
},
marshalled: `{"jsonrpc":"1.0","method":"notifyspent","params":[[{"hash":"123","index":0}]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"notifySpent","params":[[{"hash":"123","index":0}]],"id":1}`,
unmarshalled: &btcjson.NotifySpentCmd{
OutPoints: []btcjson.OutPoint{{Hash: "123", Index: 0}},
},
},
{
name: "stopnotifyspent",
name: "stopNotifySpent",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifyspent", `[{"hash":"123","index":0}]`)
return btcjson.NewCmd("stopNotifySpent", `[{"hash":"123","index":0}]`)
},
staticCmd: func() interface{} {
ops := []btcjson.OutPoint{{Hash: "123", Index: 0}}
return btcjson.NewStopNotifySpentCmd(ops)
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifyspent","params":[[{"hash":"123","index":0}]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"stopNotifySpent","params":[[{"hash":"123","index":0}]],"id":1}`,
unmarshalled: &btcjson.StopNotifySpentCmd{
OutPoints: []btcjson.OutPoint{{Hash: "123", Index: 0}},
},
},
{
name: "loadtxfilter",
name: "loadTxFilter",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("loadtxfilter", false, `["1Address"]`, `[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]`)
return btcjson.NewCmd("loadTxFilter", false, `["1Address"]`, `[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]`)
},
staticCmd: func() interface{} {
addrs := []string{"1Address"}
@ -167,7 +167,7 @@ func TestDAGSvrWsCmds(t *testing.T) {
}}
return btcjson.NewLoadTxFilterCmd(false, addrs, ops)
},
marshalled: `{"jsonrpc":"1.0","method":"loadtxfilter","params":[false,["1Address"],[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"loadTxFilter","params":[false,["1Address"],[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]],"id":1}`,
unmarshalled: &btcjson.LoadTxFilterCmd{
Reload: false,
Addresses: []string{"1Address"},
@ -175,15 +175,15 @@ func TestDAGSvrWsCmds(t *testing.T) {
},
},
{
name: "rescanblocks",
name: "rescanBlocks",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("rescanblocks", `["0000000000000000000000000000000000000000000000000000000000000123"]`)
return btcjson.NewCmd("rescanBlocks", `["0000000000000000000000000000000000000000000000000000000000000123"]`)
},
staticCmd: func() interface{} {
blockhashes := []string{"0000000000000000000000000000000000000000000000000000000000000123"}
return btcjson.NewRescanBlocksCmd(blockhashes)
},
marshalled: `{"jsonrpc":"1.0","method":"rescanblocks","params":[["0000000000000000000000000000000000000000000000000000000000000123"]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"rescanBlocks","params":[["0000000000000000000000000000000000000000000000000000000000000123"]],"id":1}`,
unmarshalled: &btcjson.RescanBlocksCmd{
BlockHashes: []string{"0000000000000000000000000000000000000000000000000000000000000123"},
},

View File

@ -13,23 +13,23 @@ const (
// notifications from the dag server that a block has been connected.
//
// NOTE: Deprecated. Use FilteredBlockConnectedNtfnMethod instead.
BlockConnectedNtfnMethod = "blockconnected"
BlockConnectedNtfnMethod = "blockConnected"
// BlockDisconnectedNtfnMethod is the legacy, deprecated method used for
// notifications from the dag server that a block has been
// disconnected.
//
// NOTE: Deprecated. Use FilteredBlockDisconnectedNtfnMethod instead.
BlockDisconnectedNtfnMethod = "blockdisconnected"
BlockDisconnectedNtfnMethod = "blockDisconnected"
// FilteredBlockConnectedNtfnMethod is the new method used for
// notifications from the dag server that a block has been connected.
FilteredBlockConnectedNtfnMethod = "filteredblockconnected"
FilteredBlockConnectedNtfnMethod = "filteredBlockConnected"
// FilteredBlockDisconnectedNtfnMethod is the new method used for
// notifications from the dag server that a block has been
// disconnected.
FilteredBlockDisconnectedNtfnMethod = "filteredblockdisconnected"
FilteredBlockDisconnectedNtfnMethod = "filteredBlockDisconnected"
// RecvTxNtfnMethod is the legacy, deprecated method used for
// notifications from the dag server that a transaction which pays to
@ -37,7 +37,7 @@ const (
//
// NOTE: Deprecated. Use RelevantTxAcceptedNtfnMethod and
// FilteredBlockConnectedNtfnMethod instead.
RecvTxNtfnMethod = "recvtx"
RecvTxNtfnMethod = "recvTx"
// RedeemingTxNtfnMethod is the legacy, deprecated method used for
// notifications from the dag server that a transaction which spends a
@ -45,39 +45,39 @@ const (
//
// NOTE: Deprecated. Use RelevantTxAcceptedNtfnMethod and
// FilteredBlockConnectedNtfnMethod instead.
RedeemingTxNtfnMethod = "redeemingtx"
RedeemingTxNtfnMethod = "redeemingTx"
// RescanFinishedNtfnMethod is the legacy, deprecated method used for
// notifications from the dag server that a legacy, deprecated rescan
// operation has finished.
//
// NOTE: Deprecated. Not used with rescanblocks command.
RescanFinishedNtfnMethod = "rescanfinished"
RescanFinishedNtfnMethod = "rescanFinished"
// RescanProgressNtfnMethod is the legacy, deprecated method used for
// notifications from the dag server that a legacy, deprecated rescan
// operation this is underway has made progress.
//
// NOTE: Deprecated. Not used with rescanblocks command.
RescanProgressNtfnMethod = "rescanprogress"
RescanProgressNtfnMethod = "rescanProgress"
// TxAcceptedNtfnMethod is the method used for notifications from the
// dag server that a transaction has been accepted into the mempool.
TxAcceptedNtfnMethod = "txaccepted"
TxAcceptedNtfnMethod = "txAccepted"
// TxAcceptedVerboseNtfnMethod is the method used for notifications from
// the dag server that a transaction has been accepted into the
// mempool. This differs from TxAcceptedNtfnMethod in that it provides
// more details in the notification.
TxAcceptedVerboseNtfnMethod = "txacceptedverbose"
TxAcceptedVerboseNtfnMethod = "txAcceptedVerbose"
// RelevantTxAcceptedNtfnMethod is the new method used for notifications
// from the dag server that inform a client that a transaction that
// matches the loaded filter was accepted by the mempool.
RelevantTxAcceptedNtfnMethod = "relevanttxaccepted"
RelevantTxAcceptedNtfnMethod = "relevantTxAccepted"
)
// BlockConnectedNtfn defines the blockconnected JSON-RPC notification.
// BlockConnectedNtfn defines the blockConnected JSON-RPC notification.
//
// NOTE: Deprecated. Use FilteredBlockConnectedNtfn instead.
type BlockConnectedNtfn struct {
@ -87,7 +87,7 @@ type BlockConnectedNtfn struct {
}
// NewBlockConnectedNtfn returns a new instance which can be used to issue a
// blockconnected JSON-RPC notification.
// blockConnected JSON-RPC notification.
//
// NOTE: Deprecated. Use NewFilteredBlockConnectedNtfn instead.
func NewBlockConnectedNtfn(hash string, height int32, time int64) *BlockConnectedNtfn {
@ -98,7 +98,7 @@ func NewBlockConnectedNtfn(hash string, height int32, time int64) *BlockConnecte
}
}
// BlockDisconnectedNtfn defines the blockdisconnected JSON-RPC notification.
// BlockDisconnectedNtfn defines the blockDisconnected JSON-RPC notification.
//
// NOTE: Deprecated. Use FilteredBlockDisconnectedNtfn instead.
type BlockDisconnectedNtfn struct {
@ -108,7 +108,7 @@ type BlockDisconnectedNtfn struct {
}
// NewBlockDisconnectedNtfn returns a new instance which can be used to issue a
// blockdisconnected JSON-RPC notification.
// blockDisconnected JSON-RPC notification.
//
// NOTE: Deprecated. Use NewFilteredBlockDisconnectedNtfn instead.
func NewBlockDisconnectedNtfn(hash string, height int32, time int64) *BlockDisconnectedNtfn {
@ -119,7 +119,7 @@ func NewBlockDisconnectedNtfn(hash string, height int32, time int64) *BlockDisco
}
}
// FilteredBlockConnectedNtfn defines the filteredblockconnected JSON-RPC
// FilteredBlockConnectedNtfn defines the filteredBlockConnected JSON-RPC
// notification.
type FilteredBlockConnectedNtfn struct {
Height int32
@ -128,7 +128,7 @@ type FilteredBlockConnectedNtfn struct {
}
// NewFilteredBlockConnectedNtfn returns a new instance which can be used to
// issue a filteredblockconnected JSON-RPC notification.
// issue a filteredBlockConnected JSON-RPC notification.
func NewFilteredBlockConnectedNtfn(height int32, header string, subscribedTxs []string) *FilteredBlockConnectedNtfn {
return &FilteredBlockConnectedNtfn{
Height: height,
@ -137,7 +137,7 @@ func NewFilteredBlockConnectedNtfn(height int32, header string, subscribedTxs []
}
}
// FilteredBlockDisconnectedNtfn defines the filteredblockdisconnected JSON-RPC
// FilteredBlockDisconnectedNtfn defines the filteredBlockDisconnected JSON-RPC
// notification.
type FilteredBlockDisconnectedNtfn struct {
Height int32
@ -145,7 +145,7 @@ type FilteredBlockDisconnectedNtfn struct {
}
// NewFilteredBlockDisconnectedNtfn returns a new instance which can be used to
// issue a filteredblockdisconnected JSON-RPC notification.
// issue a filteredBlockDisconnected JSON-RPC notification.
func NewFilteredBlockDisconnectedNtfn(height int32, header string) *FilteredBlockDisconnectedNtfn {
return &FilteredBlockDisconnectedNtfn{
Height: height,
@ -161,7 +161,7 @@ type BlockDetails struct {
Time int64 `json:"time"`
}
// RecvTxNtfn defines the recvtx JSON-RPC notification.
// RecvTxNtfn defines the recvTx JSON-RPC notification.
//
// NOTE: Deprecated. Use RelevantTxAcceptedNtfn and FilteredBlockConnectedNtfn
// instead.
@ -170,7 +170,7 @@ type RecvTxNtfn struct {
Block *BlockDetails
}
// NewRecvTxNtfn returns a new instance which can be used to issue a recvtx
// NewRecvTxNtfn returns a new instance which can be used to issue a recvTx
// JSON-RPC notification.
//
// NOTE: Deprecated. Use NewRelevantTxAcceptedNtfn and
@ -182,7 +182,7 @@ func NewRecvTxNtfn(hexTx string, block *BlockDetails) *RecvTxNtfn {
}
}
// RedeemingTxNtfn defines the redeemingtx JSON-RPC notification.
// RedeemingTxNtfn defines the redeemingTx JSON-RPC notification.
//
// NOTE: Deprecated. Use RelevantTxAcceptedNtfn and FilteredBlockConnectedNtfn
// instead.
@ -192,7 +192,7 @@ type RedeemingTxNtfn struct {
}
// NewRedeemingTxNtfn returns a new instance which can be used to issue a
// redeemingtx JSON-RPC notification.
// redeemingTx JSON-RPC notification.
//
// NOTE: Deprecated. Use NewRelevantTxAcceptedNtfn and
// NewFilteredBlockConnectedNtfn instead.
@ -203,7 +203,7 @@ func NewRedeemingTxNtfn(hexTx string, block *BlockDetails) *RedeemingTxNtfn {
}
}
// RescanFinishedNtfn defines the rescanfinished JSON-RPC notification.
// RescanFinishedNtfn defines the rescanFinished JSON-RPC notification.
//
// NOTE: Deprecated. Not used with rescanblocks command.
type RescanFinishedNtfn struct {
@ -213,7 +213,7 @@ type RescanFinishedNtfn struct {
}
// NewRescanFinishedNtfn returns a new instance which can be used to issue a
// rescanfinished JSON-RPC notification.
// rescanFinished JSON-RPC notification.
//
// NOTE: Deprecated. Not used with rescanblocks command.
func NewRescanFinishedNtfn(hash string, height int32, time int64) *RescanFinishedNtfn {
@ -224,7 +224,7 @@ func NewRescanFinishedNtfn(hash string, height int32, time int64) *RescanFinishe
}
}
// RescanProgressNtfn defines the rescanprogress JSON-RPC notification.
// RescanProgressNtfn defines the rescanProgress JSON-RPC notification.
//
// NOTE: Deprecated. Not used with rescanblocks command.
type RescanProgressNtfn struct {
@ -234,7 +234,7 @@ type RescanProgressNtfn struct {
}
// NewRescanProgressNtfn returns a new instance which can be used to issue a
// rescanprogress JSON-RPC notification.
// rescanProgress JSON-RPC notification.
//
// NOTE: Deprecated. Not used with rescanblocks command.
func NewRescanProgressNtfn(hash string, height int32, time int64) *RescanProgressNtfn {
@ -245,14 +245,14 @@ func NewRescanProgressNtfn(hash string, height int32, time int64) *RescanProgres
}
}
// TxAcceptedNtfn defines the txaccepted JSON-RPC notification.
// TxAcceptedNtfn defines the txAccepted JSON-RPC notification.
type TxAcceptedNtfn struct {
TxID string
Amount float64
}
// NewTxAcceptedNtfn returns a new instance which can be used to issue a
// txaccepted JSON-RPC notification.
// txAccepted JSON-RPC notification.
func NewTxAcceptedNtfn(txHash string, amount float64) *TxAcceptedNtfn {
return &TxAcceptedNtfn{
TxID: txHash,
@ -260,20 +260,20 @@ func NewTxAcceptedNtfn(txHash string, amount float64) *TxAcceptedNtfn {
}
}
// TxAcceptedVerboseNtfn defines the txacceptedverbose JSON-RPC notification.
// TxAcceptedVerboseNtfn defines the txAcceptedVerbose JSON-RPC notification.
type TxAcceptedVerboseNtfn struct {
RawTx TxRawResult
}
// NewTxAcceptedVerboseNtfn returns a new instance which can be used to issue a
// txacceptedverbose JSON-RPC notification.
// txAcceptedVerbose JSON-RPC notification.
func NewTxAcceptedVerboseNtfn(rawTx TxRawResult) *TxAcceptedVerboseNtfn {
return &TxAcceptedVerboseNtfn{
RawTx: rawTx,
}
}
// RelevantTxAcceptedNtfn defines the parameters to the relevanttxaccepted
// RelevantTxAcceptedNtfn defines the parameters to the relevantTxAccepted
// JSON-RPC notification.
type RelevantTxAcceptedNtfn struct {
Transaction string `json:"transaction"`

View File

@ -30,14 +30,14 @@ func TestDAGSvrWsNtfns(t *testing.T) {
unmarshalled interface{}
}{
{
name: "blockconnected",
name: "blockConnected",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("blockconnected", "123", 100000, 123456789)
return btcjson.NewCmd("blockConnected", "123", 100000, 123456789)
},
staticNtfn: func() interface{} {
return btcjson.NewBlockConnectedNtfn("123", 100000, 123456789)
},
marshalled: `{"jsonrpc":"1.0","method":"blockconnected","params":["123",100000,123456789],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"blockConnected","params":["123",100000,123456789],"id":null}`,
unmarshalled: &btcjson.BlockConnectedNtfn{
Hash: "123",
Height: 100000,
@ -45,14 +45,14 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "blockdisconnected",
name: "blockDisconnected",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("blockdisconnected", "123", 100000, 123456789)
return btcjson.NewCmd("blockDisconnected", "123", 100000, 123456789)
},
staticNtfn: func() interface{} {
return btcjson.NewBlockDisconnectedNtfn("123", 100000, 123456789)
},
marshalled: `{"jsonrpc":"1.0","method":"blockdisconnected","params":["123",100000,123456789],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"blockDisconnected","params":["123",100000,123456789],"id":null}`,
unmarshalled: &btcjson.BlockDisconnectedNtfn{
Hash: "123",
Height: 100000,
@ -60,14 +60,14 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "filteredblockconnected",
name: "filteredBlockConnected",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("filteredblockconnected", 100000, "header", []string{"tx0", "tx1"})
return btcjson.NewCmd("filteredBlockConnected", 100000, "header", []string{"tx0", "tx1"})
},
staticNtfn: func() interface{} {
return btcjson.NewFilteredBlockConnectedNtfn(100000, "header", []string{"tx0", "tx1"})
},
marshalled: `{"jsonrpc":"1.0","method":"filteredblockconnected","params":[100000,"header",["tx0","tx1"]],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"filteredBlockConnected","params":[100000,"header",["tx0","tx1"]],"id":null}`,
unmarshalled: &btcjson.FilteredBlockConnectedNtfn{
Height: 100000,
Header: "header",
@ -75,23 +75,23 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "filteredblockdisconnected",
name: "filteredBlockDisconnected",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("filteredblockdisconnected", 100000, "header")
return btcjson.NewCmd("filteredBlockDisconnected", 100000, "header")
},
staticNtfn: func() interface{} {
return btcjson.NewFilteredBlockDisconnectedNtfn(100000, "header")
},
marshalled: `{"jsonrpc":"1.0","method":"filteredblockdisconnected","params":[100000,"header"],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"filteredBlockDisconnected","params":[100000,"header"],"id":null}`,
unmarshalled: &btcjson.FilteredBlockDisconnectedNtfn{
Height: 100000,
Header: "header",
},
},
{
name: "recvtx",
name: "recvTx",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("recvtx", "001122", `{"height":100000,"hash":"123","index":0,"time":12345678}`)
return btcjson.NewCmd("recvTx", "001122", `{"height":100000,"hash":"123","index":0,"time":12345678}`)
},
staticNtfn: func() interface{} {
blockDetails := btcjson.BlockDetails{
@ -102,7 +102,7 @@ func TestDAGSvrWsNtfns(t *testing.T) {
}
return btcjson.NewRecvTxNtfn("001122", &blockDetails)
},
marshalled: `{"jsonrpc":"1.0","method":"recvtx","params":["001122",{"height":100000,"hash":"123","index":0,"time":12345678}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"recvTx","params":["001122",{"height":100000,"hash":"123","index":0,"time":12345678}],"id":null}`,
unmarshalled: &btcjson.RecvTxNtfn{
HexTx: "001122",
Block: &btcjson.BlockDetails{
@ -114,9 +114,9 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "redeemingtx",
name: "redeemingTx",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("redeemingtx", "001122", `{"height":100000,"hash":"123","index":0,"time":12345678}`)
return btcjson.NewCmd("redeemingTx", "001122", `{"height":100000,"hash":"123","index":0,"time":12345678}`)
},
staticNtfn: func() interface{} {
blockDetails := btcjson.BlockDetails{
@ -127,7 +127,7 @@ func TestDAGSvrWsNtfns(t *testing.T) {
}
return btcjson.NewRedeemingTxNtfn("001122", &blockDetails)
},
marshalled: `{"jsonrpc":"1.0","method":"redeemingtx","params":["001122",{"height":100000,"hash":"123","index":0,"time":12345678}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"redeemingTx","params":["001122",{"height":100000,"hash":"123","index":0,"time":12345678}],"id":null}`,
unmarshalled: &btcjson.RedeemingTxNtfn{
HexTx: "001122",
Block: &btcjson.BlockDetails{
@ -139,14 +139,14 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "rescanfinished",
name: "rescanFinished",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("rescanfinished", "123", 100000, 12345678)
return btcjson.NewCmd("rescanFinished", "123", 100000, 12345678)
},
staticNtfn: func() interface{} {
return btcjson.NewRescanFinishedNtfn("123", 100000, 12345678)
},
marshalled: `{"jsonrpc":"1.0","method":"rescanfinished","params":["123",100000,12345678],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"rescanFinished","params":["123",100000,12345678],"id":null}`,
unmarshalled: &btcjson.RescanFinishedNtfn{
Hash: "123",
Height: 100000,
@ -154,14 +154,14 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "rescanprogress",
name: "rescanProgress",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("rescanprogress", "123", 100000, 12345678)
return btcjson.NewCmd("rescanProgress", "123", 100000, 12345678)
},
staticNtfn: func() interface{} {
return btcjson.NewRescanProgressNtfn("123", 100000, 12345678)
},
marshalled: `{"jsonrpc":"1.0","method":"rescanprogress","params":["123",100000,12345678],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"rescanProgress","params":["123",100000,12345678],"id":null}`,
unmarshalled: &btcjson.RescanProgressNtfn{
Hash: "123",
Height: 100000,
@ -169,23 +169,23 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "txaccepted",
name: "txAccepted",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("txaccepted", "123", 1.5)
return btcjson.NewCmd("txAccepted", "123", 1.5)
},
staticNtfn: func() interface{} {
return btcjson.NewTxAcceptedNtfn("123", 1.5)
},
marshalled: `{"jsonrpc":"1.0","method":"txaccepted","params":["123",1.5],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"txAccepted","params":["123",1.5],"id":null}`,
unmarshalled: &btcjson.TxAcceptedNtfn{
TxID: "123",
Amount: 1.5,
},
},
{
name: "txacceptedverbose",
name: "txAcceptedVerbose",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("txacceptedverbose", `{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null,"confirmations":0}`)
return btcjson.NewCmd("txAcceptedVerbose", `{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null,"confirmations":0}`)
},
staticNtfn: func() interface{} {
txResult := btcjson.TxRawResult{
@ -199,7 +199,7 @@ func TestDAGSvrWsNtfns(t *testing.T) {
}
return btcjson.NewTxAcceptedVerboseNtfn(txResult)
},
marshalled: `{"jsonrpc":"1.0","method":"txacceptedverbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"txAcceptedVerbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null}],"id":null}`,
unmarshalled: &btcjson.TxAcceptedVerboseNtfn{
RawTx: btcjson.TxRawResult{
Hex: "001122",
@ -213,14 +213,14 @@ func TestDAGSvrWsNtfns(t *testing.T) {
},
},
{
name: "relevanttxaccepted",
name: "relevantTxAccepted",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("relevanttxaccepted", "001122")
return btcjson.NewCmd("relevantTxAccepted", "001122")
},
staticNtfn: func() interface{} {
return btcjson.NewRelevantTxAcceptedNtfn("001122")
},
marshalled: `{"jsonrpc":"1.0","method":"relevanttxaccepted","params":["001122"],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"relevantTxAccepted","params":["001122"],"id":null}`,
unmarshalled: &btcjson.RelevantTxAcceptedNtfn{
Transaction: "001122",
},

View File

@ -38,7 +38,7 @@ func ExampleMarshalCmd() {
fmt.Printf("%s\n", marshalledBytes)
// Output:
// {"jsonrpc":"1.0","method":"getblock","params":["000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",false],"id":1}
// {"jsonrpc":"1.0","method":"getBlock","params":["000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",false],"id":1}
}
// This example demonstrates how to unmarshal a JSON-RPC request and then
@ -46,7 +46,7 @@ func ExampleMarshalCmd() {
func ExampleUnmarshalCmd() {
// Ordinarily this would be read from the wire, but for this example,
// it is hard coded here for clarity.
data := []byte(`{"jsonrpc":"1.0","method":"getblock","params":["000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",false],"id":1}`)
data := []byte(`{"jsonrpc":"1.0","method":"getBlock","params":["000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",false],"id":1}`)
// Unmarshal the raw bytes from the wire into a JSON-RPC request.
var request btcjson.Request
@ -63,7 +63,7 @@ func ExampleUnmarshalCmd() {
fmt.Println("Unexpected notification")
return
}
if request.Method != "getblock" {
if request.Method != "getBlock" {
fmt.Println("Unexpected method")
return
}

View File

@ -67,7 +67,7 @@ func TestRegisterCmdErrors(t *testing.T) {
}{
{
name: "duplicate method",
method: "getblock",
method: "getBlock",
cmdFunc: func() interface{} {
return struct{}{}
},
@ -75,7 +75,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "invalid usage flags",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
return 0
},
@ -84,7 +84,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "invalid type",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
return 0
},
@ -92,7 +92,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "invalid type 2",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
return &[]string{}
},
@ -100,7 +100,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "embedded field",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ int }
return (*test)(nil)
@ -109,7 +109,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unexported field",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ a int }
return (*test)(nil)
@ -118,7 +118,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unsupported field type 1",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ A **int }
return (*test)(nil)
@ -127,7 +127,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unsupported field type 2",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ A chan int }
return (*test)(nil)
@ -136,7 +136,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unsupported field type 3",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ A complex64 }
return (*test)(nil)
@ -145,7 +145,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unsupported field type 4",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ A complex128 }
return (*test)(nil)
@ -154,7 +154,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unsupported field type 5",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ A func() }
return (*test)(nil)
@ -163,7 +163,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "unsupported field type 6",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct{ A interface{} }
return (*test)(nil)
@ -172,7 +172,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "required after optional",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct {
A *int
@ -184,7 +184,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "non-optional with default",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct {
A int `jsonrpcdefault:"1"`
@ -195,7 +195,7 @@ func TestRegisterCmdErrors(t *testing.T) {
},
{
name: "mismatched default",
method: "registertestcmd",
method: "registerTestCmd",
cmdFunc: func() interface{} {
type test struct {
A *int `jsonrpcdefault:"1.7"`

View File

@ -15,7 +15,7 @@ type AddMultisigAddressCmd struct {
}
// NewAddMultisigAddressCmd returns a new instance which can be used to issue a
// addmultisigaddress JSON-RPC command.
// addMultisigAddress JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -27,14 +27,14 @@ func NewAddMultisigAddressCmd(nRequired int, keys []string, account *string) *Ad
}
}
// CreateMultisigCmd defines the createmultisig JSON-RPC command.
// CreateMultisigCmd defines the createMultisig JSON-RPC command.
type CreateMultisigCmd struct {
NRequired int
Keys []string
}
// NewCreateMultisigCmd returns a new instance which can be used to issue a
// createmultisig JSON-RPC command.
// createMultisig JSON-RPC command.
func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd {
return &CreateMultisigCmd{
NRequired: nRequired,
@ -42,105 +42,105 @@ func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd {
}
}
// DumpPrivKeyCmd defines the dumpprivkey JSON-RPC command.
// DumpPrivKeyCmd defines the dumpPrivKey JSON-RPC command.
type DumpPrivKeyCmd struct {
Address string
}
// NewDumpPrivKeyCmd returns a new instance which can be used to issue a
// dumpprivkey JSON-RPC command.
// dumpPrivKey JSON-RPC command.
func NewDumpPrivKeyCmd(address string) *DumpPrivKeyCmd {
return &DumpPrivKeyCmd{
Address: address,
}
}
// EncryptWalletCmd defines the encryptwallet JSON-RPC command.
// EncryptWalletCmd defines the encryptWallet JSON-RPC command.
type EncryptWalletCmd struct {
Passphrase string
}
// NewEncryptWalletCmd returns a new instance which can be used to issue a
// encryptwallet JSON-RPC command.
// encryptWallet JSON-RPC command.
func NewEncryptWalletCmd(passphrase string) *EncryptWalletCmd {
return &EncryptWalletCmd{
Passphrase: passphrase,
}
}
// EstimateFeeCmd defines the estimatefee JSON-RPC command.
// EstimateFeeCmd defines the estimateFee JSON-RPC command.
type EstimateFeeCmd struct {
NumBlocks int64
}
// NewEstimateFeeCmd returns a new instance which can be used to issue a
// estimatefee JSON-RPC command.
// estimateFee JSON-RPC command.
func NewEstimateFeeCmd(numBlocks int64) *EstimateFeeCmd {
return &EstimateFeeCmd{
NumBlocks: numBlocks,
}
}
// EstimatePriorityCmd defines the estimatepriority JSON-RPC command.
// EstimatePriorityCmd defines the estimatePriority JSON-RPC command.
type EstimatePriorityCmd struct {
NumBlocks int64
}
// NewEstimatePriorityCmd returns a new instance which can be used to issue a
// estimatepriority JSON-RPC command.
// estimatePriority JSON-RPC command.
func NewEstimatePriorityCmd(numBlocks int64) *EstimatePriorityCmd {
return &EstimatePriorityCmd{
NumBlocks: numBlocks,
}
}
// GetAccountCmd defines the getaccount JSON-RPC command.
// GetAccountCmd defines the getAccount JSON-RPC command.
type GetAccountCmd struct {
Address string
}
// NewGetAccountCmd returns a new instance which can be used to issue a
// getaccount JSON-RPC command.
// getAccount JSON-RPC command.
func NewGetAccountCmd(address string) *GetAccountCmd {
return &GetAccountCmd{
Address: address,
}
}
// GetAccountAddressCmd defines the getaccountaddress JSON-RPC command.
// GetAccountAddressCmd defines the getAccountAddress JSON-RPC command.
type GetAccountAddressCmd struct {
Account string
}
// NewGetAccountAddressCmd returns a new instance which can be used to issue a
// getaccountaddress JSON-RPC command.
// getAccountAddress JSON-RPC command.
func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd {
return &GetAccountAddressCmd{
Account: account,
}
}
// GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command.
// GetAddressesByAccountCmd defines the getAddressesByAccount JSON-RPC command.
type GetAddressesByAccountCmd struct {
Account string
}
// NewGetAddressesByAccountCmd returns a new instance which can be used to issue
// a getaddressesbyaccount JSON-RPC command.
// a getAddressesByAccount JSON-RPC command.
func NewGetAddressesByAccountCmd(account string) *GetAddressesByAccountCmd {
return &GetAddressesByAccountCmd{
Account: account,
}
}
// GetBalanceCmd defines the getbalance JSON-RPC command.
// GetBalanceCmd defines the getBalance JSON-RPC command.
type GetBalanceCmd struct {
Account *string
MinConf *int `jsonrpcdefault:"1"`
}
// NewGetBalanceCmd returns a new instance which can be used to issue a
// getbalance JSON-RPC command.
// getBalance JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -151,13 +151,13 @@ func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd {
}
}
// GetNewAddressCmd defines the getnewaddress JSON-RPC command.
// GetNewAddressCmd defines the getNewAddress JSON-RPC command.
type GetNewAddressCmd struct {
Account *string
}
// NewGetNewAddressCmd returns a new instance which can be used to issue a
// getnewaddress JSON-RPC command.
// getNewAddress JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -167,13 +167,13 @@ func NewGetNewAddressCmd(account *string) *GetNewAddressCmd {
}
}
// GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command.
// GetRawChangeAddressCmd defines the getRawChangeAddress JSON-RPC command.
type GetRawChangeAddressCmd struct {
Account *string
}
// NewGetRawChangeAddressCmd returns a new instance which can be used to issue a
// getrawchangeaddress JSON-RPC command.
// getRawChangeAddress JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -183,14 +183,14 @@ func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd {
}
}
// GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command.
// GetReceivedByAccountCmd defines the getReceivedByAccount JSON-RPC command.
type GetReceivedByAccountCmd struct {
Account string
MinConf *int `jsonrpcdefault:"1"`
}
// NewGetReceivedByAccountCmd returns a new instance which can be used to issue
// a getreceivedbyaccount JSON-RPC command.
// a getReceivedByAccount JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -201,14 +201,14 @@ func NewGetReceivedByAccountCmd(account string, minConf *int) *GetReceivedByAcco
}
}
// GetReceivedByAddressCmd defines the getreceivedbyaddress JSON-RPC command.
// GetReceivedByAddressCmd defines the getReceivedByAddress JSON-RPC command.
type GetReceivedByAddressCmd struct {
Address string
MinConf *int `jsonrpcdefault:"1"`
}
// NewGetReceivedByAddressCmd returns a new instance which can be used to issue
// a getreceivedbyaddress JSON-RPC command.
// a getReceivedByAddress JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -219,14 +219,14 @@ func NewGetReceivedByAddressCmd(address string, minConf *int) *GetReceivedByAddr
}
}
// GetTransactionCmd defines the gettransaction JSON-RPC command.
// GetTransactionCmd defines the getTransaction JSON-RPC command.
type GetTransactionCmd struct {
Txid string
IncludeWatchOnly *bool `jsonrpcdefault:"false"`
}
// NewGetTransactionCmd returns a new instance which can be used to issue a
// gettransaction JSON-RPC command.
// getTransaction JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -237,16 +237,16 @@ func NewGetTransactionCmd(txHash string, includeWatchOnly *bool) *GetTransaction
}
}
// GetWalletInfoCmd defines the getwalletinfo JSON-RPC command.
// GetWalletInfoCmd defines the getWalletInfo JSON-RPC command.
type GetWalletInfoCmd struct{}
// NewGetWalletInfoCmd returns a new instance which can be used to issue a
// getwalletinfo JSON-RPC command.
// getWalletInfo JSON-RPC command.
func NewGetWalletInfoCmd() *GetWalletInfoCmd {
return &GetWalletInfoCmd{}
}
// ImportPrivKeyCmd defines the importprivkey JSON-RPC command.
// ImportPrivKeyCmd defines the importPrivKey JSON-RPC command.
type ImportPrivKeyCmd struct {
PrivKey string
Label *string
@ -254,7 +254,7 @@ type ImportPrivKeyCmd struct {
}
// NewImportPrivKeyCmd returns a new instance which can be used to issue a
// importprivkey JSON-RPC command.
// importPrivKey JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -266,13 +266,13 @@ func NewImportPrivKeyCmd(privKey string, label *string, rescan *bool) *ImportPri
}
}
// KeyPoolRefillCmd defines the keypoolrefill JSON-RPC command.
// KeyPoolRefillCmd defines the keyPoolRefill JSON-RPC command.
type KeyPoolRefillCmd struct {
NewSize *uint `jsonrpcdefault:"100"`
}
// NewKeyPoolRefillCmd returns a new instance which can be used to issue a
// keypoolrefill JSON-RPC command.
// keyPoolRefill JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -282,13 +282,13 @@ func NewKeyPoolRefillCmd(newSize *uint) *KeyPoolRefillCmd {
}
}
// ListAccountsCmd defines the listaccounts JSON-RPC command.
// ListAccountsCmd defines the listAccounts JSON-RPC command.
type ListAccountsCmd struct {
MinConf *int `jsonrpcdefault:"1"`
}
// NewListAccountsCmd returns a new instance which can be used to issue a
// listaccounts JSON-RPC command.
// listAccounts JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -298,7 +298,7 @@ func NewListAccountsCmd(minConf *int) *ListAccountsCmd {
}
}
// ListAddressGroupingsCmd defines the listaddressgroupings JSON-RPC command.
// ListAddressGroupingsCmd defines the listAddressGroupings JSON-RPC command.
type ListAddressGroupingsCmd struct{}
// NewListAddressGroupingsCmd returns a new instance which can be used to issue
@ -307,16 +307,16 @@ func NewListAddressGroupingsCmd() *ListAddressGroupingsCmd {
return &ListAddressGroupingsCmd{}
}
// ListLockUnspentCmd defines the listlockunspent JSON-RPC command.
// ListLockUnspentCmd defines the listLockUnspent JSON-RPC command.
type ListLockUnspentCmd struct{}
// NewListLockUnspentCmd returns a new instance which can be used to issue a
// listlockunspent JSON-RPC command.
// listLockUnspent JSON-RPC command.
func NewListLockUnspentCmd() *ListLockUnspentCmd {
return &ListLockUnspentCmd{}
}
// ListReceivedByAccountCmd defines the listreceivedbyaccount JSON-RPC command.
// ListReceivedByAccountCmd defines the listReceivedByAccount JSON-RPC command.
type ListReceivedByAccountCmd struct {
MinConf *int `jsonrpcdefault:"1"`
IncludeEmpty *bool `jsonrpcdefault:"false"`
@ -324,7 +324,7 @@ type ListReceivedByAccountCmd struct {
}
// NewListReceivedByAccountCmd returns a new instance which can be used to issue
// a listreceivedbyaccount JSON-RPC command.
// a listReceivedByAccount JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -336,7 +336,7 @@ func NewListReceivedByAccountCmd(minConf *int, includeEmpty, includeWatchOnly *b
}
}
// ListReceivedByAddressCmd defines the listreceivedbyaddress JSON-RPC command.
// ListReceivedByAddressCmd defines the listReceivedByAddress JSON-RPC command.
type ListReceivedByAddressCmd struct {
MinConf *int `jsonrpcdefault:"1"`
IncludeEmpty *bool `jsonrpcdefault:"false"`
@ -344,7 +344,7 @@ type ListReceivedByAddressCmd struct {
}
// NewListReceivedByAddressCmd returns a new instance which can be used to issue
// a listreceivedbyaddress JSON-RPC command.
// a listReceivedByAddress JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -356,7 +356,7 @@ func NewListReceivedByAddressCmd(minConf *int, includeEmpty, includeWatchOnly *b
}
}
// ListSinceBlockCmd defines the listsinceblock JSON-RPC command.
// ListSinceBlockCmd defines the listSinceBlock JSON-RPC command.
type ListSinceBlockCmd struct {
BlockHash *string
TargetConfirmations *int `jsonrpcdefault:"1"`
@ -364,7 +364,7 @@ type ListSinceBlockCmd struct {
}
// NewListSinceBlockCmd returns a new instance which can be used to issue a
// listsinceblock JSON-RPC command.
// listSinceBlock JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -376,7 +376,7 @@ func NewListSinceBlockCmd(blockHash *string, targetConfirms *int, includeWatchOn
}
}
// ListTransactionsCmd defines the listtransactions JSON-RPC command.
// ListTransactionsCmd defines the listTransactions JSON-RPC command.
type ListTransactionsCmd struct {
Account *string
Count *int `jsonrpcdefault:"10"`
@ -385,7 +385,7 @@ type ListTransactionsCmd struct {
}
// NewListTransactionsCmd returns a new instance which can be used to issue a
// listtransactions JSON-RPC command.
// listTransactions JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -398,7 +398,7 @@ func NewListTransactionsCmd(account *string, count, from *int, includeWatchOnly
}
}
// ListUnspentCmd defines the listunspent JSON-RPC command.
// ListUnspentCmd defines the listUnspent JSON-RPC command.
type ListUnspentCmd struct {
MinConf *int `jsonrpcdefault:"1"`
MaxConf *int `jsonrpcdefault:"9999999"`
@ -406,7 +406,7 @@ type ListUnspentCmd struct {
}
// NewListUnspentCmd returns a new instance which can be used to issue a
// listunspent JSON-RPC command.
// listUnspent JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -418,14 +418,14 @@ func NewListUnspentCmd(minConf, maxConf *int, addresses *[]string) *ListUnspentC
}
}
// LockUnspentCmd defines the lockunspent JSON-RPC command.
// LockUnspentCmd defines the lockUnspent JSON-RPC command.
type LockUnspentCmd struct {
Unlock bool
Transactions []TransactionInput
}
// NewLockUnspentCmd returns a new instance which can be used to issue a
// lockunspent JSON-RPC command.
// lockUnspent JSON-RPC command.
func NewLockUnspentCmd(unlock bool, transactions []TransactionInput) *LockUnspentCmd {
return &LockUnspentCmd{
Unlock: unlock,
@ -457,7 +457,7 @@ func NewMoveCmd(fromAccount, toAccount string, amount float64, minConf *int, com
}
}
// SendFromCmd defines the sendfrom JSON-RPC command.
// SendFromCmd defines the sendFrom JSON-RPC command.
type SendFromCmd struct {
FromAccount string
ToAddress string
@ -467,7 +467,7 @@ type SendFromCmd struct {
CommentTo *string
}
// NewSendFromCmd returns a new instance which can be used to issue a sendfrom
// NewSendFromCmd returns a new instance which can be used to issue a sendFrom
// JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
@ -483,7 +483,7 @@ func NewSendFromCmd(fromAccount, toAddress string, amount float64, minConf *int,
}
}
// SendManyCmd defines the sendmany JSON-RPC command.
// SendManyCmd defines the sendMany JSON-RPC command.
type SendManyCmd struct {
FromAccount string
Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
@ -491,7 +491,7 @@ type SendManyCmd struct {
Comment *string
}
// NewSendManyCmd returns a new instance which can be used to issue a sendmany
// NewSendManyCmd returns a new instance which can be used to issue a sendMany
// JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
@ -505,7 +505,7 @@ func NewSendManyCmd(fromAccount string, amounts map[string]float64, minConf *int
}
}
// SendToAddressCmd defines the sendtoaddress JSON-RPC command.
// SendToAddressCmd defines the sendToAddress JSON-RPC command.
type SendToAddressCmd struct {
Address string
Amount float64
@ -514,7 +514,7 @@ type SendToAddressCmd struct {
}
// NewSendToAddressCmd returns a new instance which can be used to issue a
// sendtoaddress JSON-RPC command.
// sendToAddress JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -527,14 +527,14 @@ func NewSendToAddressCmd(address string, amount float64, comment, commentTo *str
}
}
// SetAccountCmd defines the setaccount JSON-RPC command.
// SetAccountCmd defines the setAccount JSON-RPC command.
type SetAccountCmd struct {
Address string
Account string
}
// NewSetAccountCmd returns a new instance which can be used to issue a
// setaccount JSON-RPC command.
// setAccount JSON-RPC command.
func NewSetAccountCmd(address, account string) *SetAccountCmd {
return &SetAccountCmd{
Address: address,
@ -542,12 +542,12 @@ func NewSetAccountCmd(address, account string) *SetAccountCmd {
}
}
// SetTxFeeCmd defines the settxfee JSON-RPC command.
// SetTxFeeCmd defines the setTxFee JSON-RPC command.
type SetTxFeeCmd struct {
Amount float64 // In BTC
}
// NewSetTxFeeCmd returns a new instance which can be used to issue a settxfee
// NewSetTxFeeCmd returns a new instance which can be used to issue a setTxFee
// JSON-RPC command.
func NewSetTxFeeCmd(amount float64) *SetTxFeeCmd {
return &SetTxFeeCmd{
@ -555,14 +555,14 @@ func NewSetTxFeeCmd(amount float64) *SetTxFeeCmd {
}
}
// SignMessageCmd defines the signmessage JSON-RPC command.
// SignMessageCmd defines the signMessage JSON-RPC command.
type SignMessageCmd struct {
Address string
Message string
}
// NewSignMessageCmd returns a new instance which can be used to issue a
// signmessage JSON-RPC command.
// signMessage JSON-RPC command.
func NewSignMessageCmd(address, message string) *SignMessageCmd {
return &SignMessageCmd{
Address: address,
@ -579,7 +579,7 @@ type RawTxInput struct {
RedeemScript string `json:"redeemScript"`
}
// SignRawTransactionCmd defines the signrawtransaction JSON-RPC command.
// SignRawTransactionCmd defines the signRawTransaction JSON-RPC command.
type SignRawTransactionCmd struct {
RawTx string
Inputs *[]RawTxInput
@ -588,7 +588,7 @@ type SignRawTransactionCmd struct {
}
// NewSignRawTransactionCmd returns a new instance which can be used to issue a
// signrawtransaction JSON-RPC command.
// signRawTransaction JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -601,23 +601,23 @@ func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKey
}
}
// WalletLockCmd defines the walletlock JSON-RPC command.
// WalletLockCmd defines the walletLock JSON-RPC command.
type WalletLockCmd struct{}
// NewWalletLockCmd returns a new instance which can be used to issue a
// walletlock JSON-RPC command.
// walletLock JSON-RPC command.
func NewWalletLockCmd() *WalletLockCmd {
return &WalletLockCmd{}
}
// WalletPassphraseCmd defines the walletpassphrase JSON-RPC command.
// WalletPassphraseCmd defines the walletPassphrase JSON-RPC command.
type WalletPassphraseCmd struct {
Passphrase string
Timeout int64
}
// NewWalletPassphraseCmd returns a new instance which can be used to issue a
// walletpassphrase JSON-RPC command.
// walletPassphrase JSON-RPC command.
func NewWalletPassphraseCmd(passphrase string, timeout int64) *WalletPassphraseCmd {
return &WalletPassphraseCmd{
Passphrase: passphrase,
@ -625,14 +625,14 @@ func NewWalletPassphraseCmd(passphrase string, timeout int64) *WalletPassphraseC
}
}
// WalletPassphraseChangeCmd defines the walletpassphrase JSON-RPC command.
// WalletPassphraseChangeCmd defines the walletPassphrase JSON-RPC command.
type WalletPassphraseChangeCmd struct {
OldPassphrase string
NewPassphrase string
}
// NewWalletPassphraseChangeCmd returns a new instance which can be used to
// issue a walletpassphrasechange JSON-RPC command.
// issue a walletPassphraseChange JSON-RPC command.
func NewWalletPassphraseChangeCmd(oldPassphrase, newPassphrase string) *WalletPassphraseChangeCmd {
return &WalletPassphraseChangeCmd{
OldPassphrase: oldPassphrase,
@ -644,42 +644,42 @@ func init() {
// The commands in this file are only usable with a wallet server.
flags := UFWalletOnly
MustRegisterCmd("addmultisigaddress", (*AddMultisigAddressCmd)(nil), flags)
MustRegisterCmd("createmultisig", (*CreateMultisigCmd)(nil), flags)
MustRegisterCmd("dumpprivkey", (*DumpPrivKeyCmd)(nil), flags)
MustRegisterCmd("encryptwallet", (*EncryptWalletCmd)(nil), flags)
MustRegisterCmd("estimatefee", (*EstimateFeeCmd)(nil), flags)
MustRegisterCmd("estimatepriority", (*EstimatePriorityCmd)(nil), flags)
MustRegisterCmd("getaccount", (*GetAccountCmd)(nil), flags)
MustRegisterCmd("getaccountaddress", (*GetAccountAddressCmd)(nil), flags)
MustRegisterCmd("getaddressesbyaccount", (*GetAddressesByAccountCmd)(nil), flags)
MustRegisterCmd("getbalance", (*GetBalanceCmd)(nil), flags)
MustRegisterCmd("getnewaddress", (*GetNewAddressCmd)(nil), flags)
MustRegisterCmd("getrawchangeaddress", (*GetRawChangeAddressCmd)(nil), flags)
MustRegisterCmd("getreceivedbyaccount", (*GetReceivedByAccountCmd)(nil), flags)
MustRegisterCmd("getreceivedbyaddress", (*GetReceivedByAddressCmd)(nil), flags)
MustRegisterCmd("gettransaction", (*GetTransactionCmd)(nil), flags)
MustRegisterCmd("getwalletinfo", (*GetWalletInfoCmd)(nil), flags)
MustRegisterCmd("importprivkey", (*ImportPrivKeyCmd)(nil), flags)
MustRegisterCmd("keypoolrefill", (*KeyPoolRefillCmd)(nil), flags)
MustRegisterCmd("listaccounts", (*ListAccountsCmd)(nil), flags)
MustRegisterCmd("listaddressgroupings", (*ListAddressGroupingsCmd)(nil), flags)
MustRegisterCmd("listlockunspent", (*ListLockUnspentCmd)(nil), flags)
MustRegisterCmd("listreceivedbyaccount", (*ListReceivedByAccountCmd)(nil), flags)
MustRegisterCmd("listreceivedbyaddress", (*ListReceivedByAddressCmd)(nil), flags)
MustRegisterCmd("listsinceblock", (*ListSinceBlockCmd)(nil), flags)
MustRegisterCmd("listtransactions", (*ListTransactionsCmd)(nil), flags)
MustRegisterCmd("listunspent", (*ListUnspentCmd)(nil), flags)
MustRegisterCmd("lockunspent", (*LockUnspentCmd)(nil), flags)
MustRegisterCmd("addMultisigAddress", (*AddMultisigAddressCmd)(nil), flags)
MustRegisterCmd("createMultisig", (*CreateMultisigCmd)(nil), flags)
MustRegisterCmd("dumpPrivKey", (*DumpPrivKeyCmd)(nil), flags)
MustRegisterCmd("encryptWallet", (*EncryptWalletCmd)(nil), flags)
MustRegisterCmd("estimateFee", (*EstimateFeeCmd)(nil), flags)
MustRegisterCmd("estimatePriority", (*EstimatePriorityCmd)(nil), flags)
MustRegisterCmd("getAccount", (*GetAccountCmd)(nil), flags)
MustRegisterCmd("getAccountAddress", (*GetAccountAddressCmd)(nil), flags)
MustRegisterCmd("getAddressesByAccount", (*GetAddressesByAccountCmd)(nil), flags)
MustRegisterCmd("getBalance", (*GetBalanceCmd)(nil), flags)
MustRegisterCmd("getNewAddress", (*GetNewAddressCmd)(nil), flags)
MustRegisterCmd("getRawChangeAddress", (*GetRawChangeAddressCmd)(nil), flags)
MustRegisterCmd("getReceivedByAccount", (*GetReceivedByAccountCmd)(nil), flags)
MustRegisterCmd("getReceivedByAddress", (*GetReceivedByAddressCmd)(nil), flags)
MustRegisterCmd("getTransaction", (*GetTransactionCmd)(nil), flags)
MustRegisterCmd("getWalletInfo", (*GetWalletInfoCmd)(nil), flags)
MustRegisterCmd("importPrivKey", (*ImportPrivKeyCmd)(nil), flags)
MustRegisterCmd("keyPoolRefill", (*KeyPoolRefillCmd)(nil), flags)
MustRegisterCmd("listAccounts", (*ListAccountsCmd)(nil), flags)
MustRegisterCmd("listAddressGroupings", (*ListAddressGroupingsCmd)(nil), flags)
MustRegisterCmd("listLockUnspent", (*ListLockUnspentCmd)(nil), flags)
MustRegisterCmd("listReceivedByAccount", (*ListReceivedByAccountCmd)(nil), flags)
MustRegisterCmd("listReceivedByAddress", (*ListReceivedByAddressCmd)(nil), flags)
MustRegisterCmd("listSinceBlock", (*ListSinceBlockCmd)(nil), flags)
MustRegisterCmd("listTransactions", (*ListTransactionsCmd)(nil), flags)
MustRegisterCmd("listUnspent", (*ListUnspentCmd)(nil), flags)
MustRegisterCmd("lockUnspent", (*LockUnspentCmd)(nil), flags)
MustRegisterCmd("move", (*MoveCmd)(nil), flags)
MustRegisterCmd("sendfrom", (*SendFromCmd)(nil), flags)
MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags)
MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags)
MustRegisterCmd("setaccount", (*SetAccountCmd)(nil), flags)
MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags)
MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags)
MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags)
MustRegisterCmd("walletlock", (*WalletLockCmd)(nil), flags)
MustRegisterCmd("walletpassphrase", (*WalletPassphraseCmd)(nil), flags)
MustRegisterCmd("walletpassphrasechange", (*WalletPassphraseChangeCmd)(nil), flags)
MustRegisterCmd("sendFrom", (*SendFromCmd)(nil), flags)
MustRegisterCmd("sendMany", (*SendManyCmd)(nil), flags)
MustRegisterCmd("sendToAddress", (*SendToAddressCmd)(nil), flags)
MustRegisterCmd("setAccount", (*SetAccountCmd)(nil), flags)
MustRegisterCmd("setTxFee", (*SetTxFeeCmd)(nil), flags)
MustRegisterCmd("signMessage", (*SignMessageCmd)(nil), flags)
MustRegisterCmd("signRawTransaction", (*SignRawTransactionCmd)(nil), flags)
MustRegisterCmd("walletLock", (*WalletLockCmd)(nil), flags)
MustRegisterCmd("walletPassphrase", (*WalletPassphraseCmd)(nil), flags)
MustRegisterCmd("walletPassphraseChange", (*WalletPassphraseChangeCmd)(nil), flags)
}

File diff suppressed because it is too large Load Diff

View File

@ -7,27 +7,27 @@ package btcjson
// NOTE: This file is intended to house the RPC commands that are supported by
// a wallet server, but are only available via websockets.
// CreateEncryptedWalletCmd defines the createencryptedwallet JSON-RPC command.
// CreateEncryptedWalletCmd defines the createEncryptedWallet JSON-RPC command.
type CreateEncryptedWalletCmd struct {
Passphrase string
}
// NewCreateEncryptedWalletCmd returns a new instance which can be used to issue
// a createencryptedwallet JSON-RPC command.
// a createEncryptedWallet JSON-RPC command.
func NewCreateEncryptedWalletCmd(passphrase string) *CreateEncryptedWalletCmd {
return &CreateEncryptedWalletCmd{
Passphrase: passphrase,
}
}
// ExportWatchingWalletCmd defines the exportwatchingwallet JSON-RPC command.
// ExportWatchingWalletCmd defines the exportWatchingWallet JSON-RPC command.
type ExportWatchingWalletCmd struct {
Account *string
Download *bool `jsonrpcdefault:"false"`
}
// NewExportWatchingWalletCmd returns a new instance which can be used to issue
// a exportwatchingwallet JSON-RPC command.
// a exportWatchingWallet JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -38,13 +38,13 @@ func NewExportWatchingWalletCmd(account *string, download *bool) *ExportWatching
}
}
// GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command.
// GetUnconfirmedBalanceCmd defines the getUnconfirmedBalance JSON-RPC command.
type GetUnconfirmedBalanceCmd struct {
Account *string
}
// NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue
// a getunconfirmedbalance JSON-RPC command.
// a getUnconfirmedBalance JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -54,7 +54,7 @@ func NewGetUnconfirmedBalanceCmd(account *string) *GetUnconfirmedBalanceCmd {
}
}
// ListAddressTransactionsCmd defines the listaddresstransactions JSON-RPC
// ListAddressTransactionsCmd defines the listAddressTransactions JSON-RPC
// command.
type ListAddressTransactionsCmd struct {
Addresses []string
@ -62,7 +62,7 @@ type ListAddressTransactionsCmd struct {
}
// NewListAddressTransactionsCmd returns a new instance which can be used to
// issue a listaddresstransactions JSON-RPC command.
// issue a listAddressTransactions JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -73,13 +73,13 @@ func NewListAddressTransactionsCmd(addresses []string, account *string) *ListAdd
}
}
// ListAllTransactionsCmd defines the listalltransactions JSON-RPC command.
// ListAllTransactionsCmd defines the listAllTransactions JSON-RPC command.
type ListAllTransactionsCmd struct {
Account *string
}
// NewListAllTransactionsCmd returns a new instance which can be used to issue a
// listalltransactions JSON-RPC command.
// listAllTransactions JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
@ -89,14 +89,14 @@ func NewListAllTransactionsCmd(account *string) *ListAllTransactionsCmd {
}
}
// RecoverAddressesCmd defines the recoveraddresses JSON-RPC command.
// RecoverAddressesCmd defines the recoverAddresses JSON-RPC command.
type RecoverAddressesCmd struct {
Account string
N int
}
// NewRecoverAddressesCmd returns a new instance which can be used to issue a
// recoveraddresses JSON-RPC command.
// recoverAddresses JSON-RPC command.
func NewRecoverAddressesCmd(account string, n int) *RecoverAddressesCmd {
return &RecoverAddressesCmd{
Account: account,
@ -104,11 +104,11 @@ func NewRecoverAddressesCmd(account string, n int) *RecoverAddressesCmd {
}
}
// WalletIsLockedCmd defines the walletislocked JSON-RPC command.
// WalletIsLockedCmd defines the walletIsLocked JSON-RPC command.
type WalletIsLockedCmd struct{}
// NewWalletIsLockedCmd returns a new instance which can be used to issue a
// walletislocked JSON-RPC command.
// walletIsLocked JSON-RPC command.
func NewWalletIsLockedCmd() *WalletIsLockedCmd {
return &WalletIsLockedCmd{}
}
@ -118,11 +118,11 @@ func init() {
// websockets.
flags := UFWalletOnly | UFWebsocketOnly
MustRegisterCmd("createencryptedwallet", (*CreateEncryptedWalletCmd)(nil), flags)
MustRegisterCmd("exportwatchingwallet", (*ExportWatchingWalletCmd)(nil), flags)
MustRegisterCmd("getunconfirmedbalance", (*GetUnconfirmedBalanceCmd)(nil), flags)
MustRegisterCmd("listaddresstransactions", (*ListAddressTransactionsCmd)(nil), flags)
MustRegisterCmd("listalltransactions", (*ListAllTransactionsCmd)(nil), flags)
MustRegisterCmd("recoveraddresses", (*RecoverAddressesCmd)(nil), flags)
MustRegisterCmd("walletislocked", (*WalletIsLockedCmd)(nil), flags)
MustRegisterCmd("createEncryptedWallet", (*CreateEncryptedWalletCmd)(nil), flags)
MustRegisterCmd("exportWatchingWallet", (*ExportWatchingWalletCmd)(nil), flags)
MustRegisterCmd("getUnconfirmedBalance", (*GetUnconfirmedBalanceCmd)(nil), flags)
MustRegisterCmd("listAddressTransactions", (*ListAddressTransactionsCmd)(nil), flags)
MustRegisterCmd("listAllTransactions", (*ListAllTransactionsCmd)(nil), flags)
MustRegisterCmd("recoverAddresses", (*RecoverAddressesCmd)(nil), flags)
MustRegisterCmd("walletIsLocked", (*WalletIsLockedCmd)(nil), flags)
}

View File

@ -30,163 +30,163 @@ func TestWalletSvrWsCmds(t *testing.T) {
unmarshalled interface{}
}{
{
name: "createencryptedwallet",
name: "createEncryptedWallet",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("createencryptedwallet", "pass")
return btcjson.NewCmd("createEncryptedWallet", "pass")
},
staticCmd: func() interface{} {
return btcjson.NewCreateEncryptedWalletCmd("pass")
},
marshalled: `{"jsonrpc":"1.0","method":"createencryptedwallet","params":["pass"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"createEncryptedWallet","params":["pass"],"id":1}`,
unmarshalled: &btcjson.CreateEncryptedWalletCmd{Passphrase: "pass"},
},
{
name: "exportwatchingwallet",
name: "exportWatchingWallet",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("exportwatchingwallet")
return btcjson.NewCmd("exportWatchingWallet")
},
staticCmd: func() interface{} {
return btcjson.NewExportWatchingWalletCmd(nil, nil)
},
marshalled: `{"jsonrpc":"1.0","method":"exportwatchingwallet","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"exportWatchingWallet","params":[],"id":1}`,
unmarshalled: &btcjson.ExportWatchingWalletCmd{
Account: nil,
Download: btcjson.Bool(false),
},
},
{
name: "exportwatchingwallet optional1",
name: "exportWatchingWallet optional1",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("exportwatchingwallet", "acct")
return btcjson.NewCmd("exportWatchingWallet", "acct")
},
staticCmd: func() interface{} {
return btcjson.NewExportWatchingWalletCmd(btcjson.String("acct"), nil)
},
marshalled: `{"jsonrpc":"1.0","method":"exportwatchingwallet","params":["acct"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"exportWatchingWallet","params":["acct"],"id":1}`,
unmarshalled: &btcjson.ExportWatchingWalletCmd{
Account: btcjson.String("acct"),
Download: btcjson.Bool(false),
},
},
{
name: "exportwatchingwallet optional2",
name: "exportWatchingWallet optional2",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("exportwatchingwallet", "acct", true)
return btcjson.NewCmd("exportWatchingWallet", "acct", true)
},
staticCmd: func() interface{} {
return btcjson.NewExportWatchingWalletCmd(btcjson.String("acct"),
btcjson.Bool(true))
},
marshalled: `{"jsonrpc":"1.0","method":"exportwatchingwallet","params":["acct",true],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"exportWatchingWallet","params":["acct",true],"id":1}`,
unmarshalled: &btcjson.ExportWatchingWalletCmd{
Account: btcjson.String("acct"),
Download: btcjson.Bool(true),
},
},
{
name: "getunconfirmedbalance",
name: "getUnconfirmedBalance",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getunconfirmedbalance")
return btcjson.NewCmd("getUnconfirmedBalance")
},
staticCmd: func() interface{} {
return btcjson.NewGetUnconfirmedBalanceCmd(nil)
},
marshalled: `{"jsonrpc":"1.0","method":"getunconfirmedbalance","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getUnconfirmedBalance","params":[],"id":1}`,
unmarshalled: &btcjson.GetUnconfirmedBalanceCmd{
Account: nil,
},
},
{
name: "getunconfirmedbalance optional1",
name: "getUnconfirmedBalance optional1",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getunconfirmedbalance", "acct")
return btcjson.NewCmd("getUnconfirmedBalance", "acct")
},
staticCmd: func() interface{} {
return btcjson.NewGetUnconfirmedBalanceCmd(btcjson.String("acct"))
},
marshalled: `{"jsonrpc":"1.0","method":"getunconfirmedbalance","params":["acct"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getUnconfirmedBalance","params":["acct"],"id":1}`,
unmarshalled: &btcjson.GetUnconfirmedBalanceCmd{
Account: btcjson.String("acct"),
},
},
{
name: "listaddresstransactions",
name: "listAddressTransactions",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("listaddresstransactions", `["1Address"]`)
return btcjson.NewCmd("listAddressTransactions", `["1Address"]`)
},
staticCmd: func() interface{} {
return btcjson.NewListAddressTransactionsCmd([]string{"1Address"}, nil)
},
marshalled: `{"jsonrpc":"1.0","method":"listaddresstransactions","params":[["1Address"]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"listAddressTransactions","params":[["1Address"]],"id":1}`,
unmarshalled: &btcjson.ListAddressTransactionsCmd{
Addresses: []string{"1Address"},
Account: nil,
},
},
{
name: "listaddresstransactions optional1",
name: "listAddressTransactions optional1",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("listaddresstransactions", `["1Address"]`, "acct")
return btcjson.NewCmd("listAddressTransactions", `["1Address"]`, "acct")
},
staticCmd: func() interface{} {
return btcjson.NewListAddressTransactionsCmd([]string{"1Address"},
btcjson.String("acct"))
},
marshalled: `{"jsonrpc":"1.0","method":"listaddresstransactions","params":[["1Address"],"acct"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"listAddressTransactions","params":[["1Address"],"acct"],"id":1}`,
unmarshalled: &btcjson.ListAddressTransactionsCmd{
Addresses: []string{"1Address"},
Account: btcjson.String("acct"),
},
},
{
name: "listalltransactions",
name: "listAllTransactions",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("listalltransactions")
return btcjson.NewCmd("listAllTransactions")
},
staticCmd: func() interface{} {
return btcjson.NewListAllTransactionsCmd(nil)
},
marshalled: `{"jsonrpc":"1.0","method":"listalltransactions","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"listAllTransactions","params":[],"id":1}`,
unmarshalled: &btcjson.ListAllTransactionsCmd{
Account: nil,
},
},
{
name: "listalltransactions optional",
name: "listAllTransactions optional",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("listalltransactions", "acct")
return btcjson.NewCmd("listAllTransactions", "acct")
},
staticCmd: func() interface{} {
return btcjson.NewListAllTransactionsCmd(btcjson.String("acct"))
},
marshalled: `{"jsonrpc":"1.0","method":"listalltransactions","params":["acct"],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"listAllTransactions","params":["acct"],"id":1}`,
unmarshalled: &btcjson.ListAllTransactionsCmd{
Account: btcjson.String("acct"),
},
},
{
name: "recoveraddresses",
name: "recoverAddresses",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("recoveraddresses", "acct", 10)
return btcjson.NewCmd("recoverAddresses", "acct", 10)
},
staticCmd: func() interface{} {
return btcjson.NewRecoverAddressesCmd("acct", 10)
},
marshalled: `{"jsonrpc":"1.0","method":"recoveraddresses","params":["acct",10],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"recoverAddresses","params":["acct",10],"id":1}`,
unmarshalled: &btcjson.RecoverAddressesCmd{
Account: "acct",
N: 10,
},
},
{
name: "walletislocked",
name: "walletIsLocked",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("walletislocked")
return btcjson.NewCmd("walletIsLocked")
},
staticCmd: func() interface{} {
return btcjson.NewWalletIsLockedCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"walletislocked","params":[],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"walletIsLocked","params":[],"id":1}`,
unmarshalled: &btcjson.WalletIsLockedCmd{},
},
}

View File

@ -10,22 +10,22 @@ package btcjson
const (
// AccountBalanceNtfnMethod is the method used for account balance
// notifications.
AccountBalanceNtfnMethod = "accountbalance"
AccountBalanceNtfnMethod = "accountBalance"
// BtcdConnectedNtfnMethod is the method used for notifications when
// a wallet server is connected to a dag server.
BtcdConnectedNtfnMethod = "btcdconnected"
BtcdConnectedNtfnMethod = "btcdConnected"
// WalletLockStateNtfnMethod is the method used to notify the lock state
// of a wallet has changed.
WalletLockStateNtfnMethod = "walletlockstate"
WalletLockStateNtfnMethod = "walletLockState"
// NewTxNtfnMethod is the method used to notify that a wallet server has
// added a new transaction to the transaction store.
NewTxNtfnMethod = "newtx"
NewTxNtfnMethod = "newTx"
)
// AccountBalanceNtfn defines the accountbalance JSON-RPC notification.
// AccountBalanceNtfn defines the accountBalance JSON-RPC notification.
type AccountBalanceNtfn struct {
Account string
Balance float64 // In BTC
@ -33,7 +33,7 @@ type AccountBalanceNtfn struct {
}
// NewAccountBalanceNtfn returns a new instance which can be used to issue an
// accountbalance JSON-RPC notification.
// accountBalance JSON-RPC notification.
func NewAccountBalanceNtfn(account string, balance float64, confirmed bool) *AccountBalanceNtfn {
return &AccountBalanceNtfn{
Account: account,
@ -42,39 +42,39 @@ func NewAccountBalanceNtfn(account string, balance float64, confirmed bool) *Acc
}
}
// BtcdConnectedNtfn defines the btcdconnected JSON-RPC notification.
// BtcdConnectedNtfn defines the btcdConnected JSON-RPC notification.
type BtcdConnectedNtfn struct {
Connected bool
}
// NewBtcdConnectedNtfn returns a new instance which can be used to issue a
// btcdconnected JSON-RPC notification.
// btcdConnected JSON-RPC notification.
func NewBtcdConnectedNtfn(connected bool) *BtcdConnectedNtfn {
return &BtcdConnectedNtfn{
Connected: connected,
}
}
// WalletLockStateNtfn defines the walletlockstate JSON-RPC notification.
// WalletLockStateNtfn defines the walletLockState JSON-RPC notification.
type WalletLockStateNtfn struct {
Locked bool
}
// NewWalletLockStateNtfn returns a new instance which can be used to issue a
// walletlockstate JSON-RPC notification.
// walletLockState JSON-RPC notification.
func NewWalletLockStateNtfn(locked bool) *WalletLockStateNtfn {
return &WalletLockStateNtfn{
Locked: locked,
}
}
// NewTxNtfn defines the newtx JSON-RPC notification.
// NewTxNtfn defines the newTx JSON-RPC notification.
type NewTxNtfn struct {
Account string
Details ListTransactionsResult
}
// NewNewTxNtfn returns a new instance which can be used to issue a newtx
// NewNewTxNtfn returns a new instance which can be used to issue a newTx
// JSON-RPC notification.
func NewNewTxNtfn(account string, details ListTransactionsResult) *NewTxNtfn {
return &NewTxNtfn{

View File

@ -29,14 +29,14 @@ func TestWalletSvrWsNtfns(t *testing.T) {
unmarshalled interface{}
}{
{
name: "accountbalance",
name: "accountBalance",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("accountbalance", "acct", 1.25, true)
return btcjson.NewCmd("accountBalance", "acct", 1.25, true)
},
staticNtfn: func() interface{} {
return btcjson.NewAccountBalanceNtfn("acct", 1.25, true)
},
marshalled: `{"jsonrpc":"1.0","method":"accountbalance","params":["acct",1.25,true],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"accountBalance","params":["acct",1.25,true],"id":null}`,
unmarshalled: &btcjson.AccountBalanceNtfn{
Account: "acct",
Balance: 1.25,
@ -44,35 +44,35 @@ func TestWalletSvrWsNtfns(t *testing.T) {
},
},
{
name: "btcdconnected",
name: "btcdConnected",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("btcdconnected", true)
return btcjson.NewCmd("btcdConnected", true)
},
staticNtfn: func() interface{} {
return btcjson.NewBtcdConnectedNtfn(true)
},
marshalled: `{"jsonrpc":"1.0","method":"btcdconnected","params":[true],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"btcdConnected","params":[true],"id":null}`,
unmarshalled: &btcjson.BtcdConnectedNtfn{
Connected: true,
},
},
{
name: "walletlockstate",
name: "walletLockState",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("walletlockstate", true)
return btcjson.NewCmd("walletLockState", true)
},
staticNtfn: func() interface{} {
return btcjson.NewWalletLockStateNtfn(true)
},
marshalled: `{"jsonrpc":"1.0","method":"walletlockstate","params":[true],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"walletLockState","params":[true],"id":null}`,
unmarshalled: &btcjson.WalletLockStateNtfn{
Locked: true,
},
},
{
name: "newtx",
name: "newTx",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("newtx", "acct", `{"account":"acct","address":"1Address","category":"send","amount":1.5,"bip125-replaceable":"unknown","fee":0.0001,"confirmations":1,"trusted":true,"txid":"456","walletconflicts":[],"time":12345678,"timereceived":12345876,"vout":789,"otheraccount":"otheracct"}`)
return btcjson.NewCmd("newTx", "acct", `{"account":"acct","address":"1Address","category":"send","amount":1.5,"bip125-replaceable":"unknown","fee":0.0001,"confirmations":1,"trusted":true,"txid":"456","walletconflicts":[],"time":12345678,"timereceived":12345876,"vout":789,"otheraccount":"otheracct"}`)
},
staticNtfn: func() interface{} {
result := btcjson.ListTransactionsResult{
@ -94,7 +94,7 @@ func TestWalletSvrWsNtfns(t *testing.T) {
}
return btcjson.NewNewTxNtfn("acct", result)
},
marshalled: `{"jsonrpc":"1.0","method":"newtx","params":["acct",{"abandoned":false,"account":"acct","address":"1Address","amount":1.5,"bip125-replaceable":"unknown","category":"send","confirmations":1,"fee":0.0001,"time":12345678,"timereceived":12345876,"trusted":true,"txid":"456","vout":789,"walletconflicts":[],"otheraccount":"otheracct"}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"newTx","params":["acct",{"abandoned":false,"account":"acct","address":"1Address","amount":1.5,"bip125-replaceable":"unknown","category":"send","confirmations":1,"fee":0.0001,"time":12345678,"timereceived":12345876,"trusted":true,"txid":"456","vout":789,"walletconflicts":[],"otheraccount":"otheracct"}],"id":null}`,
unmarshalled: &btcjson.NewTxNtfn{
Account: "acct",
Details: btcjson.ListTransactionsResult{

View File

@ -70,7 +70,7 @@ const (
uint256Size = 32
// gbtNonceRange is two 64-bit big-endian hexadecimal integers which
// represent the valid ranges of nonces returned by the getblocktemplate
// represent the valid ranges of nonces returned by the getBlockTemplate
// RPC.
gbtNonceRange = "000000000000ffffffffffff"
@ -86,7 +86,7 @@ const (
var (
// gbtMutableFields are the manipulations the server allows to be made
// to block templates generated by the getblocktemplate RPC. It is
// to block templates generated by the getBlockTemplate RPC. It is
// declared here to avoid the overhead of creating the slice on every
// invocation for constant data.
gbtMutableFields = []string{
@ -104,7 +104,7 @@ var (
}
// gbtCapabilities describes additional capabilities returned with a
// block template generated by the getblocktemplate RPC. It is
// block template generated by the getBlockTemplate RPC. It is
// declared here to avoid the overhead of creating the slice on every
// invocation for constant data.
gbtCapabilities = []string{"proposal"}
@ -134,53 +134,53 @@ type commandHandler func(*Server, interface{}, <-chan struct{}) (interface{}, er
// a dependency loop.
var rpcHandlers map[string]commandHandler
var rpcHandlersBeforeInit = map[string]commandHandler{
"addmanualnode": handleAddManualNode,
"createrawtransaction": handleCreateRawTransaction,
"debuglevel": handleDebugLevel,
"decoderawtransaction": handleDecodeRawTransaction,
"decodescript": handleDecodeScript,
"estimatefee": handleEstimateFee,
"addManualNode": handleAddManualNode,
"createRawTransaction": handleCreateRawTransaction,
"debugLevel": handleDebugLevel,
"decodeRawTransaction": handleDecodeRawTransaction,
"decodeScript": handleDecodeScript,
"estimateFee": handleEstimateFee,
"generate": handleGenerate,
"getallmanualnodesinfo": handleGetAllManualNodesInfo,
"getbestblock": handleGetBestBlock,
"getbestblockhash": handleGetBestBlockHash,
"getblock": handleGetBlock,
"getblockdaginfo": handleGetBlockDAGInfo,
"getblockcount": handleGetBlockCount,
"getblockhash": handleGetBlockHash,
"getblockheader": handleGetBlockHeader,
"getblocktemplate": handleGetBlockTemplate,
"getcfilter": handleGetCFilter,
"getcfilterheader": handleGetCFilterHeader,
"getconnectioncount": handleGetConnectionCount,
"getcurrentnet": handleGetCurrentNet,
"getdifficulty": handleGetDifficulty,
"getgenerate": handleGetGenerate,
"gethashespersec": handleGetHashesPerSec,
"getheaders": handleGetHeaders,
"getinfo": handleGetInfo,
"getmanualnodeinfo": handleGetManualNodeInfo,
"getmempoolinfo": handleGetMempoolInfo,
"getmininginfo": handleGetMiningInfo,
"getnettotals": handleGetNetTotals,
"getnetworkhashps": handleGetNetworkHashPS,
"getpeerinfo": handleGetPeerInfo,
"getrawmempool": handleGetRawMempool,
"getrawtransaction": handleGetRawTransaction,
"gettxout": handleGetTxOut,
"getAllManualNodesInfo": handleGetAllManualNodesInfo,
"getBestBlock": handleGetBestBlock,
"getBestBlockHash": handleGetBestBlockHash,
"getBlock": handleGetBlock,
"getBlockDagInfo": handleGetBlockDAGInfo,
"getBlockCount": handleGetBlockCount,
"getBlockHash": handleGetBlockHash,
"getBlockHeader": handleGetBlockHeader,
"getBlockTemplate": handleGetBlockTemplate,
"getCFilter": handleGetCFilter,
"getCFilterHeader": handleGetCFilterHeader,
"getConnectionCount": handleGetConnectionCount,
"getCurrentNet": handleGetCurrentNet,
"getDifficulty": handleGetDifficulty,
"getGenerate": handleGetGenerate,
"getHashesPerSec": handleGetHashesPerSec,
"getHeaders": handleGetHeaders,
"getInfo": handleGetInfo,
"getManualNodeInfo": handleGetManualNodeInfo,
"getMempoolInfo": handleGetMempoolInfo,
"getMiningInfo": handleGetMiningInfo,
"getNetTotals": handleGetNetTotals,
"getNetworkHashPs": handleGetNetworkHashPS,
"getPeerInfo": handleGetPeerInfo,
"getRawMempool": handleGetRawMempool,
"getRawTransaction": handleGetRawTransaction,
"getTxOut": handleGetTxOut,
"help": handleHelp,
"node": handleNode,
"ping": handlePing,
"removemanualnode": handleRemoveManualNode,
"searchrawtransactions": handleSearchRawTransactions,
"sendrawtransaction": handleSendRawTransaction,
"setgenerate": handleSetGenerate,
"removeManualNode": handleRemoveManualNode,
"searchRawTransactions": handleSearchRawTransactions,
"sendRawTransaction": handleSendRawTransaction,
"setGenerate": handleSetGenerate,
"stop": handleStop,
"submitblock": handleSubmitBlock,
"submitBlock": handleSubmitBlock,
"uptime": handleUptime,
"validateaddress": handleValidateAddress,
"verifydag": handleVerifyDAG,
"verifymessage": handleVerifyMessage,
"validateAddress": handleValidateAddress,
"verifyDag": handleVerifyDAG,
"verifyMessage": handleVerifyMessage,
"version": handleVersion,
}
@ -188,104 +188,104 @@ var rpcHandlersBeforeInit = map[string]commandHandler{
// it lacks support for wallet functionality. For these commands the user
// should ask a connected instance of btcwallet.
var rpcAskWallet = map[string]struct{}{
"addmultisigaddress": {},
"backupwallet": {},
"createencryptedwallet": {},
"createmultisig": {},
"dumpprivkey": {},
"dumpwallet": {},
"encryptwallet": {},
"getaccount": {},
"getaccountaddress": {},
"getaddressesbyaccount": {},
"getbalance": {},
"getnewaddress": {},
"getrawchangeaddress": {},
"getreceivedbyaccount": {},
"getreceivedbyaddress": {},
"gettransaction": {},
"gettxoutsetinfo": {},
"getunconfirmedbalance": {},
"getwalletinfo": {},
"importprivkey": {},
"importwallet": {},
"keypoolrefill": {},
"listaccounts": {},
"listaddressgroupings": {},
"listlockunspent": {},
"listreceivedbyaccount": {},
"listreceivedbyaddress": {},
"listsinceblock": {},
"listtransactions": {},
"listunspent": {},
"lockunspent": {},
"addMultisigAddress": {},
"backupWallet": {},
"createEncryptedWallet": {},
"createMultisig": {},
"dumpPrivKey": {},
"dumpWallet": {},
"encryptWallet": {},
"getAccount": {},
"getAccountAddress": {},
"getAddressesByAccount": {},
"getBalance": {},
"getNewAddress": {},
"getRawChangeAddress": {},
"getReceivedByAccount": {},
"getReceivedByAddress": {},
"getTransaction": {},
"getTxOutSetInfo": {},
"getUnconfirmedBalance": {},
"getWalletInfo": {},
"importPrivKey": {},
"importWallet": {},
"keyPoolRefill": {},
"listAccounts": {},
"listAddressGroupings": {},
"listLockUnspent": {},
"listReceivedByAccount": {},
"listReceivedByAddress": {},
"listSinceBlock": {},
"listTransactions": {},
"listUnspent": {},
"lockUnspent": {},
"move": {},
"sendfrom": {},
"sendmany": {},
"sendtoaddress": {},
"setaccount": {},
"settxfee": {},
"signmessage": {},
"signrawtransaction": {},
"walletlock": {},
"walletpassphrase": {},
"walletpassphrasechange": {},
"sendFrom": {},
"sendMany": {},
"sendToAddress": {},
"setAccount": {},
"setTxFee": {},
"signMessage": {},
"signRawTransaction": {},
"walletLock": {},
"walletPassphrase": {},
"walletPassphraseChange": {},
}
// Commands that are currently unimplemented, but should ultimately be.
var rpcUnimplemented = map[string]struct{}{
"estimatepriority": {},
"getchaintips": {},
"getmempoolentry": {},
"getnetworkinfo": {},
"invalidateblock": {},
"preciousblock": {},
"reconsiderblock": {},
"estimatePriority": {},
"getChainTips": {},
"getMempoolEntry": {},
"getNetworkInfo": {},
"invalidateBlock": {},
"preciousBlock": {},
"reconsiderBlock": {},
}
// Commands that are available to a limited user
var rpcLimited = map[string]struct{}{
// Websockets commands
"loadtxfilter": {},
"notifyblocks": {},
"notifynewtransactions": {},
"notifyreceived": {},
"notifyspent": {},
"loadTxFilter": {},
"notifyBlocks": {},
"notifyNewTransactions": {},
"notifyReceived": {},
"notifySpent": {},
"rescan": {},
"rescanblocks": {},
"rescanBlocks": {},
"session": {},
// Websockets AND HTTP/S commands
"help": {},
// HTTP/S-only commands
"createrawtransaction": {},
"decoderawtransaction": {},
"decodescript": {},
"estimatefee": {},
"getbestblock": {},
"getbestblockhash": {},
"getblock": {},
"getblockcount": {},
"getblockhash": {},
"getblockheader": {},
"getcfilter": {},
"getcfilterheader": {},
"getcurrentnet": {},
"getdifficulty": {},
"getheaders": {},
"getinfo": {},
"getnettotals": {},
"getnetworkhashps": {},
"getrawmempool": {},
"getrawtransaction": {},
"gettxout": {},
"searchrawtransactions": {},
"sendrawtransaction": {},
"submitblock": {},
"createRawTransaction": {},
"decodeRawTransaction": {},
"decodeScript": {},
"estimateFee": {},
"getBestBlock": {},
"getBestBlockHash": {},
"getBlock": {},
"getBlockCount": {},
"getBlockHash": {},
"getBlockHeader": {},
"getCFilter": {},
"getCFilterHeader": {},
"getCurrentNet": {},
"getDifficulty": {},
"getHeaders": {},
"getInfo": {},
"getNetTotals": {},
"getNetworkHashPs": {},
"getRawMempool": {},
"getRawTransaction": {},
"getTxOut": {},
"searchRawTransactions": {},
"sendRawTransaction": {},
"submitBlock": {},
"uptime": {},
"validateaddress": {},
"verifymessage": {},
"validateAddress": {},
"verifyMessage": {},
"version": {},
}
@ -333,7 +333,7 @@ func rpcNoTxInfoError(txHash *daghash.Hash) *btcjson.RPCError {
}
// gbtWorkState houses state that is used in between multiple RPC invocations to
// getblocktemplate.
// getBlockTemplate.
type gbtWorkState struct {
sync.Mutex
lastTxUpdate time.Time
@ -367,7 +367,7 @@ func handleAskWallet(s *Server, cmd interface{}, closeChan <-chan struct{}) (int
return nil, ErrRPCNoWallet
}
// handleAddManualNode handles addmanualnode commands.
// handleAddManualNode handles addManualNode commands.
func handleAddManualNode(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.AddManualNodeCmd)
@ -392,7 +392,7 @@ func handleAddManualNode(s *Server, cmd interface{}, closeChan <-chan struct{})
return nil, nil
}
// handleRemoveManualNode handles removemanualnode command.
// handleRemoveManualNode handles removeManualNode command.
func handleRemoveManualNode(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.RemoveManualNodeCmd)
@ -528,7 +528,7 @@ func messageToHex(msg wire.Message) (string, error) {
return hex.EncodeToString(buf.Bytes()), nil
}
// handleCreateRawTransaction handles createrawtransaction commands.
// handleCreateRawTransaction handles createRawTransaction commands.
func handleCreateRawTransaction(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.CreateRawTransactionCmd)
@ -633,7 +633,7 @@ func handleCreateRawTransaction(s *Server, cmd interface{}, closeChan <-chan str
return mtxHex, nil
}
// handleDebugLevel handles debuglevel commands.
// handleDebugLevel handles debugLevel commands.
func handleDebugLevel(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.DebugLevelCmd)
@ -770,7 +770,7 @@ func createTxRawResult(chainParams *dagconfig.Params, mtx *wire.MsgTx,
return txReply, nil
}
// handleDecodeRawTransaction handles decoderawtransaction commands.
// handleDecodeRawTransaction handles decodeRawTransaction commands.
func handleDecodeRawTransaction(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.DecodeRawTransactionCmd)
@ -803,7 +803,7 @@ func handleDecodeRawTransaction(s *Server, cmd interface{}, closeChan <-chan str
return txReply, nil
}
// handleDecodeScript handles decodescript commands.
// handleDecodeScript handles decodeScript commands.
func handleDecodeScript(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.DecodeScriptCmd)
@ -851,7 +851,7 @@ func handleDecodeScript(s *Server, cmd interface{}, closeChan <-chan struct{}) (
return reply, nil
}
// handleEstimateFee handles estimatefee commands.
// handleEstimateFee handles estimateFee commands.
func handleEstimateFee(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.EstimateFeeCmd)
@ -927,7 +927,7 @@ func handleGenerate(s *Server, cmd interface{}, closeChan <-chan struct{}) (inte
return reply, nil
}
// getManualNodesInfo handles getmanualnodeinfo and getallmanualnodesinfo commands.
// getManualNodesInfo handles getManualNodeInfo and getAllManualNodesInfo commands.
func getManualNodesInfo(s *Server, detailsArg *bool, node string) (interface{}, error) {
details := detailsArg == nil || *detailsArg
@ -1017,7 +1017,7 @@ func getManualNodesInfo(s *Server, detailsArg *bool, node string) (interface{},
return results, nil
}
// handleGetManualNodeInfo handles getmanualnodeinfo commands.
// handleGetManualNodeInfo handles getManualNodeInfo commands.
func handleGetManualNodeInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetManualNodeInfoCmd)
results, err := getManualNodesInfo(s, c.Details, c.Node)
@ -1031,13 +1031,13 @@ func handleGetManualNodeInfo(s *Server, cmd interface{}, closeChan <-chan struct
return resultsDetailed[0], nil
}
// handleGetAllManualNodesInfo handles getallmanualnodesinfo commands.
// handleGetAllManualNodesInfo handles getAllManualNodesInfo commands.
func handleGetAllManualNodesInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetAllManualNodesInfoCmd)
return getManualNodesInfo(s, c.Details, "")
}
// handleGetBestBlock implements the getbestblock command.
// handleGetBestBlock implements the getBestBlock command.
func handleGetBestBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
// All other "get block" commands give either the height, the
// hash, or both but require the block SHA. This gets both for
@ -1049,7 +1049,7 @@ func handleGetBestBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (
return result, nil
}
// handleGetBestBlockHash implements the getbestblockhash command.
// handleGetBestBlockHash implements the getBestBlockHash command.
func handleGetBestBlockHash(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return s.cfg.DAG.HighestTipHash().String(), nil
}
@ -1074,7 +1074,7 @@ func getDifficultyRatio(bits uint32, params *dagconfig.Params) float64 {
return diff
}
// handleGetBlock implements the getblock command.
// handleGetBlock implements the getBlock command.
func handleGetBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetBlockCmd)
@ -1193,7 +1193,7 @@ func softForkStatus(state blockdag.ThresholdState) (string, error) {
}
}
// handleGetBlockDAGInfo implements the getblockdaginfo command.
// handleGetBlockDAGInfo implements the getBlockDagInfo command.
func handleGetBlockDAGInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
// Obtain a snapshot of the current best known DAG state. We'll
// populate the response to this call primarily from this snapshot.
@ -1262,19 +1262,19 @@ func handleGetBlockDAGInfo(s *Server, cmd interface{}, closeChan <-chan struct{}
return dagInfo, nil
}
// handleGetBlockCount implements the getblockcount command.
// handleGetBlockCount implements the getBlockCount command.
func handleGetBlockCount(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return s.cfg.DAG.BlockCount(), nil
}
// handleGetBlockHash implements the getblockhash command.
// handleGetBlockHash implements the getBlockHash command.
// This command had been (possibly temporarily) dropped.
// Originally it relied on height, which no longer makes sense.
func handleGetBlockHash(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return nil, ErrRPCUnimplemented
}
// handleGetBlockHeader implements the getblockheader command.
// handleGetBlockHeader implements the getBlockHeader command.
func handleGetBlockHeader(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetBlockHeaderCmd)
@ -2103,7 +2103,7 @@ func handleGetBlockTemplateProposal(s *Server, request *btcjson.TemplateRequest)
return nil, nil
}
// handleGetBlockTemplate implements the getblocktemplate command.
// handleGetBlockTemplate implements the getBlockTemplate command.
//
// See https://en.bitcoin.it/wiki/BIP_0022 and
// https://en.bitcoin.it/wiki/BIP_0023 for more details.
@ -2130,7 +2130,7 @@ func handleGetBlockTemplate(s *Server, cmd interface{}, closeChan <-chan struct{
}
}
// handleGetCFilter implements the getcfilter command.
// handleGetCFilter implements the getCFilter command.
func handleGetCFilter(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
if s.cfg.CfIndex == nil {
return nil, &btcjson.RPCError{
@ -2159,7 +2159,7 @@ func handleGetCFilter(s *Server, cmd interface{}, closeChan <-chan struct{}) (in
return hex.EncodeToString(filterBytes), nil
}
// handleGetCFilterHeader implements the getcfilterheader command.
// handleGetCFilterHeader implements the getCFilterHeader command.
func handleGetCFilterHeader(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
if s.cfg.CfIndex == nil {
return nil, &btcjson.RPCError{
@ -2190,32 +2190,32 @@ func handleGetCFilterHeader(s *Server, cmd interface{}, closeChan <-chan struct{
return hash.String(), nil
}
// handleGetConnectionCount implements the getconnectioncount command.
// handleGetConnectionCount implements the getConnectionCount command.
func handleGetConnectionCount(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return s.cfg.ConnMgr.ConnectedCount(), nil
}
// handleGetCurrentNet implements the getcurrentnet command.
// handleGetCurrentNet implements the getCurrentNet command.
func handleGetCurrentNet(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return s.cfg.DAGParams.Net, nil
}
// handleGetDifficulty implements the getdifficulty command.
// handleGetDifficulty implements the getDifficulty command.
func handleGetDifficulty(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return getDifficultyRatio(s.cfg.DAG.SelectedTip().Header().Bits, s.cfg.DAGParams), nil
}
// handleGetGenerate implements the getgenerate command.
// handleGetGenerate implements the getGenerate command.
func handleGetGenerate(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return s.cfg.CPUMiner.IsMining(), nil
}
// handleGetHashesPerSec implements the gethashespersec command.
// handleGetHashesPerSec implements the getHashesPerSec command.
func handleGetHashesPerSec(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return int64(s.cfg.CPUMiner.HashesPerSecond()), nil
}
// handleGetHeaders implements the getheaders command.
// handleGetHeaders implements the getHeaders command.
//
// NOTE: This is a btcsuite extension originally ported from
// github.com/decred/dcrd.
@ -2256,7 +2256,7 @@ func handleGetHeaders(s *Server, cmd interface{}, closeChan <-chan struct{}) (in
return hexBlockHeaders, nil
}
// handleGetInfo implements the getinfo command. We only return the fields
// handleGetInfo implements the getInfo command. We only return the fields
// that are not related to wallet functionality.
func handleGetInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
ret := &btcjson.InfoDAGResult{
@ -2274,7 +2274,7 @@ func handleGetInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (inter
return ret, nil
}
// handleGetMempoolInfo implements the getmempoolinfo command.
// handleGetMempoolInfo implements the getMempoolInfo command.
func handleGetMempoolInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
mempoolTxns := s.cfg.TxMemPool.TxDescs()
@ -2291,11 +2291,11 @@ func handleGetMempoolInfo(s *Server, cmd interface{}, closeChan <-chan struct{})
return ret, nil
}
// handleGetMiningInfo implements the getmininginfo command. We only return the
// handleGetMiningInfo implements the getMiningInfo command. We only return the
// fields that are not related to wallet functionality.
func handleGetMiningInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
// Create a default getnetworkhashps command to use defaults and make
// use of the existing getnetworkhashps handler.
// Create a default getNetworkHashPs command to use defaults and make
// use of the existing getNetworkHashPs handler.
gnhpsCmd := btcjson.NewGetNetworkHashPSCmd(nil, nil)
networkHashesPerSecIface, err := handleGetNetworkHashPS(s, gnhpsCmd,
closeChan)
@ -2334,7 +2334,7 @@ func handleGetMiningInfo(s *Server, cmd interface{}, closeChan <-chan struct{})
return &result, nil
}
// handleGetNetTotals implements the getnettotals command.
// handleGetNetTotals implements the getNetTotals command.
func handleGetNetTotals(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
totalBytesRecv, totalBytesSent := s.cfg.ConnMgr.NetTotals()
reply := &btcjson.GetNetTotalsResult{
@ -2345,14 +2345,14 @@ func handleGetNetTotals(s *Server, cmd interface{}, closeChan <-chan struct{}) (
return reply, nil
}
// handleGetNetworkHashPS implements the getnetworkhashps command.
// handleGetNetworkHashPS implements the getNetworkHashPs command.
// This command had been (possibly temporarily) dropped.
// Originally it relied on height, which no longer makes sense.
func handleGetNetworkHashPS(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return nil, ErrRPCUnimplemented
}
// handleGetPeerInfo implements the getpeerinfo command.
// handleGetPeerInfo implements the getPeerInfo command.
func handleGetPeerInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
peers := s.cfg.ConnMgr.ConnectedPeers()
syncPeerID := s.cfg.SyncMgr.SyncPeerID()
@ -2391,7 +2391,7 @@ func handleGetPeerInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (i
return infos, nil
}
// handleGetRawMempool implements the getrawmempool command.
// handleGetRawMempool implements the getRawMempool command.
func handleGetRawMempool(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetRawMempoolCmd)
mp := s.cfg.TxMemPool
@ -2411,7 +2411,7 @@ func handleGetRawMempool(s *Server, cmd interface{}, closeChan <-chan struct{})
return hashStrings, nil
}
// handleGetRawTransaction implements the getrawtransaction command.
// handleGetRawTransaction implements the getRawTransaction command.
func handleGetRawTransaction(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetRawTransactionCmd)
@ -2530,7 +2530,7 @@ func handleGetRawTransaction(s *Server, cmd interface{}, closeChan <-chan struct
return *rawTxn, nil
}
// handleGetTxOut handles gettxout commands.
// handleGetTxOut handles getTxOut commands.
func handleGetTxOut(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetTxOutCmd)
@ -2903,7 +2903,7 @@ func fetchMempoolTxnsForAddress(s *Server, addr util.Address, numToSkip, numRequ
return mpTxns[numToSkip:rangeEnd], numToSkip
}
// handleSearchRawTransactions implements the searchrawtransactions command.
// handleSearchRawTransactions implements the searchRawTransactions command.
func handleSearchRawTransactions(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
// Respond with an error if the address index is not enabled.
addrIndex := s.cfg.AddrIndex
@ -3166,7 +3166,7 @@ func handleSearchRawTransactions(s *Server, cmd interface{}, closeChan <-chan st
return srtList, nil
}
// handleSendRawTransaction implements the sendrawtransaction command.
// handleSendRawTransaction implements the sendRawTransaction command.
func handleSendRawTransaction(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.SendRawTransactionCmd)
// Deserialize and send off to tx relay
@ -3233,11 +3233,11 @@ func handleSendRawTransaction(s *Server, cmd interface{}, closeChan <-chan struc
// accepted.
s.cfg.ConnMgr.RelayTransactions(acceptedTxs)
// Notify both websocket and getblocktemplate long poll clients of all
// Notify both websocket and getBlockTemplate long poll clients of all
// newly accepted transactions.
s.NotifyNewTransactions(acceptedTxs)
// Keep track of all the sendrawtransaction request txns so that they
// Keep track of all the sendRawTransaction request txns so that they
// can be rebroadcast if they don't make their way into a block.
txD := acceptedTxs[0]
iv := wire.NewInvVect(wire.InvTypeTx, txD.Tx.Hash())
@ -3246,7 +3246,7 @@ func handleSendRawTransaction(s *Server, cmd interface{}, closeChan <-chan struc
return tx.Hash().String(), nil
}
// handleSetGenerate implements the setgenerate command.
// handleSetGenerate implements the setGenerate command.
func handleSetGenerate(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.SetGenerateCmd)
@ -3291,7 +3291,7 @@ func handleStop(s *Server, cmd interface{}, closeChan <-chan struct{}) (interfac
return "btcd stopping.", nil
}
// handleSubmitBlock implements the submitblock command.
// handleSubmitBlock implements the submitBlock command.
func handleSubmitBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.SubmitBlockCmd)
@ -3320,7 +3320,7 @@ func handleSubmitBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (i
return fmt.Sprintf("rejected: %s", err.Error()), nil
}
log.Infof("Accepted block %s via submitblock", block.Hash())
log.Infof("Accepted block %s via submitBlock", block.Hash())
return nil, nil
}
@ -3329,7 +3329,7 @@ func handleUptime(s *Server, cmd interface{}, closeChan <-chan struct{}) (interf
return time.Now().Unix() - s.cfg.StartupTime, nil
}
// handleValidateAddress implements the validateaddress command.
// handleValidateAddress implements the validateAddress command.
func handleValidateAddress(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.ValidateAddressCmd)
@ -3383,7 +3383,7 @@ func verifyDAG(s *Server, level, depth int32) error {
return nil
}
// handleVerifyDAG implements the verifydag command.
// handleVerifyDAG implements the verifyDag command.
func handleVerifyDAG(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.VerifyDAGCmd)
@ -3399,7 +3399,7 @@ func handleVerifyDAG(s *Server, cmd interface{}, closeChan <-chan struct{}) (int
return err == nil, nil
}
// handleVerifyMessage implements the verifymessage command.
// handleVerifyMessage implements the verifyMessage command.
func handleVerifyMessage(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.VerifyMessageCmd)
@ -3579,7 +3579,7 @@ func (s *Server) RequestedProcessShutdown() <-chan struct{} {
return s.requestProcessShutdown
}
// NotifyNewTransactions notifies both websocket and getblocktemplate long
// NotifyNewTransactions notifies both websocket and getBlockTemplate long
// poll clients of the passed transactions. This function should be called
// whenever new transactions are added to the mempool.
func (s *Server) NotifyNewTransactions(txns []*mempool.TxDesc) {
@ -3587,7 +3587,7 @@ func (s *Server) NotifyNewTransactions(txns []*mempool.TxDesc) {
// Notify websocket clients about mempool transactions.
s.ntfnMgr.NotifyMempoolTx(txD.Tx, true)
// Potentially notify any getblocktemplate long poll clients
// Potentially notify any getBlockTemplate long poll clients
// about stale block templates due to the new transaction.
s.gbtWorkState.NotifyMempoolTx(s.cfg.TxMemPool.LastUpdated())
}
@ -4240,7 +4240,7 @@ func (s *Server) handleBlockchainNotification(notification *blockdag.Notificatio
tipHashes := s.cfg.DAG.TipHashes()
// Allow any clients performing long polling via the
// getblocktemplate RPC to be notified when the new block causes
// getBlockTemplate RPC to be notified when the new block causes
// their old block template to become stale.
s.gbtWorkState.NotifyBlockConnected(tipHashes)

View File

@ -17,22 +17,22 @@ import (
// helpDescsEnUS defines the English descriptions used for the help strings.
var helpDescsEnUS = map[string]string{
// DebugLevelCmd help.
"debuglevel--synopsis": "Dynamically changes the debug logging level.\n" +
"debugLevel--synopsis": "Dynamically changes the debug logging level.\n" +
"The levelspec can either a debug level or of the form:\n" +
"<subsystem>=<level>,<subsystem2>=<level2>,...\n" +
"The valid debug levels are trace, debug, info, warn, error, and critical.\n" +
"The valid subsystems are AMGR, ADXR, BCDB, BMGR, BTCD, CHAN, DISC, PEER, RPCS, SCRP, SRVR, and TXMP.\n" +
"Finally the keyword 'show' will return a list of the available subsystems.",
"debuglevel-levelspec": "The debug level(s) to use or the keyword 'show'",
"debuglevel--condition0": "levelspec!=show",
"debuglevel--condition1": "levelspec=show",
"debuglevel--result0": "The string 'Done.'",
"debuglevel--result1": "The list of subsystems",
"debugLevel-levelspec": "The debug level(s) to use or the keyword 'show'",
"debugLevel--condition0": "levelspec!=show",
"debugLevel--condition1": "levelspec=show",
"debugLevel--result0": "The string 'Done.'",
"debugLevel--result1": "The list of subsystems",
// AddManualNodeCmd help.
"addmanualnode--synopsis": "Attempts to add or remove a persistent peer.",
"addmanualnode-addr": "IP address and port of the peer to operate on",
"addmanualnode-onetry": "When enabled, will try a single connection to a peer",
"addManualNode--synopsis": "Attempts to add or remove a persistent peer.",
"addManualNode-addr": "IP address and port of the peer to operate on",
"addManualNode-onetry": "When enabled, will try a single connection to a peer",
// NodeCmd help.
"node--synopsis": "Attempts to add or remove a peer.",
@ -45,16 +45,16 @@ var helpDescsEnUS = map[string]string{
"transactioninput-vout": "The specific output of the input transaction to redeem",
// CreateRawTransactionCmd help.
"createrawtransaction--synopsis": "Returns a new transaction spending the provided inputs and sending to the provided addresses.\n" +
"createRawTransaction--synopsis": "Returns a new transaction spending the provided inputs and sending to the provided addresses.\n" +
"The transaction inputs are not signed in the created transaction.\n" +
"The signrawtransaction RPC command provided by wallet must be used to sign the resulting transaction.",
"createrawtransaction-inputs": "The inputs to the transaction",
"createrawtransaction-amounts": "JSON object with the destination addresses as keys and amounts as values",
"createrawtransaction-amounts--key": "address",
"createrawtransaction-amounts--value": "n.nnn",
"createrawtransaction-amounts--desc": "The destination address as the key and the amount in BTC as the value",
"createrawtransaction-locktime": "Locktime value; a non-zero value will also locktime-activate the inputs",
"createrawtransaction--result0": "Hex-encoded bytes of the serialized transaction",
"createRawTransaction-inputs": "The inputs to the transaction",
"createRawTransaction-amounts": "JSON object with the destination addresses as keys and amounts as values",
"createRawTransaction-amounts--key": "address",
"createRawTransaction-amounts--value": "n.nnn",
"createRawTransaction-amounts--desc": "The destination address as the key and the amount in BTC as the value",
"createRawTransaction-locktime": "Locktime value; a non-zero value will also locktime-activate the inputs",
"createRawTransaction--result0": "Hex-encoded bytes of the serialized transaction",
// ScriptSig help.
"scriptsig-asm": "Disassembly of the script",
@ -99,8 +99,8 @@ var helpDescsEnUS = map[string]string{
"txrawdecoderesult-vout": "The transaction outputs as JSON objects",
// DecodeRawTransactionCmd help.
"decoderawtransaction--synopsis": "Returns a JSON object representing the provided serialized, hex-encoded transaction.",
"decoderawtransaction-hextx": "Serialized, hex-encoded transaction",
"decodeRawTransaction--synopsis": "Returns a JSON object representing the provided serialized, hex-encoded transaction.",
"decodeRawTransaction-hextx": "Serialized, hex-encoded transaction",
// DecodeScriptResult help.
"decodescriptresult-asm": "Disassembly of the script",
@ -110,16 +110,16 @@ var helpDescsEnUS = map[string]string{
"decodescriptresult-p2sh": "The script hash for use in pay-to-script-hash transactions (only present if the provided redeem script is not already a pay-to-script-hash script)",
// DecodeScriptCmd help.
"decodescript--synopsis": "Returns a JSON object with information about the provided hex-encoded script.",
"decodescript-hexscript": "Hex-encoded script",
"decodeScript--synopsis": "Returns a JSON object with information about the provided hex-encoded script.",
"decodeScript-hexscript": "Hex-encoded script",
// EstimateFeeCmd help.
"estimatefee--synopsis": "Estimate the fee per kilobyte in satoshis " +
"estimateFee--synopsis": "Estimate the fee per kilobyte in satoshis " +
"required for a transaction to be mined before a certain number of " +
"blocks have been generated.",
"estimatefee-numblocks": "The maximum number of blocks which can be " +
"estimateFee-numblocks": "The maximum number of blocks which can be " +
"generated before the transaction is mined.",
"estimatefee--result0": "Estimated fee per kilobyte in satoshis for a block to " +
"estimateFee--result0": "Estimated fee per kilobyte in satoshis for a block to " +
"be mined in the next NumBlocks blocks.",
// GenerateCmd help
@ -128,12 +128,12 @@ var helpDescsEnUS = map[string]string{
"generate-numblocks": "Number of blocks to generate",
"generate--result0": "The hashes, in order, of blocks generated by the call",
// GetAllManualNodesInfo help.
"getallmanualnodesinfo--synopsis": "Returns information about manually added (persistent) peers.",
"getallmanualnodesinfo-details": "Specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers",
"getallmanualnodesinfo--condition0": "details=false",
"getallmanualnodesinfo--condition1": "details=true",
"getallmanualnodesinfo--result0": "List of added peers",
// GetAllManualNodesInfoCmd help.
"getAllManualNodesInfo--synopsis": "Returns information about manually added (persistent) peers.",
"getAllManualNodesInfo-details": "Specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers",
"getAllManualNodesInfo--condition0": "details=false",
"getAllManualNodesInfo--condition1": "details=true",
"getAllManualNodesInfo--result0": "List of added peers",
// GetManualNodeInfoResultAddr help.
"getmanualnodeinforesultaddr-address": "The ip address for this DNS entry",
@ -144,37 +144,37 @@ var helpDescsEnUS = map[string]string{
"getmanualnodeinforesult-connected": "Whether or not the peer is currently connected",
"getmanualnodeinforesult-addresses": "DNS lookup and connection information about the peer",
// GetManualNodeInfo help.
"getmanualnodeinfo--synopsis": "Returns information about manually added (persistent) peers.",
"getmanualnodeinfo-details": "Specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers",
"getmanualnodeinfo-node": "Only return information about this specific peer instead of all added peers",
"getmanualnodeinfo--condition0": "details=false",
"getmanualnodeinfo--condition1": "details=true",
"getmanualnodeinfo--result0": "List of added peers",
// GetManualNodeInfoCmd help.
"getManualNodeInfo--synopsis": "Returns information about manually added (persistent) peers.",
"getManualNodeInfo-details": "Specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers",
"getManualNodeInfo-node": "Only return information about this specific peer instead of all added peers",
"getManualNodeInfo--condition0": "details=false",
"getManualNodeInfo--condition1": "details=true",
"getManualNodeInfo--result0": "List of added peers",
// GetBestBlockResult help.
"getbestblockresult-hash": "Hex-encoded bytes of the best block hash",
"getbestblockresult-height": "Height of the best block",
// GetBestBlockCmd help.
"getbestblock--synopsis": "Get block height and hash of best block in the main chain.",
"getbestblock--result0": "Get block height and hash of best block in the main chain.",
"getBestBlock--synopsis": "Get block height and hash of best block in the main chain.",
"getBestBlock--result0": "Get block height and hash of best block in the main chain.",
// GetBestBlockHashCmd help.
"getbestblockhash--synopsis": "Returns the hash of the of the best (most recent) block in the longest block chain.",
"getbestblockhash--result0": "The hex-encoded block hash",
"getBestBlockHash--synopsis": "Returns the hash of the of the best (most recent) block in the longest block chain.",
"getBestBlockHash--result0": "The hex-encoded block hash",
// GetBlockCmd help.
"getblock--synopsis": "Returns information about a block given its hash.",
"getblock-hash": "The hash of the block",
"getblock-verbose": "Specifies the block is returned as a JSON object instead of hex-encoded string",
"getblock-verbosetx": "Specifies that each transaction is returned as a JSON object and only applies if the verbose flag is true (btcd extension)",
"getblock--condition0": "verbose=false",
"getblock--condition1": "verbose=true",
"getblock--result0": "Hex-encoded bytes of the serialized block",
"getBlock--synopsis": "Returns information about a block given its hash.",
"getBlock-hash": "The hash of the block",
"getBlock-verbose": "Specifies the block is returned as a JSON object instead of hex-encoded string",
"getBlock-verbosetx": "Specifies that each transaction is returned as a JSON object and only applies if the verbose flag is true (btcd extension)",
"getBlock--condition0": "verbose=false",
"getBlock--condition1": "verbose=true",
"getBlock--result0": "Hex-encoded bytes of the serialized block",
// GetBlockChainInfoCmd help.
"getblockdaginfo--synopsis": "Returns information about the current blockDAG state and the status of any active soft-fork deployments.",
"getBlockDagInfo--synopsis": "Returns information about the current blockDAG state and the status of any active soft-fork deployments.",
// GetBlockDAGInfoResult help.
"getblockdaginforesult-dag": "The name of the DAG the daemon is on (testnet, mainnet, etc)",
@ -245,21 +245,21 @@ var helpDescsEnUS = map[string]string{
"getblockverboseresult-nextblockhashes": "The hashes of the next blocks (only if there are any)",
// GetBlockCountCmd help.
"getblockcount--synopsis": "Returns the number of blocks in the longest block chain.",
"getblockcount--result0": "The current block count",
"getBlockCount--synopsis": "Returns the number of blocks in the longest block chain.",
"getBlockCount--result0": "The current block count",
// GetBlockHashCmd help.
"getblockhash--synopsis": "Returns hash of the block in best block chain at the given height.",
"getblockhash-index": "The block height",
"getblockhash--result0": "The block hash",
"getBlockHash--synopsis": "Returns hash of the block in best block chain at the given height.",
"getBlockHash-index": "The block height",
"getBlockHash--result0": "The block hash",
// GetBlockHeaderCmd help.
"getblockheader--synopsis": "Returns information about a block header given its hash.",
"getblockheader-hash": "The hash of the block",
"getblockheader-verbose": "Specifies the block header is returned as a JSON object instead of hex-encoded string",
"getblockheader--condition0": "verbose=false",
"getblockheader--condition1": "verbose=true",
"getblockheader--result0": "The block header hash",
"getBlockHeader--synopsis": "Returns information about a block header given its hash.",
"getBlockHeader-hash": "The hash of the block",
"getBlockHeader-verbose": "Specifies the block header is returned as a JSON object instead of hex-encoded string",
"getBlockHeader--condition0": "verbose=false",
"getBlockHeader--condition1": "verbose=true",
"getBlockHeader--result0": "The block header hash",
// GetBlockHeaderVerboseResult help.
"getblockheaderverboseresult-hash": "The hash of the block (same as provided)",
@ -322,45 +322,45 @@ var helpDescsEnUS = map[string]string{
"getblocktemplateresult-reject-reason": "Reason the proposal was invalid as-is (only applies to proposal responses)",
// GetBlockTemplateCmd help.
"getblocktemplate--synopsis": "Returns a JSON object with information necessary to construct a block to mine or accepts a proposal to validate.\n" +
"getBlockTemplate--synopsis": "Returns a JSON object with information necessary to construct a block to mine or accepts a proposal to validate.\n" +
"See BIP0022 and BIP0023 for the full specification.",
"getblocktemplate-request": "Request object which controls the mode and several parameters",
"getblocktemplate--condition0": "mode=template",
"getblocktemplate--condition1": "mode=proposal, rejected",
"getblocktemplate--condition2": "mode=proposal, accepted",
"getblocktemplate--result1": "An error string which represents why the proposal was rejected or nothing if accepted",
"getBlockTemplate-request": "Request object which controls the mode and several parameters",
"getBlockTemplate--condition0": "mode=template",
"getBlockTemplate--condition1": "mode=proposal, rejected",
"getBlockTemplate--condition2": "mode=proposal, accepted",
"getBlockTemplate--result1": "An error string which represents why the proposal was rejected or nothing if accepted",
// GetCFilterCmd help.
"getcfilter--synopsis": "Returns a block's committed filter given its hash.",
"getcfilter-filtertype": "The type of filter to return (0=regular, 1=extended)",
"getcfilter-hash": "The hash of the block",
"getcfilter--result0": "The block's committed filter",
"getCFilter--synopsis": "Returns a block's committed filter given its hash.",
"getCFilter-filtertype": "The type of filter to return (0=regular, 1=extended)",
"getCFilter-hash": "The hash of the block",
"getCFilter--result0": "The block's committed filter",
// GetCFilterHeaderCmd help.
"getcfilterheader--synopsis": "Returns a block's compact filter header given its hash.",
"getcfilterheader-filtertype": "The type of filter header to return (0=regular, 1=extended)",
"getcfilterheader-hash": "The hash of the block",
"getcfilterheader--result0": "The block's gcs filter header",
"getCFilterHeader--synopsis": "Returns a block's compact filter header given its hash.",
"getCFilterHeader-filtertype": "The type of filter header to return (0=regular, 1=extended)",
"getCFilterHeader-hash": "The hash of the block",
"getCFilterHeader--result0": "The block's gcs filter header",
// GetConnectionCountCmd help.
"getconnectioncount--synopsis": "Returns the number of active connections to other peers.",
"getconnectioncount--result0": "The number of connections",
"getConnectionCount--synopsis": "Returns the number of active connections to other peers.",
"getConnectionCount--result0": "The number of connections",
// GetCurrentNetCmd help.
"getcurrentnet--synopsis": "Get bitcoin network the server is running on.",
"getcurrentnet--result0": "The network identifer",
"getCurrentNet--synopsis": "Get bitcoin network the server is running on.",
"getCurrentNet--result0": "The network identifer",
// GetDifficultyCmd help.
"getdifficulty--synopsis": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.",
"getdifficulty--result0": "The difficulty",
"getDifficulty--synopsis": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.",
"getDifficulty--result0": "The difficulty",
// GetGenerateCmd help.
"getgenerate--synopsis": "Returns if the server is set to generate coins (mine) or not.",
"getgenerate--result0": "True if mining, false if not",
"getGenerate--synopsis": "Returns if the server is set to generate coins (mine) or not.",
"getGenerate--result0": "True if mining, false if not",
// GetHashesPerSecCmd help.
"gethashespersec--synopsis": "Returns a recent hashes per second performance measurement while generating coins (mining).",
"gethashespersec--result0": "The number of hashes per second",
"getHashesPerSec--synopsis": "Returns a recent hashes per second performance measurement while generating coins (mining).",
"getHashesPerSec--result0": "The number of hashes per second",
// InfoDAGResult help.
"infodagresult-version": "The version of the server",
@ -393,16 +393,16 @@ var helpDescsEnUS = map[string]string{
"infowalletresult-errors": "Any current errors",
// GetHeadersCmd help.
"getheaders--synopsis": "Returns block headers starting with the first known block hash from the request",
"getheaders-blocklocators": "JSON array of hex-encoded hashes of blocks. Headers are returned starting from the first known hash in this list",
"getheaders-hashstop": "Block hash to stop including block headers for; if not found, all headers to the latest known block are returned.",
"getheaders--result0": "Serialized block headers of all located blocks, limited to some arbitrary maximum number of hashes (currently 2000, which matches the wire protocol headers message, but this is not guaranteed)",
"getHeaders--synopsis": "Returns block headers starting with the first known block hash from the request",
"getHeaders-blocklocators": "JSON array of hex-encoded hashes of blocks. Headers are returned starting from the first known hash in this list",
"getHeaders-hashstop": "Block hash to stop including block headers for; if not found, all headers to the latest known block are returned.",
"getHeaders--result0": "Serialized block headers of all located blocks, limited to some arbitrary maximum number of hashes (currently 2000, which matches the wire protocol headers message, but this is not guaranteed)",
// GetInfoCmd help.
"getinfo--synopsis": "Returns a JSON object containing various state info.",
"getInfo--synopsis": "Returns a JSON object containing various state info.",
// GetMempoolInfoCmd help.
"getmempoolinfo--synopsis": "Returns memory pool information",
"getMempoolInfo--synopsis": "Returns memory pool information",
// GetMempoolInfoResult help.
"getmempoolinforesult-bytes": "Size in bytes of the mempool",
@ -422,16 +422,16 @@ var helpDescsEnUS = map[string]string{
"getmininginforesult-testnet": "Whether or not server is using testnet",
// GetMiningInfoCmd help.
"getmininginfo--synopsis": "Returns a JSON object containing mining-related information.",
"getMiningInfo--synopsis": "Returns a JSON object containing mining-related information.",
// GetNetworkHashPSCmd help.
"getnetworkhashps--synopsis": "Returns the estimated network hashes per second for the block heights provided by the parameters.",
"getnetworkhashps-blocks": "The number of blocks, or -1 for blocks since last difficulty change",
"getnetworkhashps-height": "Perform estimate ending with this height or -1 for current best chain block height",
"getnetworkhashps--result0": "Estimated hashes per second",
"getNetworkHashPs--synopsis": "Returns the estimated network hashes per second for the block heights provided by the parameters.",
"getNetworkHashPs-blocks": "The number of blocks, or -1 for blocks since last difficulty change",
"getNetworkHashPs-height": "Perform estimate ending with this height or -1 for current best chain block height",
"getNetworkHashPs--result0": "Estimated hashes per second",
// GetNetTotalsCmd help.
"getnettotals--synopsis": "Returns a JSON object containing network traffic statistics.",
"getNetTotals--synopsis": "Returns a JSON object containing network traffic statistics.",
// GetNetTotalsResult help.
"getnettotalsresult-totalbytesrecv": "Total bytes received",
@ -462,7 +462,7 @@ var helpDescsEnUS = map[string]string{
"getpeerinforesult-syncnode": "Whether or not the peer is the sync peer",
// GetPeerInfoCmd help.
"getpeerinfo--synopsis": "Returns data about each connected network peer as an array of json objects.",
"getPeerInfo--synopsis": "Returns data about each connected network peer as an array of json objects.",
// GetRawMempoolVerboseResult help.
"getrawmempoolverboseresult-size": "Transaction size in bytes",
@ -474,19 +474,19 @@ var helpDescsEnUS = map[string]string{
"getrawmempoolverboseresult-depends": "Unconfirmed transactions used as inputs for this transaction",
// GetRawMempoolCmd help.
"getrawmempool--synopsis": "Returns information about all of the transactions currently in the memory pool.",
"getrawmempool-verbose": "Returns JSON object when true or an array of transaction hashes when false",
"getrawmempool--condition0": "verbose=false",
"getrawmempool--condition1": "verbose=true",
"getrawmempool--result0": "Array of transaction hashes",
"getRawMempool--synopsis": "Returns information about all of the transactions currently in the memory pool.",
"getRawMempool-verbose": "Returns JSON object when true or an array of transaction hashes when false",
"getRawMempool--condition0": "verbose=false",
"getRawMempool--condition1": "verbose=true",
"getRawMempool--result0": "Array of transaction hashes",
// GetRawTransactionCmd help.
"getrawtransaction--synopsis": "Returns information about a transaction given its hash.",
"getrawtransaction-txid": "The hash of the transaction",
"getrawtransaction-verbose": "Specifies the transaction is returned as a JSON object instead of a hex-encoded string",
"getrawtransaction--condition0": "verbose=false",
"getrawtransaction--condition1": "verbose=true",
"getrawtransaction--result0": "Hex-encoded bytes of the serialized transaction",
"getRawTransaction--synopsis": "Returns information about a transaction given its hash.",
"getRawTransaction-txid": "The hash of the transaction",
"getRawTransaction-verbose": "Specifies the transaction is returned as a JSON object instead of a hex-encoded string",
"getRawTransaction--condition0": "verbose=false",
"getRawTransaction--condition1": "verbose=true",
"getRawTransaction--result0": "Hex-encoded bytes of the serialized transaction",
// GetTxOutResult help.
"gettxoutresult-bestblock": "The block hash that contains the transaction output",
@ -497,10 +497,10 @@ var helpDescsEnUS = map[string]string{
"gettxoutresult-coinbase": "Whether or not the transaction is a coinbase",
// GetTxOutCmd help.
"gettxout--synopsis": "Returns information about an unspent transaction output..",
"gettxout-txid": "The hash of the transaction",
"gettxout-vout": "The index of the output",
"gettxout-includemempool": "Include the mempool when true",
"getTxOut--synopsis": "Returns information about an unspent transaction output..",
"getTxOut-txid": "The hash of the transaction",
"getTxOut-vout": "The index of the output",
"getTxOut-includemempool": "Include the mempool when true",
// HelpCmd help.
"help--synopsis": "Returns a list of all commands or help for a specified command.",
@ -512,39 +512,39 @@ var helpDescsEnUS = map[string]string{
// PingCmd help.
"ping--synopsis": "Queues a ping to be sent to each connected peer.\n" +
"Ping times are provided by getpeerinfo via the pingtime and pingwait fields.",
"Ping times are provided by getPeerInfo via the pingtime and pingwait fields.",
// RemoveManualNodeCmd help.
"removemanualnode--synopsis": "Removes a peer from the manual nodes list",
"removemanualnode-addr": "IP address and port of the peer to remove",
"removeManualNode--synopsis": "Removes a peer from the manual nodes list",
"removeManualNode-addr": "IP address and port of the peer to remove",
// SearchRawTransactionsCmd help.
"searchrawtransactions--synopsis": "Returns raw data for transactions involving the passed address.\n" +
"searchRawTransactions--synopsis": "Returns raw data for transactions involving the passed address.\n" +
"Returned transactions are pulled from both the database, and transactions currently in the mempool.\n" +
"Transactions pulled from the mempool will have the 'confirmations' field set to 0.\n" +
"Usage of this RPC requires the optional --addrindex flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built.\n" +
"Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data.",
"searchrawtransactions-address": "The Bitcoin address to search for",
"searchrawtransactions-verbose": "Specifies the transaction is returned as a JSON object instead of hex-encoded string",
"searchrawtransactions--condition0": "verbose=0",
"searchrawtransactions--condition1": "verbose=1",
"searchrawtransactions-skip": "The number of leading transactions to leave out of the final response",
"searchrawtransactions-count": "The maximum number of transactions to return",
"searchrawtransactions-vinextra": "Specify that extra data from previous output will be returned in vin",
"searchrawtransactions-reverse": "Specifies that the transactions should be returned in reverse chronological order",
"searchrawtransactions-filteraddrs": "Address list. Only inputs or outputs with matching address will be returned",
"searchrawtransactions--result0": "Hex-encoded serialized transaction",
"searchRawTransactions-address": "The Bitcoin address to search for",
"searchRawTransactions-verbose": "Specifies the transaction is returned as a JSON object instead of hex-encoded string",
"searchRawTransactions--condition0": "verbose=0",
"searchRawTransactions--condition1": "verbose=1",
"searchRawTransactions-skip": "The number of leading transactions to leave out of the final response",
"searchRawTransactions-count": "The maximum number of transactions to return",
"searchRawTransactions-vinextra": "Specify that extra data from previous output will be returned in vin",
"searchRawTransactions-reverse": "Specifies that the transactions should be returned in reverse chronological order",
"searchRawTransactions-filteraddrs": "Address list. Only inputs or outputs with matching address will be returned",
"searchRawTransactions--result0": "Hex-encoded serialized transaction",
// SendRawTransactionCmd help.
"sendrawtransaction--synopsis": "Submits the serialized, hex-encoded transaction to the local peer and relays it to the network.",
"sendrawtransaction-hextx": "Serialized, hex-encoded signed transaction",
"sendrawtransaction-allowhighfees": "Whether or not to allow insanely high fees (btcd does not yet implement this parameter, so it has no effect)",
"sendrawtransaction--result0": "The hash of the transaction",
"sendRawTransaction--synopsis": "Submits the serialized, hex-encoded transaction to the local peer and relays it to the network.",
"sendRawTransaction-hextx": "Serialized, hex-encoded signed transaction",
"sendRawTransaction-allowhighfees": "Whether or not to allow insanely high fees (btcd does not yet implement this parameter, so it has no effect)",
"sendRawTransaction--result0": "The hash of the transaction",
// SetGenerateCmd help.
"setgenerate--synopsis": "Set the server to generate coins (mine) or not.",
"setgenerate-generate": "Use true to enable generation, false to disable it",
"setgenerate-genproclimit": "The number of processors (cores) to limit generation to or -1 for default",
"setGenerate--synopsis": "Set the server to generate coins (mine) or not.",
"setGenerate-generate": "Use true to enable generation, false to disable it",
"setGenerate-genproclimit": "The number of processors (cores) to limit generation to or -1 for default",
// StopCmd help.
"stop--synopsis": "Shutdown btcd.",
@ -554,37 +554,37 @@ var helpDescsEnUS = map[string]string{
"submitblockoptions-workid": "This parameter is currently ignored",
// SubmitBlockCmd help.
"submitblock--synopsis": "Attempts to submit a new serialized, hex-encoded block to the network.",
"submitblock-hexblock": "Serialized, hex-encoded block",
"submitblock-options": "This parameter is currently ignored",
"submitblock--condition0": "Block successfully submitted",
"submitblock--condition1": "Block rejected",
"submitblock--result1": "The reason the block was rejected",
"submitBlock--synopsis": "Attempts to submit a new serialized, hex-encoded block to the network.",
"submitBlock-hexblock": "Serialized, hex-encoded block",
"submitBlock-options": "This parameter is currently ignored",
"submitBlock--condition0": "Block successfully submitted",
"submitBlock--condition1": "Block rejected",
"submitBlock--result1": "The reason the block was rejected",
// ValidateAddressResult help.
"validateaddressresult-isvalid": "Whether or not the address is valid",
"validateaddressresult-address": "The bitcoin address (only when isvalid is true)",
// ValidateAddressCmd help.
"validateaddress--synopsis": "Verify an address is valid.",
"validateaddress-address": "Bitcoin address to validate",
"validateAddress--synopsis": "Verify an address is valid.",
"validateAddress-address": "Bitcoin address to validate",
// VerifyChainCmd help.
"verifydag--synopsis": "Verifies the block DAG database.\n" +
"verifyDag--synopsis": "Verifies the block DAG database.\n" +
"The actual checks performed by the checklevel parameter are implementation specific.\n" +
"For btcd this is:\n" +
"checklevel=0 - Look up each block and ensure it can be loaded from the database.\n" +
"checklevel=1 - Perform basic context-free sanity checks on each block.",
"verifydag-checklevel": "How thorough the block verification is",
"verifydag-checkdepth": "The number of blocks to check",
"verifydag--result0": "Whether or not the DAG verified",
"verifyDag-checklevel": "How thorough the block verification is",
"verifyDag-checkdepth": "The number of blocks to check",
"verifyDag--result0": "Whether or not the DAG verified",
// VerifyMessageCmd help.
"verifymessage--synopsis": "Verify a signed message.",
"verifymessage-address": "The bitcoin address to use for the signature",
"verifymessage-signature": "The base-64 encoded signature provided by the signer",
"verifymessage-message": "The signed message",
"verifymessage--result0": "Whether or not the signature verified",
"verifyMessage--synopsis": "Verify a signed message.",
"verifyMessage-address": "The bitcoin address to use for the signature",
"verifyMessage-signature": "The base-64 encoded signature provided by the signer",
"verifyMessage-message": "The signed message",
"verifyMessage--result0": "Whether or not the signature verified",
// -------- Websocket-specific help --------
@ -593,44 +593,44 @@ var helpDescsEnUS = map[string]string{
"sessionresult-sessionid": "The unique session ID for a client's websocket connection.",
// NotifyBlocksCmd help.
"notifyblocks--synopsis": "Request notifications for whenever a block is connected or disconnected from the main (best) chain.",
"notifyBlocks--synopsis": "Request notifications for whenever a block is connected or disconnected from the main (best) chain.",
// StopNotifyBlocksCmd help.
"stopnotifyblocks--synopsis": "Cancel registered notifications for whenever a block is connected or disconnected from the main (best) chain.",
"stopNotifyBlocks--synopsis": "Cancel registered notifications for whenever a block is connected or disconnected from the main (best) chain.",
// NotifyNewTransactionsCmd help.
"notifynewtransactions--synopsis": "Send either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.",
"notifynewtransactions-verbose": "Specifies which type of notification to receive. If verbose is true, then the caller receives txacceptedverbose, otherwise the caller receives txaccepted",
"notifyNewTransactions--synopsis": "Send either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.",
"notifyNewTransactions-verbose": "Specifies which type of notification to receive. If verbose is true, then the caller receives txacceptedverbose, otherwise the caller receives txaccepted",
// StopNotifyNewTransactionsCmd help.
"stopnotifynewtransactions--synopsis": "Stop sending either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.",
"stopNotifyNewTransactions--synopsis": "Stop sending either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.",
// NotifyReceivedCmd help.
"notifyreceived--synopsis": "Send a recvtx notification when a transaction added to mempool or appears in a newly-attached block contains a txout pkScript sending to any of the passed addresses.\n" +
"notifyReceived--synopsis": "Send a recvtx notification when a transaction added to mempool or appears in a newly-attached block contains a txout pkScript sending to any of the passed addresses.\n" +
"Matching outpoints are automatically registered for redeemingtx notifications.",
"notifyreceived-addresses": "List of address to receive notifications about",
"notifyReceived-addresses": "List of address to receive notifications about",
// StopNotifyReceivedCmd help.
"stopnotifyreceived--synopsis": "Cancel registered receive notifications for each passed address.",
"stopnotifyreceived-addresses": "List of address to cancel receive notifications for",
"stopNotifyReceived--synopsis": "Cancel registered receive notifications for each passed address.",
"stopNotifyReceived-addresses": "List of address to cancel receive notifications for",
// OutPoint help.
"outpoint-hash": "The hex-encoded bytes of the outpoint hash",
"outpoint-index": "The index of the outpoint",
"outpoint-hash": "The hex-encoded bytes of the outPoint hash",
"outpoint-index": "The index of the outPoint",
// NotifySpentCmd help.
"notifyspent--synopsis": "Send a redeemingtx notification when a transaction spending an outpoint appears in mempool (if relayed to this btcd instance) and when such a transaction first appears in a newly-attached block.",
"notifyspent-outpoints": "List of transaction outpoints to monitor.",
"notifySpent--synopsis": "Send a redeemingtx notification when a transaction spending an outPoint appears in mempool (if relayed to this btcd instance) and when such a transaction first appears in a newly-attached block.",
"notifySpent-outpoints": "List of transaction outpoints to monitor.",
// StopNotifySpentCmd help.
"stopnotifyspent--synopsis": "Cancel registered spending notifications for each passed outpoint.",
"stopnotifyspent-outpoints": "List of transaction outpoints to stop monitoring.",
"stopNotifySpent--synopsis": "Cancel registered spending notifications for each passed outPoint.",
"stopNotifySpent-outpoints": "List of transaction outpoints to stop monitoring.",
// LoadTxFilterCmd help.
"loadtxfilter--synopsis": "Load, add to, or reload a websocket client's transaction filter for mempool transactions, new blocks and rescanblocks.",
"loadtxfilter-reload": "Load a new filter instead of adding data to an existing one",
"loadtxfilter-addresses": "Array of addresses to add to the transaction filter",
"loadtxfilter-outpoints": "Array of outpoints to add to the transaction filter",
"loadTxFilter--synopsis": "Load, add to, or reload a websocket client's transaction filter for mempool transactions, new blocks and rescanBlocks.",
"loadTxFilter-reload": "Load a new filter instead of adding data to an existing one",
"loadTxFilter-addresses": "Array of addresses to add to the transaction filter",
"loadTxFilter-outpoints": "Array of outpoints to add to the transaction filter",
// Rescan help.
"rescan--synopsis": "Rescan block chain for transactions to addresses.\n" +
@ -643,9 +643,9 @@ var helpDescsEnUS = map[string]string{
"rescan-endblock": "Hash of final block to rescan",
// RescanBlocks help.
"rescanblocks--synopsis": "Rescan blocks for transactions matching the loaded transaction filter.",
"rescanblocks-blockhashes": "List of hashes to rescan. Each next block must be a child of the previous.",
"rescanblocks--result0": "List of matching blocks.",
"rescanBlocks--synopsis": "Rescan blocks for transactions matching the loaded transaction filter.",
"rescanBlocks-blockhashes": "List of hashes to rescan. Each next block must be a child of the previous.",
"rescanBlocks--result0": "List of matching blocks.",
// RescannedBlock help.
"rescannedblock-hash": "Hash of the matching block.",
@ -674,68 +674,68 @@ var helpDescsEnUS = map[string]string{
// This information is used to generate the help. Each result type must be a
// pointer to the type (or nil to indicate no return value).
var rpcResultTypes = map[string][]interface{}{
"addmanualnode": nil,
"createrawtransaction": {(*string)(nil)},
"debuglevel": {(*string)(nil), (*string)(nil)},
"decoderawtransaction": {(*btcjson.TxRawDecodeResult)(nil)},
"decodescript": {(*btcjson.DecodeScriptResult)(nil)},
"estimatefee": {(*float64)(nil)},
"addManualNode": nil,
"createRawTransaction": {(*string)(nil)},
"debugLevel": {(*string)(nil), (*string)(nil)},
"decodeRawTransaction": {(*btcjson.TxRawDecodeResult)(nil)},
"decodeScript": {(*btcjson.DecodeScriptResult)(nil)},
"estimateFee": {(*float64)(nil)},
"generate": {(*[]string)(nil)},
"getallmanualnodesinfo": {(*[]string)(nil), (*[]btcjson.GetManualNodeInfoResult)(nil)},
"getbestblock": {(*btcjson.GetBestBlockResult)(nil)},
"getbestblockhash": {(*string)(nil)},
"getblock": {(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
"getblockcount": {(*int64)(nil)},
"getblockhash": {(*string)(nil)},
"getblockheader": {(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
"getblocktemplate": {(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
"getblockdaginfo": {(*btcjson.GetBlockDAGInfoResult)(nil)},
"getcfilter": {(*string)(nil)},
"getcfilterheader": {(*string)(nil)},
"getconnectioncount": {(*int32)(nil)},
"getcurrentnet": {(*uint32)(nil)},
"getdifficulty": {(*float64)(nil)},
"getgenerate": {(*bool)(nil)},
"gethashespersec": {(*float64)(nil)},
"getheaders": {(*[]string)(nil)},
"getinfo": {(*btcjson.InfoDAGResult)(nil)},
"getmanualnodeinfo": {(*string)(nil), (*btcjson.GetManualNodeInfoResult)(nil)},
"getmempoolinfo": {(*btcjson.GetMempoolInfoResult)(nil)},
"getmininginfo": {(*btcjson.GetMiningInfoResult)(nil)},
"getnettotals": {(*btcjson.GetNetTotalsResult)(nil)},
"getnetworkhashps": {(*int64)(nil)},
"getpeerinfo": {(*[]btcjson.GetPeerInfoResult)(nil)},
"getrawmempool": {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
"getrawtransaction": {(*string)(nil), (*btcjson.TxRawResult)(nil)},
"gettxout": {(*btcjson.GetTxOutResult)(nil)},
"getAllManualNodesInfo": {(*[]string)(nil), (*[]btcjson.GetManualNodeInfoResult)(nil)},
"getBestBlock": {(*btcjson.GetBestBlockResult)(nil)},
"getBestBlockHash": {(*string)(nil)},
"getBlock": {(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
"getBlockCount": {(*int64)(nil)},
"getBlockHash": {(*string)(nil)},
"getBlockHeader": {(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
"getBlockTemplate": {(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
"getBlockDagInfo": {(*btcjson.GetBlockDAGInfoResult)(nil)},
"getCFilter": {(*string)(nil)},
"getCFilterHeader": {(*string)(nil)},
"getConnectionCount": {(*int32)(nil)},
"getCurrentNet": {(*uint32)(nil)},
"getDifficulty": {(*float64)(nil)},
"getGenerate": {(*bool)(nil)},
"getHashesPerSec": {(*float64)(nil)},
"getHeaders": {(*[]string)(nil)},
"getInfo": {(*btcjson.InfoDAGResult)(nil)},
"getManualNodeInfo": {(*string)(nil), (*btcjson.GetManualNodeInfoResult)(nil)},
"getMempoolInfo": {(*btcjson.GetMempoolInfoResult)(nil)},
"getMiningInfo": {(*btcjson.GetMiningInfoResult)(nil)},
"getNetTotals": {(*btcjson.GetNetTotalsResult)(nil)},
"getNetworkHashPs": {(*int64)(nil)},
"getPeerInfo": {(*[]btcjson.GetPeerInfoResult)(nil)},
"getRawMempool": {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
"getRawTransaction": {(*string)(nil), (*btcjson.TxRawResult)(nil)},
"getTxOut": {(*btcjson.GetTxOutResult)(nil)},
"node": nil,
"help": {(*string)(nil), (*string)(nil)},
"ping": nil,
"removemanualnode": nil,
"searchrawtransactions": {(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
"sendrawtransaction": {(*string)(nil)},
"setgenerate": nil,
"removeManualNode": nil,
"searchRawTransactions": {(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
"sendRawTransaction": {(*string)(nil)},
"setGenerate": nil,
"stop": {(*string)(nil)},
"submitblock": {nil, (*string)(nil)},
"submitBlock": {nil, (*string)(nil)},
"uptime": {(*int64)(nil)},
"validateaddress": {(*btcjson.ValidateAddressResult)(nil)},
"verifydag": {(*bool)(nil)},
"verifymessage": {(*bool)(nil)},
"validateAddress": {(*btcjson.ValidateAddressResult)(nil)},
"verifyDag": {(*bool)(nil)},
"verifyMessage": {(*bool)(nil)},
"version": {(*map[string]btcjson.VersionResult)(nil)},
// Websocket commands.
"loadtxfilter": nil,
"loadTxFilter": nil,
"session": {(*btcjson.SessionResult)(nil)},
"notifyblocks": nil,
"stopnotifyblocks": nil,
"notifynewtransactions": nil,
"stopnotifynewtransactions": nil,
"notifyreceived": nil,
"stopnotifyreceived": nil,
"notifyspent": nil,
"stopnotifyspent": nil,
"notifyBlocks": nil,
"stopNotifyBlocks": nil,
"notifyNewTransactions": nil,
"stopNotifyNewTransactions": nil,
"notifyReceived": nil,
"stopNotifyReceived": nil,
"notifySpent": nil,
"stopNotifySpent": nil,
"rescan": nil,
"rescanblocks": {(*[]btcjson.RescannedBlock)(nil)},
"rescanBlocks": {(*[]btcjson.RescannedBlock)(nil)},
}
// helpCacher provides a concurrent safe type that provides help and usage for

View File

@ -33,10 +33,10 @@ func TestHelp(t *testing.T) {
// Ensure the usage for every command can be generated without errors.
helpCacher := newHelpCacher()
if _, err := helpCacher.rpcUsage(true); err != nil {
t.Fatalf("Failed to generate one-line usage: %v", err)
t.Errorf("Failed to generate one-line usage: %v", err)
}
if _, err := helpCacher.rpcUsage(true); err != nil {
t.Fatalf("Failed to generate one-line usage (cached): %v", err)
t.Errorf("Failed to generate one-line usage (cached): %v", err)
}
// Ensure the help for every command can be generated without errors.

View File

@ -63,18 +63,18 @@ type wsCommandHandler func(*wsClient, interface{}) (interface{}, error)
// causes a dependency loop.
var wsHandlers map[string]wsCommandHandler
var wsHandlersBeforeInit = map[string]wsCommandHandler{
"loadtxfilter": handleLoadTxFilter,
"loadTxFilter": handleLoadTxFilter,
"help": handleWebsocketHelp,
"notifyblocks": handleNotifyBlocks,
"notifynewtransactions": handleNotifyNewTransactions,
"notifyreceived": handleNotifyReceived,
"notifyspent": handleNotifySpent,
"notifyBlocks": handleNotifyBlocks,
"notifyNewTransactions": handleNotifyNewTransactions,
"notifyReceived": handleNotifyReceived,
"notifySpent": handleNotifySpent,
"session": handleSession,
"stopnotifyblocks": handleStopNotifyBlocks,
"stopnotifynewtransactions": handleStopNotifyNewTransactions,
"stopnotifyspent": handleStopNotifySpent,
"stopnotifyreceived": handleStopNotifyReceived,
"rescanblocks": handleRescanBlocks,
"stopNotifyBlocks": handleStopNotifyBlocks,
"stopNotifyNewTransactions": handleStopNotifyNewTransactions,
"stopNotifySpent": handleStopNotifySpent,
"stopNotifyReceived": handleStopNotifyReceived,
"rescanBlocks": handleRescanBlocks,
}
// WebsocketHandler handles a new websocket client by creating a new wsClient,
@ -246,7 +246,7 @@ func (m *wsNotificationManager) NotifyMempoolTx(tx *util.Tx, isNew bool) {
}
// wsClientFilter tracks relevant addresses for each websocket client for
// the `rescanblocks` extension. It is modified by the `loadtxfilter` command.
// the `rescanBlocks` extension. It is modified by the `loadTxFilter` command.
//
// NOTE: This extension was ported from github.com/decred/dcrd
type wsClientFilter struct {
@ -1287,8 +1287,8 @@ type wsClient struct {
spentRequests map[wire.OutPoint]struct{}
// filterData is the new generation transaction filter backported from
// github.com/decred/dcrd for the new backported `loadtxfilter` and
// `rescanblocks` methods.
// github.com/decred/dcrd for the new backported `loadTxFilter` and
// `rescanBlocks` methods.
filterData *wsClientFilter
// Networking infrastructure.
@ -1779,7 +1779,7 @@ func handleWebsocketHelp(wsc *wsClient, icmd interface{}) (interface{}, error) {
return help, nil
}
// handleLoadTxFilter implements the loadtxfilter command extension for
// handleLoadTxFilter implements the loadTxFilter command extension for
// websocket connections.
//
// NOTE: This extension is ported from github.com/decred/dcrd
@ -1824,7 +1824,7 @@ func handleLoadTxFilter(wsc *wsClient, icmd interface{}) (interface{}, error) {
return nil, nil
}
// handleNotifyBlocks implements the notifyblocks command extension for
// handleNotifyBlocks implements the notifyBlocks command extension for
// websocket connections.
func handleNotifyBlocks(wsc *wsClient, icmd interface{}) (interface{}, error) {
wsc.server.ntfnMgr.RegisterBlockUpdates(wsc)
@ -1837,14 +1837,14 @@ func handleSession(wsc *wsClient, icmd interface{}) (interface{}, error) {
return &btcjson.SessionResult{SessionID: wsc.sessionID}, nil
}
// handleStopNotifyBlocks implements the stopnotifyblocks command extension for
// handleStopNotifyBlocks implements the stopNotifyBlocks command extension for
// websocket connections.
func handleStopNotifyBlocks(wsc *wsClient, icmd interface{}) (interface{}, error) {
wsc.server.ntfnMgr.UnregisterBlockUpdates(wsc)
return nil, nil
}
// handleNotifySpent implements the notifyspent command extension for
// handleNotifySpent implements the notifySpent command extension for
// websocket connections.
func handleNotifySpent(wsc *wsClient, icmd interface{}) (interface{}, error) {
cmd, ok := icmd.(*btcjson.NotifySpentCmd)
@ -1861,7 +1861,7 @@ func handleNotifySpent(wsc *wsClient, icmd interface{}) (interface{}, error) {
return nil, nil
}
// handleNotifyNewTransations implements the notifynewtransactions command
// handleNotifyNewTransations implements the notifyNewTransactions command
// extension for websocket connections.
func handleNotifyNewTransactions(wsc *wsClient, icmd interface{}) (interface{}, error) {
cmd, ok := icmd.(*btcjson.NotifyNewTransactionsCmd)
@ -1874,14 +1874,14 @@ func handleNotifyNewTransactions(wsc *wsClient, icmd interface{}) (interface{},
return nil, nil
}
// handleStopNotifyNewTransations implements the stopnotifynewtransactions
// handleStopNotifyNewTransations implements the stopNotifyNewTransactions
// command extension for websocket connections.
func handleStopNotifyNewTransactions(wsc *wsClient, icmd interface{}) (interface{}, error) {
wsc.server.ntfnMgr.UnregisterNewMempoolTxsUpdates(wsc)
return nil, nil
}
// handleNotifyReceived implements the notifyreceived command extension for
// handleNotifyReceived implements the notifyReceived command extension for
// websocket connections.
func handleNotifyReceived(wsc *wsClient, icmd interface{}) (interface{}, error) {
cmd, ok := icmd.(*btcjson.NotifyReceivedCmd)
@ -1900,7 +1900,7 @@ func handleNotifyReceived(wsc *wsClient, icmd interface{}) (interface{}, error)
return nil, nil
}
// handleStopNotifySpent implements the stopnotifyspent command extension for
// handleStopNotifySpent implements the stopNotifySpent command extension for
// websocket connections.
func handleStopNotifySpent(wsc *wsClient, icmd interface{}) (interface{}, error) {
cmd, ok := icmd.(*btcjson.StopNotifySpentCmd)
@ -1920,7 +1920,7 @@ func handleStopNotifySpent(wsc *wsClient, icmd interface{}) (interface{}, error)
return nil, nil
}
// handleStopNotifyReceived implements the stopnotifyreceived command extension
// handleStopNotifyReceived implements the stopNotifyReceived command extension
// for websocket connections.
func handleStopNotifyReceived(wsc *wsClient, icmd interface{}) (interface{}, error) {
cmd, ok := icmd.(*btcjson.StopNotifyReceivedCmd)
@ -2038,7 +2038,7 @@ func rescanBlockFilter(filter *wsClientFilter, block *util.Block, params *dagcon
return transactions
}
// handleRescanBlocks implements the rescanblocks command extension for
// handleRescanBlocks implements the rescanBlocks command extension for
// websocket connections.
//
// NOTE: This extension is ported from github.com/decred/dcrd