[DEV-242] Parameter names should be also camelCase in JSON-RPC (#118)

* [DEV-242] Modified some help functionality to convert to lowercase camel case instead of just lowercase.

* [DEV-242] Corrected help functionality for struct field names.

* [DEV-242] Corrected help functionality for struct names.

* [DEV-242] Cleaned up toLowercaseCamelCase.

* [DEV-242] Renamed toLowercaseCamelCase to toCamelCase.

* [DEV-242] Converted the rest of the stuff in rpcserverhelp.go to camelCase. Fixed a bug in the camelCase converter.

* [DEV-242] camelCase-ified the last few RPC parameter names.

* [DEV-242] Fixed an off-by-one bug in toCamelCase.

* [DEV-242] Changed back from "jsonRpc" to "jsonrpc".

* [DEV-242] Moved toCamelCase into utils, wrote unit tests for it, and fixed an off-by-one bug.

* [DEV-242] Re-exported DefaultHomeDir because it's required in windows_service.go.

* [DEV-242] Added a comment above DefaultHomeDir to satisfy golint.

* [DEV-242] Formatted config/config.go.
This commit is contained in:
stasatdaglabs 2018-11-05 18:50:55 +02:00 committed by Svarog
parent 7093155c3a
commit 8a234bf4a3
26 changed files with 638 additions and 505 deletions

View File

@ -95,8 +95,8 @@ func NewGetCurrentNetCmd() *GetCurrentNetCmd {
// NOTE: This is a btcsuite extension ported from
// github.com/decred/dcrd/dcrjson.
type GetHeadersCmd struct {
BlockLocators []string `json:"blocklocators"`
HashStop string `json:"hashstop"`
BlockLocators []string `json:"blockLocators"`
HashStop string `json:"hashStop"`
}
// NewGetHeadersCmd returns a new instance which can be used to issue a

View File

@ -11,10 +11,10 @@ package btcjson
// NOTE: This is a btcsuite extension ported from
// github.com/decred/dcrd/dcrjson.
type VersionResult struct {
VersionString string `json:"versionstring"`
VersionString string `json:"versionString"`
Major uint32 `json:"major"`
Minor uint32 `json:"minor"`
Patch uint32 `json:"patch"`
Prerelease string `json:"prerelease"`
BuildMetadata string `json:"buildmetadata"`
BuildMetadata string `json:"buildMetadata"`
}

View File

@ -33,7 +33,7 @@ func TestBtcdExtCustomResults(t *testing.T) {
Prerelease: "pr",
BuildMetadata: "bm",
},
expected: `{"versionstring":"1.0.0","major":1,"minor":0,"patch":0,"prerelease":"pr","buildmetadata":"bm"}`,
expected: `{"versionString":"1.0.0","major":1,"minor":0,"patch":0,"prerelease":"pr","buildMetadata":"bm"}`,
},
}

View File

@ -307,7 +307,7 @@ func TestFieldUsage(t *testing.T) {
name: "array of structs",
field: func() reflect.StructField {
type s2 struct {
Txid string
TxID string
}
type s struct {
Capabilities []s2
@ -346,7 +346,7 @@ func TestFieldUsage(t *testing.T) {
name: "sub struct with string",
field: func() reflect.StructField {
type s2 struct {
Txid string
TxID string
}
type s struct {
Test s2

View File

@ -461,7 +461,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
{
name: "unregistered type",
request: btcjson.Request{
Jsonrpc: "1.0",
JsonRPC: "1.0",
Method: "bogusMethod",
Params: nil,
ID: nil,
@ -471,7 +471,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
{
name: "incorrect number of params",
request: btcjson.Request{
Jsonrpc: "1.0",
JsonRPC: "1.0",
Method: "getBlockCount",
Params: []json.RawMessage{[]byte(`"bogusparam"`)},
ID: nil,
@ -481,7 +481,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
{
name: "invalid type for a parameter",
request: btcjson.Request{
Jsonrpc: "1.0",
JsonRPC: "1.0",
Method: "getBlock",
Params: []json.RawMessage{[]byte("1")},
ID: nil,
@ -491,7 +491,7 @@ func TestUnmarshalCmdErrors(t *testing.T) {
{
name: "invalid JSON for a parameter",
request: btcjson.Request{
Jsonrpc: "1.0",
JsonRPC: "1.0",
Method: "getBlock",
Params: []json.RawMessage{[]byte(`"1`)},
ID: nil,

View File

@ -45,7 +45,7 @@ func NewRemoveManualNodeCmd(addr string) *RemoveManualNodeCmd {
// TransactionInput represents the inputs to a transaction. Specifically a
// transaction hash and output number pair.
type TransactionInput struct {
Txid string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
}
@ -207,13 +207,13 @@ type TemplateRequest struct {
Capabilities []string `json:"capabilities,omitempty"`
// Optional long polling.
LongPollID string `json:"longpollid,omitempty"`
LongPollID string `json:"longPollId,omitempty"`
// Optional template tweaking. SigOpLimit and SizeLimit can be int64
// or bool.
SigOpLimit interface{} `json:"sigoplimit,omitempty"`
SizeLimit interface{} `json:"sizelimit,omitempty"`
MaxVersion uint32 `json:"maxversion,omitempty"`
SigOpLimit interface{} `json:"sigOpLimit,omitempty"`
SizeLimit interface{} `json:"sizeLimit,omitempty"`
MaxVersion uint32 `json:"maxVersion,omitempty"`
// Basic pool extension from BIP 0023.
Target string `json:"target,omitempty"`
@ -221,7 +221,7 @@ type TemplateRequest struct {
// Block proposal from BIP 0023. Data is only provided when Mode is
// "proposal".
Data string `json:"data,omitempty"`
WorkID string `json:"workid,omitempty"`
WorkID string `json:"workId,omitempty"`
}
// convertTemplateRequestField potentially converts the provided value as
@ -255,14 +255,14 @@ func (t *TemplateRequest) UnmarshalJSON(data []byte) error {
}
// The SigOpLimit field can only be nil, bool, or int64.
val, err := convertTemplateRequestField("sigoplimit", request.SigOpLimit)
val, err := convertTemplateRequestField("sigOpLimit", request.SigOpLimit)
if err != nil {
return err
}
request.SigOpLimit = val
// The SizeLimit field can only be nil, bool, or int64.
val, err = convertTemplateRequestField("sizelimit", request.SizeLimit)
val, err = convertTemplateRequestField("sizeLimit", request.SizeLimit)
if err != nil {
return err
}
@ -469,7 +469,7 @@ func NewGetRawMempoolCmd(verbose *bool) *GetRawMempoolCmd {
// NOTE: This field is an int versus a bool to remain compatible with Bitcoin
// Core even though it really should be a bool.
type GetRawTransactionCmd struct {
Txid string
TxID string
Verbose *int `jsonrpcdefault:"0"`
}
@ -480,14 +480,14 @@ type GetRawTransactionCmd struct {
// for optional parameters will use the default value.
func NewGetRawTransactionCmd(txHash string, verbose *int) *GetRawTransactionCmd {
return &GetRawTransactionCmd{
Txid: txHash,
TxID: txHash,
Verbose: verbose,
}
}
// GetTxOutCmd defines the getTxOut JSON-RPC command.
type GetTxOutCmd struct {
Txid string
TxID string
Vout uint32
IncludeMempool *bool `jsonrpcdefault:"true"`
}
@ -499,7 +499,7 @@ type GetTxOutCmd struct {
// for optional parameters will use the default value.
func NewGetTxOutCmd(txHash string, vout uint32, includeMempool *bool) *GetTxOutCmd {
return &GetTxOutCmd{
Txid: txHash,
TxID: txHash,
Vout: vout,
IncludeMempool: includeMempool,
}
@ -673,7 +673,7 @@ func NewStopCmd() *StopCmd {
// SubmitBlockCmd command.
type SubmitBlockOptions struct {
// must be provided if server provided a workid with template.
WorkID string `json:"workid,omitempty"`
WorkID string `json:"workId,omitempty"`
}
// SubmitBlockCmd defines the submitBlock JSON-RPC command.

View File

@ -44,38 +44,38 @@ func TestDAGSvrCmds(t *testing.T) {
{
name: "createRawTransaction",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("createRawTransaction", `[{"txid":"123","vout":1}]`,
return btcjson.NewCmd("createRawTransaction", `[{"txId":"123","vout":1}]`,
`{"456":0.0123}`)
},
staticCmd: func() interface{} {
txInputs := []btcjson.TransactionInput{
{Txid: "123", Vout: 1},
{TxID: "123", Vout: 1},
}
amounts := map[string]float64{"456": .0123}
return btcjson.NewCreateRawTransactionCmd(txInputs, amounts, nil)
},
marshalled: `{"jsonrpc":"1.0","method":"createRawTransaction","params":[[{"txid":"123","vout":1}],{"456":0.0123}],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"createRawTransaction","params":[[{"txId":"123","vout":1}],{"456":0.0123}],"id":1}`,
unmarshalled: &btcjson.CreateRawTransactionCmd{
Inputs: []btcjson.TransactionInput{{Txid: "123", Vout: 1}},
Inputs: []btcjson.TransactionInput{{TxID: "123", Vout: 1}},
Amounts: map[string]float64{"456": .0123},
},
},
{
name: "createRawTransaction optional",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("createRawTransaction", `[{"txid":"123","vout":1}]`,
return btcjson.NewCmd("createRawTransaction", `[{"txId":"123","vout":1}]`,
`{"456":0.0123}`, int64(12312333333))
},
staticCmd: func() interface{} {
txInputs := []btcjson.TransactionInput{
{Txid: "123", Vout: 1},
{TxID: "123", Vout: 1},
}
amounts := map[string]float64{"456": .0123}
return btcjson.NewCreateRawTransactionCmd(txInputs, amounts, btcjson.Uint64(12312333333))
},
marshalled: `{"jsonrpc":"1.0","method":"createRawTransaction","params":[[{"txid":"123","vout":1}],{"456":0.0123},12312333333],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"createRawTransaction","params":[[{"txId":"123","vout":1}],{"456":0.0123},12312333333],"id":1}`,
unmarshalled: &btcjson.CreateRawTransactionCmd{
Inputs: []btcjson.TransactionInput{{Txid: "123", Vout: 1}},
Inputs: []btcjson.TransactionInput{{TxID: "123", Vout: 1}},
Amounts: map[string]float64{"456": .0123},
LockTime: btcjson.Uint64(12312333333),
},
@ -255,23 +255,23 @@ func TestDAGSvrCmds(t *testing.T) {
{
name: "getBlockTemplate optional - template request with tweaks",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getBlockTemplate", `{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":500,"sizelimit":100000000,"maxversion":1}`)
return btcjson.NewCmd("getBlockTemplate", `{"mode":"template","capabilities":["longPoll","coinbaseTxn"],"sigOpLimit":500,"sizeLimit":100000000,"maxVersion":1}`)
},
staticCmd: func() interface{} {
template := btcjson.TemplateRequest{
Mode: "template",
Capabilities: []string{"longpoll", "coinbasetxn"},
Capabilities: []string{"longPoll", "coinbaseTxn"},
SigOpLimit: 500,
SizeLimit: 100000000,
MaxVersion: 1,
}
return btcjson.NewGetBlockTemplateCmd(&template)
},
marshalled: `{"jsonrpc":"1.0","method":"getBlockTemplate","params":[{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":500,"sizelimit":100000000,"maxversion":1}],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getBlockTemplate","params":[{"mode":"template","capabilities":["longPoll","coinbaseTxn"],"sigOpLimit":500,"sizeLimit":100000000,"maxVersion":1}],"id":1}`,
unmarshalled: &btcjson.GetBlockTemplateCmd{
Request: &btcjson.TemplateRequest{
Mode: "template",
Capabilities: []string{"longpoll", "coinbasetxn"},
Capabilities: []string{"longPoll", "coinbaseTxn"},
SigOpLimit: int64(500),
SizeLimit: int64(100000000),
MaxVersion: 1,
@ -281,23 +281,23 @@ func TestDAGSvrCmds(t *testing.T) {
{
name: "getBlockTemplate optional - template request with tweaks 2",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("getBlockTemplate", `{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":true,"sizelimit":100000000,"maxversion":1}`)
return btcjson.NewCmd("getBlockTemplate", `{"mode":"template","capabilities":["longPoll","coinbaseTxn"],"sigOpLimit":true,"sizeLimit":100000000,"maxVersion":1}`)
},
staticCmd: func() interface{} {
template := btcjson.TemplateRequest{
Mode: "template",
Capabilities: []string{"longpoll", "coinbasetxn"},
Capabilities: []string{"longPoll", "coinbaseTxn"},
SigOpLimit: true,
SizeLimit: 100000000,
MaxVersion: 1,
}
return btcjson.NewGetBlockTemplateCmd(&template)
},
marshalled: `{"jsonrpc":"1.0","method":"getBlockTemplate","params":[{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":true,"sizelimit":100000000,"maxversion":1}],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"getBlockTemplate","params":[{"mode":"template","capabilities":["longPoll","coinbaseTxn"],"sigOpLimit":true,"sizeLimit":100000000,"maxVersion":1}],"id":1}`,
unmarshalled: &btcjson.GetBlockTemplateCmd{
Request: &btcjson.TemplateRequest{
Mode: "template",
Capabilities: []string{"longpoll", "coinbasetxn"},
Capabilities: []string{"longPoll", "coinbaseTxn"},
SigOpLimit: true,
SizeLimit: int64(100000000),
MaxVersion: 1,
@ -562,7 +562,7 @@ func TestDAGSvrCmds(t *testing.T) {
},
marshalled: `{"jsonrpc":"1.0","method":"getRawTransaction","params":["123"],"id":1}`,
unmarshalled: &btcjson.GetRawTransactionCmd{
Txid: "123",
TxID: "123",
Verbose: btcjson.Int(0),
},
},
@ -576,7 +576,7 @@ func TestDAGSvrCmds(t *testing.T) {
},
marshalled: `{"jsonrpc":"1.0","method":"getRawTransaction","params":["123",1],"id":1}`,
unmarshalled: &btcjson.GetRawTransactionCmd{
Txid: "123",
TxID: "123",
Verbose: btcjson.Int(1),
},
},
@ -590,7 +590,7 @@ func TestDAGSvrCmds(t *testing.T) {
},
marshalled: `{"jsonrpc":"1.0","method":"getTxOut","params":["123",1],"id":1}`,
unmarshalled: &btcjson.GetTxOutCmd{
Txid: "123",
TxID: "123",
Vout: 1,
IncludeMempool: btcjson.Bool(true),
},
@ -605,7 +605,7 @@ func TestDAGSvrCmds(t *testing.T) {
},
marshalled: `{"jsonrpc":"1.0","method":"getTxOut","params":["123",1,true],"id":1}`,
unmarshalled: &btcjson.GetTxOutCmd{
Txid: "123",
TxID: "123",
Vout: 1,
IncludeMempool: btcjson.Bool(true),
},
@ -961,7 +961,7 @@ func TestDAGSvrCmds(t *testing.T) {
{
name: "submitBlock optional",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("submitBlock", "112233", `{"workid":"12345"}`)
return btcjson.NewCmd("submitBlock", "112233", `{"workId":"12345"}`)
},
staticCmd: func() interface{} {
options := btcjson.SubmitBlockOptions{
@ -969,7 +969,7 @@ func TestDAGSvrCmds(t *testing.T) {
}
return btcjson.NewSubmitBlockCmd("112233", &options)
},
marshalled: `{"jsonrpc":"1.0","method":"submitBlock","params":["112233",{"workid":"12345"}],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"submitBlock","params":["112233",{"workId":"12345"}],"id":1}`,
unmarshalled: &btcjson.SubmitBlockCmd{
HexBlock: "112233",
Options: &btcjson.SubmitBlockOptions{

View File

@ -15,13 +15,13 @@ type GetBlockHeaderVerboseResult struct {
Height int32 `json:"height"`
Version int32 `json:"version"`
VersionHex string `json:"versionHex"`
MerkleRoot string `json:"merkleroot"`
MerkleRoot string `json:"merkleRoot"`
Time int64 `json:"time"`
Nonce uint64 `json:"nonce"`
Bits string `json:"bits"`
Difficulty float64 `json:"difficulty"`
ParentHashes []string `json:"parentblockhashes,omitempty"`
NextHashes []string `json:"nextblockhashes,omitempty"`
ParentHashes []string `json:"parentHashes,omitempty"`
NextHashes []string `json:"nextHashes,omitempty"`
}
// GetBlockVerboseResult models the data from the getblock command when the
@ -34,15 +34,15 @@ type GetBlockVerboseResult struct {
Height int64 `json:"height"`
Version int32 `json:"version"`
VersionHex string `json:"versionHex"`
MerkleRoot string `json:"merkleroot"`
MerkleRoot string `json:"merkleRoot"`
Tx []string `json:"tx,omitempty"`
RawTx []TxRawResult `json:"rawtx,omitempty"`
RawTx []TxRawResult `json:"rawRx,omitempty"`
Time int64 `json:"time"`
Nonce uint64 `json:"nonce"`
Bits string `json:"bits"`
Difficulty float64 `json:"difficulty"`
ParentHashes []string `json:"parentblockhashes"`
NextHashes []string `json:"nextblockhashes,omitempty"`
ParentHashes []string `json:"parentHashes"`
NextHashes []string `json:"nextHashes,omitempty"`
}
// CreateMultiSigResult models the data returned from the createmultisig
@ -70,7 +70,7 @@ type GetManualNodeInfoResultAddr struct {
// GetManualNodeInfoResult models the data from the getmanualnodeinfo command.
type GetManualNodeInfoResult struct {
ManualNode string `json:"manualnode"`
ManualNode string `json:"manualNode"`
Connected *bool `json:"connected,omitempty"`
Addresses *[]GetManualNodeInfoResultAddr `json:"addresses,omitempty"`
}
@ -101,15 +101,15 @@ type GetBlockDAGInfoResult struct {
DAG string `json:"dag"`
Blocks int32 `json:"blocks"`
Headers int32 `json:"headers"`
TipHashes []string `json:"tiphashes"`
TipHashes []string `json:"tipHashes"`
Difficulty float64 `json:"difficulty"`
MedianTime int64 `json:"mediantime"`
VerificationProgress float64 `json:"verificationprogress,omitempty"`
MedianTime int64 `json:"medianTime"`
VerificationProgress float64 `json:"verificationProgress,omitempty"`
Pruned bool `json:"pruned"`
PruneHeight int32 `json:"pruneheight,omitempty"`
DAGWork string `json:"dagwork,omitempty"`
SoftForks []*SoftForkDescription `json:"softforks"`
Bip9SoftForks map[string]*Bip9SoftForkDescription `json:"bip9_softforks"`
PruneHeight int32 `json:"pruneHeight,omitempty"`
DAGWork string `json:"dagWork,omitempty"`
SoftForks []*SoftForkDescription `json:"softForks"`
Bip9SoftForks map[string]*Bip9SoftForkDescription `json:"bip9SoftForks"`
}
// GetBlockTemplateResultTx models the transactions field of the
@ -119,7 +119,7 @@ type GetBlockTemplateResultTx struct {
Hash string `json:"hash"`
Depends []int64 `json:"depends"`
Fee uint64 `json:"fee"`
SigOps int64 `json:"sigops"`
SigOps int64 `json:"sigOps"`
}
// GetBlockTemplateResultAux models the coinbaseaux field of the
@ -134,36 +134,36 @@ type GetBlockTemplateResult struct {
// Base fields from BIP 0022. CoinbaseAux is optional. One of
// CoinbaseTxn or CoinbaseValue must be specified, but not both.
Bits string `json:"bits"`
CurTime int64 `json:"curtime"`
CurTime int64 `json:"curTime"`
Height int64 `json:"height"`
ParentHashes []string `json:"parentblockhashes"`
SigOpLimit int64 `json:"sigoplimit,omitempty"`
SizeLimit int64 `json:"sizelimit,omitempty"`
ParentHashes []string `json:"parentHashes"`
SigOpLimit int64 `json:"sigOpLimit,omitempty"`
SizeLimit int64 `json:"sizeLimit,omitempty"`
Transactions []GetBlockTemplateResultTx `json:"transactions"`
Version int32 `json:"version"`
CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseaux,omitempty"`
CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbasetxn,omitempty"`
CoinbaseValue *uint64 `json:"coinbasevalue,omitempty"`
WorkID string `json:"workid,omitempty"`
CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseAux,omitempty"`
CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbaseTxn,omitempty"`
CoinbaseValue *uint64 `json:"coinbaseValue,omitempty"`
WorkID string `json:"workId,omitempty"`
// Optional long polling from BIP 0022.
LongPollID string `json:"longpollid,omitempty"`
LongPollURI string `json:"longpolluri,omitempty"`
SubmitOld *bool `json:"submitold,omitempty"`
LongPollID string `json:"longPollId,omitempty"`
LongPollURI string `json:"longPollUri,omitempty"`
SubmitOld *bool `json:"submitOld,omitempty"`
// Basic pool extension from BIP 0023.
Target string `json:"target,omitempty"`
Expires int64 `json:"expires,omitempty"`
// Mutations from BIP 0023.
MaxTime int64 `json:"maxtime,omitempty"`
MinTime int64 `json:"mintime,omitempty"`
MaxTime int64 `json:"maxTime,omitempty"`
MinTime int64 `json:"minTime,omitempty"`
Mutable []string `json:"mutable,omitempty"`
NonceRange string `json:"noncerange,omitempty"`
NonceRange string `json:"nonceRange,omitempty"`
// Block proposal from BIP 0023.
Capabilities []string `json:"capabilities,omitempty"`
RejectReasion string `json:"reject-reason,omitempty"`
RejectReasion string `json:"rejectReason,omitempty"`
}
// GetMempoolEntryResult models the data returned from the getmempoolentry
@ -171,17 +171,17 @@ type GetBlockTemplateResult struct {
type GetMempoolEntryResult struct {
Size int32 `json:"size"`
Fee float64 `json:"fee"`
ModifiedFee float64 `json:"modifiedfee"`
ModifiedFee float64 `json:"modifiedFee"`
Time int64 `json:"time"`
Height int64 `json:"height"`
StartingPriority float64 `json:"startingpriority"`
CurrentPriority float64 `json:"currentpriority"`
DescendantCount int64 `json:"descendantcount"`
DescendantSize int64 `json:"descendantsize"`
DescendantFees float64 `json:"descendantfees"`
AncestorCount int64 `json:"ancestorcount"`
AncestorSize int64 `json:"ancestorsize"`
AncestorFees float64 `json:"ancestorfees"`
StartingPriority float64 `json:"startingPriority"`
CurrentPriority float64 `json:"currentPriority"`
DescendantCount int64 `json:"descendantCount"`
DescendantSize int64 `json:"descendantSize"`
DescendantFees float64 `json:"descendantFees"`
AncestorCount int64 `json:"ancestorCount"`
AncestorSize int64 `json:"ancestorSize"`
AncestorFees float64 `json:"ancestorFees"`
Depends []string `json:"depends"`
}
@ -198,7 +198,7 @@ type NetworksResult struct {
Limited bool `json:"limited"`
Reachable bool `json:"reachable"`
Proxy string `json:"proxy"`
ProxyRandomizeCredentials bool `json:"proxy_randomize_credentials"`
ProxyRandomizeCredentials bool `json:"proxyRandomizeCredentials"`
}
// LocalAddressesResult models the localaddresses data from the getnetworkinfo
@ -213,17 +213,17 @@ type LocalAddressesResult struct {
// command.
type GetNetworkInfoResult struct {
Version int32 `json:"version"`
SubVersion string `json:"subversion"`
ProtocolVersion int32 `json:"protocolversion"`
LocalServices string `json:"localservices"`
LocalRelay bool `json:"localrelay"`
TimeOffset int64 `json:"timeoffset"`
SubVersion string `json:"subVersion"`
ProtocolVersion int32 `json:"protocolVersion"`
LocalServices string `json:"localServices"`
LocalRelay bool `json:"localRelay"`
TimeOffset int64 `json:"timeOffset"`
Connections int32 `json:"connections"`
NetworkActive bool `json:"networkactive"`
NetworkActive bool `json:"networkActive"`
Networks []NetworksResult `json:"networks"`
RelayFee float64 `json:"relayfee"`
IncrementalFee float64 `json:"incrementalfee"`
LocalAddresses []LocalAddressesResult `json:"localaddresses"`
RelayFee float64 `json:"relayFee"`
IncrementalFee float64 `json:"incrementalFee"`
LocalAddresses []LocalAddressesResult `json:"localAddresses"`
Warnings string `json:"warnings"`
}
@ -232,23 +232,23 @@ type GetPeerInfoResult struct {
ID int32 `json:"id"`
Addr string `json:"addr"`
Services string `json:"services"`
RelayTxes bool `json:"relaytxes"`
LastSend int64 `json:"lastsend"`
LastRecv int64 `json:"lastrecv"`
BytesSent uint64 `json:"bytessent"`
BytesRecv uint64 `json:"bytesrecv"`
ConnTime int64 `json:"conntime"`
TimeOffset int64 `json:"timeoffset"`
PingTime float64 `json:"pingtime"`
PingWait float64 `json:"pingwait,omitempty"`
RelayTxes bool `json:"relayTxes"`
LastSend int64 `json:"lastSend"`
LastRecv int64 `json:"lastRecv"`
BytesSent uint64 `json:"bytesSent"`
BytesRecv uint64 `json:"bytesRecv"`
ConnTime int64 `json:"connTime"`
TimeOffset int64 `json:"timeOffset"`
PingTime float64 `json:"pingTime"`
PingWait float64 `json:"pingWait,omitempty"`
Version uint32 `json:"version"`
SubVer string `json:"subver"`
SubVer string `json:"subVer"`
Inbound bool `json:"inbound"`
StartingHeight int32 `json:"startingheight"`
CurrentHeight int32 `json:"currentheight,omitempty"`
BanScore int32 `json:"banscore"`
FeeFilter int64 `json:"feefilter"`
SyncNode bool `json:"syncnode"`
StartingHeight int32 `json:"startingHeight"`
CurrentHeight int32 `json:"currentHeight,omitempty"`
BanScore int32 `json:"banScore"`
FeeFilter int64 `json:"feeFilter"`
SyncNode bool `json:"syncNode"`
}
// GetRawMempoolVerboseResult models the data returned from the getrawmempool
@ -259,8 +259,8 @@ type GetRawMempoolVerboseResult struct {
Fee float64 `json:"fee"`
Time int64 `json:"time"`
Height int64 `json:"height"`
StartingPriority float64 `json:"startingpriority"`
CurrentPriority float64 `json:"currentpriority"`
StartingPriority float64 `json:"startingPriority"`
CurrentPriority float64 `json:"currentPriority"`
Depends []string `json:"depends"`
}
@ -276,7 +276,7 @@ type ScriptPubKeyResult struct {
// GetTxOutResult models the data from the gettxout command.
type GetTxOutResult struct {
BestBlock string `json:"bestblock"`
BestBlock string `json:"bestBlock"`
Confirmations int64 `json:"confirmations"`
Value float64 `json:"value"`
ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
@ -285,9 +285,9 @@ type GetTxOutResult struct {
// GetNetTotalsResult models the data returned from the getnettotals command.
type GetNetTotalsResult struct {
TotalBytesRecv uint64 `json:"totalbytesrecv"`
TotalBytesSent uint64 `json:"totalbytessent"`
TimeMillis int64 `json:"timemillis"`
TotalBytesRecv uint64 `json:"totalBytesRecv"`
TotalBytesSent uint64 `json:"totalBytesSent"`
TimeMillis int64 `json:"timeMillis"`
}
// ScriptSig models a signature script. It is defined separately since it only
@ -303,7 +303,7 @@ type ScriptSig struct {
// same structure.
type Vin struct {
Coinbase string `json:"coinbase"`
Txid string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
ScriptSig *ScriptSig `json:"scriptSig"`
Sequence uint64 `json:"sequence"`
@ -328,12 +328,12 @@ func (v *Vin) MarshalJSON() ([]byte, error) {
}
txStruct := struct {
Txid string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
ScriptSig *ScriptSig `json:"scriptSig"`
Sequence uint64 `json:"sequence"`
}{
Txid: v.Txid,
TxID: v.TxID,
Vout: v.Vout,
ScriptSig: v.ScriptSig,
Sequence: v.Sequence,
@ -350,7 +350,7 @@ type PrevOut struct {
// VinPrevOut is like Vin except it includes PrevOut. It is used by searchrawtransaction
type VinPrevOut struct {
Coinbase string `json:"coinbase"`
Txid string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
ScriptSig *ScriptSig `json:"scriptSig"`
PrevOut *PrevOut `json:"prevOut"`
@ -376,13 +376,13 @@ func (v *VinPrevOut) MarshalJSON() ([]byte, error) {
}
txStruct := struct {
Txid string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
ScriptSig *ScriptSig `json:"scriptSig"`
PrevOut *PrevOut `json:"prevOut,omitempty"`
Sequence uint64 `json:"sequence"`
}{
Txid: v.Txid,
TxID: v.TxID,
Vout: v.Vout,
ScriptSig: v.ScriptSig,
PrevOut: v.PrevOut,
@ -402,16 +402,16 @@ type Vout struct {
// GetMiningInfoResult models the data from the getmininginfo command.
type GetMiningInfoResult struct {
Blocks int64 `json:"blocks"`
CurrentBlockSize uint64 `json:"currentblocksize"`
CurrentBlockTx uint64 `json:"currentblocktx"`
CurrentBlockSize uint64 `json:"currentBlockSize"`
CurrentBlockTx uint64 `json:"currentBlockTx"`
Difficulty float64 `json:"difficulty"`
Errors string `json:"errors"`
Generate bool `json:"generate"`
GenProcLimit int32 `json:"genproclimit"`
HashesPerSec int64 `json:"hashespersec"`
NetworkHashPS int64 `json:"networkhashps"`
PooledTx uint64 `json:"pooledtx"`
TestNet bool `json:"testnet"`
GenProcLimit int32 `json:"genProcLimit"`
HashesPerSec int64 `json:"hashesPerSec"`
NetworkHashPS int64 `json:"networkHashPs"`
PooledTx uint64 `json:"pooledTx"`
TestNet bool `json:"testNet"`
}
// GetWorkResult models the data from the getwork command.
@ -425,55 +425,55 @@ type GetWorkResult struct {
// InfoDAGResult models the data returned by the dag server getinfo command.
type InfoDAGResult struct {
Version int32 `json:"version"`
ProtocolVersion int32 `json:"protocolversion"`
ProtocolVersion int32 `json:"protocolVersion"`
Blocks int32 `json:"blocks"`
TimeOffset int64 `json:"timeoffset"`
TimeOffset int64 `json:"timeOffset"`
Connections int32 `json:"connections"`
Proxy string `json:"proxy"`
Difficulty float64 `json:"difficulty"`
TestNet bool `json:"testnet"`
RelayFee float64 `json:"relayfee"`
TestNet bool `json:"testNet"`
RelayFee float64 `json:"relayFee"`
Errors string `json:"errors"`
}
// TxRawResult models the data from the getrawtransaction command.
type TxRawResult struct {
Hex string `json:"hex"`
Txid string `json:"txid"`
TxID string `json:"txId"`
Hash string `json:"hash,omitempty"`
Size int32 `json:"size,omitempty"`
Version int32 `json:"version"`
LockTime uint64 `json:"locktime"`
LockTime uint64 `json:"lockTime"`
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
BlockHash string `json:"blockHash,omitempty"`
Confirmations uint64 `json:"confirmations,omitempty"`
Time uint64 `json:"time,omitempty"`
Blocktime uint64 `json:"blocktime,omitempty"`
BlockTime uint64 `json:"blockTime,omitempty"`
}
// SearchRawTransactionsResult models the data from the searchrawtransaction
// command.
type SearchRawTransactionsResult struct {
Hex string `json:"hex,omitempty"`
Txid string `json:"txid"`
TxID string `json:"txId"`
Hash string `json:"hash"`
Size string `json:"size"`
Version int32 `json:"version"`
LockTime uint64 `json:"locktime"`
LockTime uint64 `json:"lockTime"`
Vin []VinPrevOut `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
BlockHash string `json:"blockHash,omitempty"`
Confirmations uint64 `json:"confirmations,omitempty"`
Time uint64 `json:"time,omitempty"`
Blocktime uint64 `json:"blocktime,omitempty"`
Blocktime uint64 `json:"blockTime,omitempty"`
}
// TxRawDecodeResult models the data from the decoderawtransaction command.
type TxRawDecodeResult struct {
Txid string `json:"txid"`
TxID string `json:"txId"`
Version int32 `json:"version"`
Locktime uint64 `json:"locktime"`
Locktime uint64 `json:"lockTime"`
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
}
@ -481,6 +481,6 @@ type TxRawDecodeResult struct {
// ValidateAddressResult models the data returned by the dag server
// validateaddress command.
type ValidateAddressResult struct {
IsValid bool `json:"isvalid"`
IsValid bool `json:"isValid"`
Address string `json:"address,omitempty"`
}

View File

@ -33,7 +33,7 @@ func TestDAGSvrCustomResults(t *testing.T) {
{
name: "custom vin marshal without coinbase",
result: &btcjson.Vin{
Txid: "123",
TxID: "123",
Vout: 1,
ScriptSig: &btcjson.ScriptSig{
Asm: "0",
@ -41,7 +41,7 @@ func TestDAGSvrCustomResults(t *testing.T) {
},
Sequence: 4294967295,
},
expected: `{"txid":"123","vout":1,"scriptSig":{"asm":"0","hex":"00"},"sequence":4294967295}`,
expected: `{"txId":"123","vout":1,"scriptSig":{"asm":"0","hex":"00"},"sequence":4294967295}`,
},
{
name: "custom vinprevout marshal with coinbase",
@ -54,7 +54,7 @@ func TestDAGSvrCustomResults(t *testing.T) {
{
name: "custom vinprevout marshal without coinbase",
result: &btcjson.VinPrevOut{
Txid: "123",
TxID: "123",
Vout: 1,
ScriptSig: &btcjson.ScriptSig{
Asm: "0",
@ -66,7 +66,7 @@ func TestDAGSvrCustomResults(t *testing.T) {
},
Sequence: 4294967295,
},
expected: `{"txid":"123","vout":1,"scriptSig":{"asm":"0","hex":"00"},"prevOut":{"addresses":["addr1"],"value":0},"sequence":4294967295}`,
expected: `{"txId":"123","vout":1,"scriptSig":{"asm":"0","hex":"00"},"prevOut":{"addresses":["addr1"],"value":0},"sequence":4294967295}`,
},
}

View File

@ -190,7 +190,7 @@ func TestDAGSvrWsNtfns(t *testing.T) {
staticNtfn: func() interface{} {
txResult := btcjson.TxRawResult{
Hex: "001122",
Txid: "123",
TxID: "123",
Version: 1,
LockTime: 4294967295,
Vin: nil,
@ -199,11 +199,11 @@ 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",
Txid: "123",
TxID: "123",
Version: 1,
LockTime: 4294967295,
Vin: nil,

View File

@ -7,7 +7,7 @@ package btcjson
// SessionResult models the data from the session command.
type SessionResult struct {
SessionID uint64 `json:"sessionid"`
SessionID uint64 `json:"sessionId"`
}
// RescannedBlock contains the hash and all discovered transactions of a single

View File

@ -7,6 +7,7 @@ package btcjson
import (
"bytes"
"fmt"
"github.com/daglabs/btcd/util"
"reflect"
"strings"
"text/tabwriter"
@ -81,7 +82,7 @@ func reflectTypeToJSONType(xT descLookupFunc, rt reflect.Type) string {
// field name if no json tag was specified).
func resultStructHelp(xT descLookupFunc, rt reflect.Type, indentLevel int) []string {
indent := strings.Repeat(" ", indentLevel)
typeName := strings.ToLower(rt.Name())
typeName := util.ToCamelCase(rt.Name())
// Generate the help for each of the fields in the result struct.
numField := rt.NumField()
@ -95,7 +96,7 @@ func resultStructHelp(xT descLookupFunc, rt reflect.Type, indentLevel int) []str
if tag := rtf.Tag.Get("json"); tag != "" {
fieldName = strings.Split(tag, ",")[0]
} else {
fieldName = strings.ToLower(rtf.Name)
fieldName = util.ToCamelCase(rtf.Name)
}
// Deference pointer if needed.
@ -344,7 +345,7 @@ func argHelp(xT descLookupFunc, rtp reflect.Type, defaults map[int]reflect.Value
defaultVal = &defVal
}
fieldName := strings.ToLower(rtf.Name)
fieldName := util.ToCamelCase(rtf.Name)
helpText := fmt.Sprintf("%d.\t%s\t(%s)\t%s", i+1, fieldName,
argTypeHelp(xT, rtf, defaultVal),
xT(method+"-"+fieldName))

View File

@ -354,7 +354,7 @@ func TestResultStructHelp(t *testing.T) {
expected: []string{
"\"field\": {\t(json-type-object)\ts-field",
"{",
" \"subfield\": n,\t(json-type-numeric)\ts2-subfield",
" \"subField\": n,\t(json-type-numeric)\ts2-subField",
"}\t\t",
},
},
@ -372,7 +372,7 @@ func TestResultStructHelp(t *testing.T) {
expected: []string{
"\"field\": {\t(json-type-object)\ts-field",
"{",
" \"subfield\": n,\t(json-type-numeric)\ts2-subfield",
" \"subField\": n,\t(json-type-numeric)\ts2-subField",
"}\t\t",
},
},
@ -390,7 +390,7 @@ func TestResultStructHelp(t *testing.T) {
expected: []string{
"\"field\": [{\t(json-type-arrayjson-type-object)\ts-field",
"[{",
" \"subfield\": n,\t(json-type-numeric)\ts2-subfield",
" \"subField\": n,\t(json-type-numeric)\ts2-subField",
"},...]",
},
},

View File

@ -67,7 +67,7 @@ func IsValidIDType(id interface{}) bool {
// requests, however this struct it being exported in case the caller wants to
// construct raw requests for some reason.
type Request struct {
Jsonrpc string `json:"jsonrpc"`
JsonRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params []json.RawMessage `json:"params"`
ID interface{} `json:"id"`
@ -98,7 +98,7 @@ func NewRequest(id interface{}, method string, params []interface{}) (*Request,
}
return &Request{
Jsonrpc: "1.0",
JsonRPC: "1.0",
ID: id,
Method: method,
Params: rawParams,

View File

@ -221,7 +221,7 @@ func NewGetReceivedByAddressCmd(address string, minConf *int) *GetReceivedByAddr
// GetTransactionCmd defines the getTransaction JSON-RPC command.
type GetTransactionCmd struct {
Txid string
TxID string
IncludeWatchOnly *bool `jsonrpcdefault:"false"`
}
@ -232,7 +232,7 @@ type GetTransactionCmd struct {
// for optional parameters will use the default value.
func NewGetTransactionCmd(txHash string, includeWatchOnly *bool) *GetTransactionCmd {
return &GetTransactionCmd{
Txid: txHash,
TxID: txHash,
IncludeWatchOnly: includeWatchOnly,
}
}
@ -573,7 +573,7 @@ func NewSignMessageCmd(address, message string) *SignMessageCmd {
// RawTxInput models the data needed for raw transaction input that is used in
// the SignRawTransactionCmd struct.
type RawTxInput struct {
Txid string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
ScriptPubKey string `json:"scriptPubKey"`
RedeemScript string `json:"redeemScript"`

View File

@ -327,7 +327,7 @@ func TestWalletSvrCmds(t *testing.T) {
},
marshalled: `{"jsonrpc":"1.0","method":"getTransaction","params":["123"],"id":1}`,
unmarshalled: &btcjson.GetTransactionCmd{
Txid: "123",
TxID: "123",
IncludeWatchOnly: btcjson.Bool(false),
},
},
@ -341,7 +341,7 @@ func TestWalletSvrCmds(t *testing.T) {
},
marshalled: `{"jsonrpc":"1.0","method":"getTransaction","params":["123",true],"id":1}`,
unmarshalled: &btcjson.GetTransactionCmd{
Txid: "123",
TxID: "123",
IncludeWatchOnly: btcjson.Bool(true),
},
},
@ -801,19 +801,19 @@ func TestWalletSvrCmds(t *testing.T) {
{
name: "lockUnspent",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("lockUnspent", true, `[{"txid":"123","vout":1}]`)
return btcjson.NewCmd("lockUnspent", true, `[{"txId":"123","vout":1}]`)
},
staticCmd: func() interface{} {
txInputs := []btcjson.TransactionInput{
{Txid: "123", Vout: 1},
{TxID: "123", Vout: 1},
}
return btcjson.NewLockUnspentCmd(true, txInputs)
},
marshalled: `{"jsonrpc":"1.0","method":"lockUnspent","params":[true,[{"txid":"123","vout":1}]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"lockUnspent","params":[true,[{"txId":"123","vout":1}]],"id":1}`,
unmarshalled: &btcjson.LockUnspentCmd{
Unlock: true,
Transactions: []btcjson.TransactionInput{
{Txid: "123", Vout: 1},
{TxID: "123", Vout: 1},
},
},
},
@ -1086,12 +1086,12 @@ func TestWalletSvrCmds(t *testing.T) {
{
name: "signRawTransaction optional1",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("signRawTransaction", "001122", `[{"txid":"123","vout":1,"scriptPubKey":"00","redeemScript":"01"}]`)
return btcjson.NewCmd("signRawTransaction", "001122", `[{"txId":"123","vout":1,"scriptPubKey":"00","redeemScript":"01"}]`)
},
staticCmd: func() interface{} {
txInputs := []btcjson.RawTxInput{
{
Txid: "123",
TxID: "123",
Vout: 1,
ScriptPubKey: "00",
RedeemScript: "01",
@ -1100,12 +1100,12 @@ func TestWalletSvrCmds(t *testing.T) {
return btcjson.NewSignRawTransactionCmd("001122", &txInputs, nil, nil)
},
marshalled: `{"jsonrpc":"1.0","method":"signRawTransaction","params":["001122",[{"txid":"123","vout":1,"scriptPubKey":"00","redeemScript":"01"}]],"id":1}`,
marshalled: `{"jsonrpc":"1.0","method":"signRawTransaction","params":["001122",[{"txId":"123","vout":1,"scriptPubKey":"00","redeemScript":"01"}]],"id":1}`,
unmarshalled: &btcjson.SignRawTransactionCmd{
RawTx: "001122",
Inputs: &[]btcjson.RawTxInput{
{
Txid: "123",
TxID: "123",
Vout: 1,
ScriptPubKey: "00",
RedeemScript: "01",

View File

@ -14,7 +14,7 @@ type GetTransactionDetailsResult struct {
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
Category string `json:"category"`
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
InvolvesWatchOnly bool `json:"involvesWatchOnly,omitempty"`
Fee *float64 `json:"fee,omitempty"`
Vout uint32 `json:"vout"`
}
@ -24,13 +24,13 @@ type GetTransactionResult struct {
Amount float64 `json:"amount"`
Fee float64 `json:"fee,omitempty"`
Confirmations int64 `json:"confirmations"`
BlockHash string `json:"blockhash"`
BlockIndex int64 `json:"blockindex"`
BlockTime uint64 `json:"blocktime"`
TxID string `json:"txid"`
WalletConflicts []string `json:"walletconflicts"`
BlockHash string `json:"blockHash"`
BlockIndex int64 `json:"blockIndex"`
BlockTime uint64 `json:"blockTime"`
TxID string `json:"txId"`
WalletConflicts []string `json:"walletConflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
TimeReceived int64 `json:"timeReceived"`
Details []GetTransactionDetailsResult `json:"details"`
Hex string `json:"hex"`
}
@ -39,20 +39,20 @@ type GetTransactionResult struct {
// command.
type InfoWalletResult struct {
Version int32 `json:"version"`
ProtocolVersion int32 `json:"protocolversion"`
WalletVersion int32 `json:"walletversion"`
ProtocolVersion int32 `json:"protocolVersion"`
WalletVersion int32 `json:"walletVersion"`
Balance float64 `json:"balance"`
Blocks int32 `json:"blocks"`
TimeOffset int64 `json:"timeoffset"`
TimeOffset int64 `json:"timeOffset"`
Connections int32 `json:"connections"`
Proxy string `json:"proxy"`
Difficulty float64 `json:"difficulty"`
TestNet bool `json:"testnet"`
KeypoolOldest int64 `json:"keypoololdest"`
KeypoolSize int32 `json:"keypoolsize"`
UnlockedUntil int64 `json:"unlocked_until"`
PaytxFee float64 `json:"paytxfee"`
RelayFee float64 `json:"relayfee"`
TestNet bool `json:"testNet"`
KeypoolOldest int64 `json:"keypoolOldest"`
KeypoolSize int32 `json:"keypoolSize"`
UnlockedUntil int64 `json:"unlockedUntil"`
PayTxFee float64 `json:"payTxFee"`
RelayFee float64 `json:"relayFee"`
Errors string `json:"errors"`
}
@ -62,23 +62,23 @@ type ListTransactionsResult struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
BIP125Replaceable string `json:"bip125-replaceable,omitempty"`
BlockHash string `json:"blockhash,omitempty"`
BlockIndex *int64 `json:"blockindex,omitempty"`
BlockTime uint64 `json:"blocktime,omitempty"`
BIP125Replaceable string `json:"bip125Replaceable,omitempty"`
BlockHash string `json:"blockGash,omitempty"`
BlockIndex *int64 `json:"blockIndex,omitempty"`
BlockTime uint64 `json:"blockTime,omitempty"`
Category string `json:"category"`
Confirmations int64 `json:"confirmations"`
Fee *float64 `json:"fee,omitempty"`
Generated bool `json:"generated,omitempty"`
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
InvolvesWatchOnly bool `json:"involvesWatchOnly,omitempty"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
TimeReceived int64 `json:"timeReceived"`
Trusted bool `json:"trusted"`
TxID string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
WalletConflicts []string `json:"walletconflicts"`
WalletConflicts []string `json:"walletConflicts"`
Comment string `json:"comment,omitempty"`
OtherAccount string `json:"otheraccount,omitempty"`
OtherAccount string `json:"otherAccount,omitempty"`
}
// ListReceivedByAccountResult models the data from the listreceivedbyaccount
@ -96,19 +96,19 @@ type ListReceivedByAddressResult struct {
Address string `json:"address"`
Amount float64 `json:"amount"`
Confirmations uint64 `json:"confirmations"`
TxIDs []string `json:"txids,omitempty"`
InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"`
TxIDs []string `json:"txIds,omitempty"`
InvolvesWatchOnly bool `json:"involvesWatchOnly,omitempty"`
}
// ListSinceBlockResult models the data from the listsinceblock command.
type ListSinceBlockResult struct {
Transactions []ListTransactionsResult `json:"transactions"`
LastBlock string `json:"lastblock"`
LastBlock string `json:"lastBlock"`
}
// ListUnspentResult models a successful response from the listunspent request.
type ListUnspentResult struct {
TxID string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
Address string `json:"address"`
Account string `json:"account"`
@ -122,7 +122,7 @@ type ListUnspentResult struct {
// SignRawTransactionError models the data that contains script verification
// errors from the signrawtransaction request.
type SignRawTransactionError struct {
TxID string `json:"txid"`
TxID string `json:"txId"`
Vout uint32 `json:"vout"`
ScriptSig string `json:"scriptSig"`
Sequence uint64 `json:"sequence"`
@ -140,18 +140,18 @@ type SignRawTransactionResult struct {
// ValidateAddressWalletResult models the data returned by the wallet server
// validateaddress command.
type ValidateAddressWalletResult struct {
IsValid bool `json:"isvalid"`
IsValid bool `json:"isValid"`
Address string `json:"address,omitempty"`
IsMine bool `json:"ismine,omitempty"`
IsWatchOnly bool `json:"iswatchonly,omitempty"`
IsScript bool `json:"isscript,omitempty"`
PubKey string `json:"pubkey,omitempty"`
IsCompressed bool `json:"iscompressed,omitempty"`
IsMine bool `json:"isMine,omitempty"`
IsWatchOnly bool `json:"isWatchOnly,omitempty"`
IsScript bool `json:"isScript,omitempty"`
PubKey string `json:"pubKey,omitempty"`
IsCompressed bool `json:"isCompressed,omitempty"`
Account string `json:"account,omitempty"`
Addresses []string `json:"addresses,omitempty"`
Hex string `json:"hex,omitempty"`
Script string `json:"script,omitempty"`
SigsRequired int32 `json:"sigsrequired,omitempty"`
SigsRequired int32 `json:"sigsRequired,omitempty"`
}
// GetBestBlockResult models the data from the getbestblock command.

View File

@ -72,7 +72,7 @@ func TestWalletSvrWsNtfns(t *testing.T) {
{
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,"bip125Replaceable":"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,"bip125Replaceable":"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

@ -30,7 +30,7 @@ import (
"github.com/daglabs/btcd/util/network"
"github.com/daglabs/btcd/version"
"github.com/daglabs/btcd/wire"
flags "github.com/jessevdk/go-flags"
"github.com/jessevdk/go-flags"
)
const (
@ -64,13 +64,15 @@ const (
)
var (
defaultHomeDir = util.AppDataDir("btcd", false)
defaultConfigFile = filepath.Join(defaultHomeDir, defaultConfigFilename)
defaultDataDir = filepath.Join(defaultHomeDir, defaultDataDirname)
// DefaultHomeDir is the default home directory for BTCD.
DefaultHomeDir = util.AppDataDir("btcd", false)
defaultConfigFile = filepath.Join(DefaultHomeDir, defaultConfigFilename)
defaultDataDir = filepath.Join(DefaultHomeDir, defaultDataDirname)
knownDbTypes = database.SupportedDrivers()
defaultRPCKeyFile = filepath.Join(defaultHomeDir, "rpc.key")
defaultRPCCertFile = filepath.Join(defaultHomeDir, "rpc.cert")
defaultLogDir = filepath.Join(defaultHomeDir, defaultLogDirname)
defaultRPCKeyFile = filepath.Join(DefaultHomeDir, "rpc.key")
defaultRPCCertFile = filepath.Join(DefaultHomeDir, "rpc.cert")
defaultLogDir = filepath.Join(DefaultHomeDir, defaultLogDirname)
)
// activeNetParams is a pointer to the parameters specific to the
@ -190,7 +192,7 @@ type serviceOptions struct {
func cleanAndExpandPath(path string) string {
// Expand initial ~ to OS specific home directory.
if strings.HasPrefix(path, "~") {
homeDir := filepath.Dir(defaultHomeDir)
homeDir := filepath.Dir(DefaultHomeDir)
path = strings.Replace(path, "~", homeDir, 1)
}
@ -404,7 +406,7 @@ func loadConfig() (*Config, []string, error) {
// Create the home directory if it doesn't already exist.
funcName := "loadConfig"
err = os.MkdirAll(defaultHomeDir, 0700)
err = os.MkdirAll(DefaultHomeDir, 0700)
if err != nil {
// Show a nicer error message if it's because a symlink is
// linked to a directory that does not exist (probably because

View File

@ -44,7 +44,7 @@ func (c *Client) RawRequestAsync(method string, params []json.RawMessage) Future
// than custom commands.
id := c.NextID()
rawRequest := &btcjson.Request{
Jsonrpc: "1.0",
JsonRPC: "1.0",
ID: id,
Method: method,
Params: params,

View File

@ -335,7 +335,7 @@ func (c *Client) LockUnspentAsync(unlock bool, ops []*wire.OutPoint) FutureLockU
outputs := make([]btcjson.TransactionInput, len(ops))
for i, op := range ops {
outputs[i] = btcjson.TransactionInput{
Txid: op.Hash.String(),
TxID: op.Hash.String(),
Vout: op.Index,
}
}
@ -386,7 +386,7 @@ func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error) {
// Create a slice of outpoints from the transaction input structs.
ops := make([]*wire.OutPoint, len(inputs))
for i, input := range inputs {
sha, err := daghash.NewHashFromStr(input.Txid)
sha, err := daghash.NewHashFromStr(input.TxID)
if err != nil {
return nil, err
}

View File

@ -545,9 +545,9 @@ func handleCreateRawTransaction(s *Server, cmd interface{}, closeChan <-chan str
// some validity checks.
mtx := wire.NewMsgTx(wire.TxVersion)
for _, input := range c.Inputs {
txHash, err := daghash.NewHashFromStr(input.Txid)
txHash, err := daghash.NewHashFromStr(input.TxID)
if err != nil {
return nil, rpcDecodeHexError(input.Txid)
return nil, rpcDecodeHexError(input.TxID)
}
prevOut := wire.NewOutPoint(txHash, input.Vout)
@ -673,7 +673,7 @@ func createVinList(mtx *wire.MsgTx) []btcjson.Vin {
disbuf, _ := txscript.DisasmString(txIn.SignatureScript)
vinEntry := &vinList[i]
vinEntry.Txid = txIn.PreviousOutPoint.Hash.String()
vinEntry.TxID = txIn.PreviousOutPoint.Hash.String()
vinEntry.Vout = txIn.PreviousOutPoint.Index
vinEntry.Sequence = txIn.Sequence
vinEntry.ScriptSig = &btcjson.ScriptSig{
@ -750,7 +750,7 @@ func createTxRawResult(chainParams *dagconfig.Params, mtx *wire.MsgTx,
txReply := &btcjson.TxRawResult{
Hex: mtxHex,
Txid: txHash,
TxID: txHash,
Hash: mtx.TxHash().String(),
Size: int32(mtx.SerializeSize()),
Vin: createVinList(mtx),
@ -762,7 +762,7 @@ func createTxRawResult(chainParams *dagconfig.Params, mtx *wire.MsgTx,
if blkHeader != nil {
// This is not a typo, they are identical in bitcoind as well.
txReply.Time = uint64(blkHeader.Timestamp.Unix())
txReply.Blocktime = uint64(blkHeader.Timestamp.Unix())
txReply.BlockTime = uint64(blkHeader.Timestamp.Unix())
txReply.BlockHash = blkHash
txReply.Confirmations = uint64(1 + chainHeight - blkHeight)
}
@ -794,7 +794,7 @@ func handleDecodeRawTransaction(s *Server, cmd interface{}, closeChan <-chan str
// Create and return the result.
txReply := btcjson.TxRawDecodeResult{
Txid: mtx.TxHash().String(),
TxID: mtx.TxHash().String(),
Version: mtx.Version,
Locktime: mtx.LockTime,
Vin: createVinList(&mtx),
@ -2415,9 +2415,9 @@ func handleGetRawTransaction(s *Server, cmd interface{}, closeChan <-chan struct
c := cmd.(*btcjson.GetRawTransactionCmd)
// Convert the provided transaction hash hex to a Hash.
txHash, err := daghash.NewHashFromStr(c.Txid)
txHash, err := daghash.NewHashFromStr(c.TxID)
if err != nil {
return nil, rpcDecodeHexError(c.Txid)
return nil, rpcDecodeHexError(c.TxID)
}
verbose := false
@ -2534,9 +2534,9 @@ func handleGetTxOut(s *Server, cmd interface{}, closeChan <-chan struct{}) (inte
c := cmd.(*btcjson.GetTxOutCmd)
// Convert the provided transaction hash hex to a Hash.
txHash, err := daghash.NewHashFromStr(c.Txid)
txHash, err := daghash.NewHashFromStr(c.TxID)
if err != nil {
return nil, rpcDecodeHexError(c.Txid)
return nil, rpcDecodeHexError(c.TxID)
}
// If requested and the tx is available in the mempool try to fetch it
@ -2808,7 +2808,7 @@ func createVinListPrevOut(s *Server, mtx *wire.MsgTx, chainParams *dagconfig.Par
// requested and available.
prevOut := &txIn.PreviousOutPoint
vinEntry := btcjson.VinPrevOut{
Txid: prevOut.Hash.String(),
TxID: prevOut.Hash.String(),
Vout: prevOut.Index,
Sequence: txIn.Sequence,
ScriptSig: &btcjson.ScriptSig{
@ -3112,7 +3112,7 @@ func handleSearchRawTransactions(s *Server, cmd interface{}, closeChan <-chan st
result := &srtList[i]
result.Hex = hexTxns[i]
result.Txid = mtx.TxHash().String()
result.TxID = mtx.TxHash().String()
result.Vin, err = createVinListPrevOut(s, mtx, params, vinExtra,
filterAddrMap)
if err != nil {
@ -3822,7 +3822,7 @@ func (s *Server) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin boo
//
// RPC quirks can be enabled by the user to avoid compatibility issues
// with software relying on Core's behavior.
if request.ID == nil && !(config.MainConfig().RPCQuirks && request.Jsonrpc == "") {
if request.ID == nil && !(config.MainConfig().RPCQuirks && request.JsonRPC == "") {
return
}

View File

@ -23,7 +23,7 @@ var helpDescsEnUS = map[string]string{
"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-levelSpec": "The debug level(s) to use or the keyword 'show'",
"debugLevel--condition0": "levelspec!=show",
"debugLevel--condition1": "levelspec=show",
"debugLevel--result0": "The string 'Done.'",
@ -32,17 +32,17 @@ var helpDescsEnUS = map[string]string{
// 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-oneTry": "When enabled, will try a single connection to a peer",
// NodeCmd help.
"node--synopsis": "Attempts to add or remove a peer.",
"node-subcmd": "'disconnect' to remove all matching non-persistent peers, 'remove' to remove a persistent peer, or 'connect' to connect to a peer",
"node-subCmd": "'disconnect' to remove all matching non-persistent peers, 'remove' to remove a persistent peer, or 'connect' to connect to a peer",
"node-target": "Either the IP address and port of the peer to operate on, or a valid peer ID.",
"node-connectsubcmd": "'perm' to make the connected peer a permanent one, 'temp' to try a single connect to a peer",
"node-connectSubCmd": "'perm' to make the connected peer a permanent one, 'temp' to try a single connect to a peer",
// TransactionInput help.
"transactioninput-txid": "The hash of the input transaction",
"transactioninput-vout": "The specific output of the input transaction to redeem",
"transactionInput-txId": "The hash of the input transaction",
"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" +
@ -53,38 +53,38 @@ var helpDescsEnUS = map[string]string{
"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-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",
"scriptsig-hex": "Hex-encoded bytes of the script",
"scriptSig-asm": "Disassembly of the script",
"scriptSig-hex": "Hex-encoded bytes of the script",
// PrevOut help.
"prevout-addresses": "previous output addresses",
"prevout-value": "previous output value",
"prevOut-addresses": "previous output addresses",
"prevOut-value": "previous output value",
// VinPrevOut help.
"vinprevout-coinbase": "The hex-encoded bytes of the signature script (coinbase txns only)",
"vinprevout-txid": "The hash of the origin transaction (non-coinbase txns only)",
"vinprevout-vout": "The index of the output being redeemed from the origin transaction (non-coinbase txns only)",
"vinprevout-scriptSig": "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)",
"vinprevout-prevOut": "Data from the origin transaction output with index vout.",
"vinprevout-sequence": "The script sequence number",
"vinPrevOut-coinbase": "The hex-encoded bytes of the signature script (coinbase txns only)",
"vinPrevOut-txId": "The hash of the origin transaction (non-coinbase txns only)",
"vinPrevOut-vout": "The index of the output being redeemed from the origin transaction (non-coinbase txns only)",
"vinPrevOut-scriptSig": "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)",
"vinPrevOut-prevOut": "Data from the origin transaction output with index vout.",
"vinPrevOut-sequence": "The script sequence number",
// Vin help.
"vin-coinbase": "The hex-encoded bytes of the signature script (coinbase txns only)",
"vin-txid": "The hash of the origin transaction (non-coinbase txns only)",
"vin-txId": "The hash of the origin transaction (non-coinbase txns only)",
"vin-vout": "The index of the output being redeemed from the origin transaction (non-coinbase txns only)",
"vin-scriptSig": "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)",
"vin-sequence": "The script sequence number",
// ScriptPubKeyResult help.
"scriptpubkeyresult-asm": "Disassembly of the script",
"scriptpubkeyresult-hex": "Hex-encoded bytes of the script",
"scriptpubkeyresult-type": "The type of the script (e.g. 'pubkeyhash')",
"scriptpubkeyresult-reqSigs": "The number of required signatures",
"scriptpubkeyresult-addresses": "The bitcoin addresses associated with this script",
"scriptPubKeyResult-asm": "Disassembly of the script",
"scriptPubKeyResult-hex": "Hex-encoded bytes of the script",
"scriptPubKeyResult-type": "The type of the script (e.g. 'pubkeyhash')",
"scriptPubKeyResult-reqSigs": "The number of required signatures",
"scriptPubKeyResult-addresses": "The bitcoin addresses associated with this script",
// Vout help.
"vout-value": "The amount in BTC",
@ -92,32 +92,32 @@ var helpDescsEnUS = map[string]string{
"vout-scriptPubKey": "The public key script used to pay coins as a JSON object",
// TxRawDecodeResult help.
"txrawdecoderesult-txid": "The hash of the transaction",
"txrawdecoderesult-version": "The transaction version",
"txrawdecoderesult-locktime": "The transaction lock time",
"txrawdecoderesult-vin": "The transaction inputs as JSON objects",
"txrawdecoderesult-vout": "The transaction outputs as JSON objects",
"txRawDecodeResult-txId": "The hash of the transaction",
"txRawDecodeResult-version": "The transaction version",
"txRawDecodeResult-lockTime": "The transaction lock time",
"txRawDecodeResult-vin": "The transaction inputs as JSON objects",
"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-hexTx": "Serialized, hex-encoded transaction",
// DecodeScriptResult help.
"decodescriptresult-asm": "Disassembly of the script",
"decodescriptresult-type": "The type of the script (e.g. 'pubkeyhash')",
"decodescriptresult-reqSigs": "The number of required signatures",
"decodescriptresult-addresses": "The bitcoin addresses associated with this script",
"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)",
"decodeScriptResult-asm": "Disassembly of the script",
"decodeScriptResult-type": "The type of the script (e.g. 'pubkeyhash')",
"decodeScriptResult-reqSigs": "The number of required signatures",
"decodeScriptResult-addresses": "The bitcoin addresses associated with this script",
"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-hexScript": "Hex-encoded script",
// EstimateFeeCmd help.
"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 " +
"be mined in the next NumBlocks blocks.",
@ -125,7 +125,7 @@ var helpDescsEnUS = map[string]string{
// GenerateCmd help
"generate--synopsis": "Generates a set number of blocks (simnet or regtest only) and returns a JSON\n" +
" array of their hashes.",
"generate-numblocks": "Number of blocks to generate",
"generate-numBlocks": "Number of blocks to generate",
"generate--result0": "The hashes, in order, of blocks generated by the call",
// GetAllManualNodesInfoCmd help.
@ -136,13 +136,13 @@ var helpDescsEnUS = map[string]string{
"getAllManualNodesInfo--result0": "List of added peers",
// GetManualNodeInfoResultAddr help.
"getmanualnodeinforesultaddr-address": "The ip address for this DNS entry",
"getmanualnodeinforesultaddr-connected": "The connection 'direction' (inbound/outbound/false)",
"getManualNodeInfoResultAddr-address": "The ip address for this DNS entry",
"getManualNodeInfoResultAddr-connected": "The connection 'direction' (inbound/outbound/false)",
// GetManualNodeInfoResult help.
"getmanualnodeinforesult-manualnode": "The ip address or domain of the manually added peer",
"getmanualnodeinforesult-connected": "Whether or not the peer is currently connected",
"getmanualnodeinforesult-addresses": "DNS lookup and connection information about the peer",
"getManualNodeInfoResult-manualNode": "The ip address or domain of the manually added peer",
"getManualNodeInfoResult-connected": "Whether or not the peer is currently connected",
"getManualNodeInfoResult-addresses": "DNS lookup and connection information about the peer",
// GetManualNodeInfoCmd help.
"getManualNodeInfo--synopsis": "Returns information about manually added (persistent) peers.",
@ -153,8 +153,8 @@ var helpDescsEnUS = map[string]string{
"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",
"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.",
@ -168,7 +168,7 @@ var helpDescsEnUS = map[string]string{
"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-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",
@ -177,72 +177,72 @@ var helpDescsEnUS = map[string]string{
"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)",
"getblockdaginforesult-blocks": "The number of blocks in the best known chain",
"getblockdaginforesult-headers": "The number of headers that we've gathered for in the best known chain",
"getblockdaginforesult-tiphashes": "The block hashes for the tips in the DAG",
"getblockdaginforesult-difficulty": "The current chain difficulty",
"getblockdaginforesult-mediantime": "The median time from the PoV of the best block in the chain",
"getblockdaginforesult-verificationprogress": "An estimate for how much of the best chain we've verified",
"getblockdaginforesult-pruned": "A bool that indicates if the node is pruned or not",
"getblockdaginforesult-pruneheight": "The lowest block retained in the current pruned chain",
"getblockdaginforesult-dagwork": "The total cumulative work in the DAG",
"getblockdaginforesult-softforks": "The status of the super-majority soft-forks",
"getblockdaginforesult-bip9_softforks": "JSON object describing active BIP0009 deployments",
"getblockdaginforesult-bip9_softforks--key": "bip9_softforks",
"getblockdaginforesult-bip9_softforks--value": "An object describing a particular BIP009 deployment",
"getblockdaginforesult-bip9_softforks--desc": "The status of any defined BIP0009 soft-fork deployments",
"getBlockDagInfoResult-dag": "The name of the DAG the daemon is on (testnet, mainnet, etc)",
"getBlockDagInfoResult-blocks": "The number of blocks in the best known chain",
"getBlockDagInfoResult-headers": "The number of headers that we've gathered for in the best known chain",
"getBlockDagInfoResult-tipHashes": "The block hashes for the tips in the DAG",
"getBlockDagInfoResult-difficulty": "The current chain difficulty",
"getBlockDagInfoResult-medianTime": "The median time from the PoV of the best block in the chain",
"getBlockDagInfoResult-verificationProgress": "An estimate for how much of the best chain we've verified",
"getBlockDagInfoResult-pruned": "A bool that indicates if the node is pruned or not",
"getBlockDagInfoResult-pruneHeight": "The lowest block retained in the current pruned chain",
"getBlockDagInfoResult-dagWork": "The total cumulative work in the DAG",
"getBlockDagInfoResult-softForks": "The status of the super-majority soft-forks",
"getBlockDagInfoResult-bip9SoftForks": "JSON object describing active BIP0009 deployments",
"getBlockDagInfoResult-bip9SoftForks--key": "bip9_softforks",
"getBlockDagInfoResult-bip9SoftForks--value": "An object describing a particular BIP009 deployment",
"getBlockDagInfoResult-bip9SoftForks--desc": "The status of any defined BIP0009 soft-fork deployments",
// SoftForkDescription help.
"softforkdescription-reject": "The current activation status of the softfork",
"softforkdescription-version": "The block version that signals enforcement of this softfork",
"softforkdescription-id": "The string identifier for the soft fork",
"softForkDescription-reject": "The current activation status of the softfork",
"softForkDescription-version": "The block version that signals enforcement of this softfork",
"softForkDescription-id": "The string identifier for the soft fork",
"-status": "A bool which indicates if the soft fork is active",
// TxRawResult help.
"txrawresult-hex": "Hex-encoded transaction",
"txrawresult-txid": "The hash of the transaction",
"txrawresult-version": "The transaction version",
"txrawresult-locktime": "The transaction lock time",
"txrawresult-vin": "The transaction inputs as JSON objects",
"txrawresult-vout": "The transaction outputs as JSON objects",
"txrawresult-blockhash": "Hash of the block the transaction is part of",
"txrawresult-confirmations": "Number of confirmations of the block",
"txrawresult-time": "Transaction time in seconds since 1 Jan 1970 GMT",
"txrawresult-blocktime": "Block time in seconds since the 1 Jan 1970 GMT",
"txrawresult-size": "The size of the transaction in bytes",
"txrawresult-hash": "The wtxid of the transaction",
"txRawResult-hex": "Hex-encoded transaction",
"txRawResult-txId": "The hash of the transaction",
"txRawResult-version": "The transaction version",
"txRawResult-lockTime": "The transaction lock time",
"txRawResult-vin": "The transaction inputs as JSON objects",
"txRawResult-vout": "The transaction outputs as JSON objects",
"txRawResult-blockHash": "Hash of the block the transaction is part of",
"txRawResult-confirmations": "Number of confirmations of the block",
"txRawResult-time": "Transaction time in seconds since 1 Jan 1970 GMT",
"txRawResult-blockTime": "Block time in seconds since the 1 Jan 1970 GMT",
"txRawResult-size": "The size of the transaction in bytes",
"txRawResult-hash": "The wtxid of the transaction",
// SearchRawTransactionsResult help.
"searchrawtransactionsresult-hex": "Hex-encoded transaction",
"searchrawtransactionsresult-txid": "The hash of the transaction",
"searchrawtransactionsresult-hash": "The wxtid of the transaction",
"searchrawtransactionsresult-version": "The transaction version",
"searchrawtransactionsresult-locktime": "The transaction lock time",
"searchrawtransactionsresult-vin": "The transaction inputs as JSON objects",
"searchrawtransactionsresult-vout": "The transaction outputs as JSON objects",
"searchrawtransactionsresult-blockhash": "Hash of the block the transaction is part of",
"searchrawtransactionsresult-confirmations": "Number of confirmations of the block",
"searchrawtransactionsresult-time": "Transaction time in seconds since 1 Jan 1970 GMT",
"searchrawtransactionsresult-blocktime": "Block time in seconds since the 1 Jan 1970 GMT",
"searchrawtransactionsresult-size": "The size of the transaction in bytes",
"searchRawTransactionsResult-hex": "Hex-encoded transaction",
"searchRawTransactionsResult-txId": "The hash of the transaction",
"searchRawTransactionsResult-hash": "The wxtid of the transaction",
"searchRawTransactionsResult-version": "The transaction version",
"searchRawTransactionsResult-lockTime": "The transaction lock time",
"searchRawTransactionsResult-vin": "The transaction inputs as JSON objects",
"searchRawTransactionsResult-vout": "The transaction outputs as JSON objects",
"searchRawTransactionsResult-blockHash": "Hash of the block the transaction is part of",
"searchRawTransactionsResult-confirmations": "Number of confirmations of the block",
"searchRawTransactionsResult-time": "Transaction time in seconds since 1 Jan 1970 GMT",
"searchRawTransactionsResult-blockTime": "Block time in seconds since the 1 Jan 1970 GMT",
"searchRawTransactionsResult-size": "The size of the transaction in bytes",
// GetBlockVerboseResult help.
"getblockverboseresult-hash": "The hash of the block (same as provided)",
"getblockverboseresult-confirmations": "The number of confirmations",
"getblockverboseresult-size": "The size of the block",
"getblockverboseresult-height": "The height of the block in the block chain",
"getblockverboseresult-version": "The block version",
"getblockverboseresult-versionHex": "The block version in hexadecimal",
"getblockverboseresult-merkleroot": "Root hash of the merkle tree",
"getblockverboseresult-tx": "The transaction hashes (only when verbosetx=false)",
"getblockverboseresult-rawtx": "The transactions as JSON objects (only when verbosetx=true)",
"getblockverboseresult-time": "The block time in seconds since 1 Jan 1970 GMT",
"getblockverboseresult-nonce": "The block nonce",
"getblockverboseresult-bits": "The bits which represent the block difficulty",
"getblockverboseresult-difficulty": "The proof-of-work difficulty as a multiple of the minimum difficulty",
"getblockverboseresult-parentblockhashes": "The hashes of the parent blocks",
"getblockverboseresult-nextblockhashes": "The hashes of the next blocks (only if there are any)",
"getBlockVerboseResult-hash": "The hash of the block (same as provided)",
"getBlockVerboseResult-confirmations": "The number of confirmations",
"getBlockVerboseResult-size": "The size of the block",
"getBlockVerboseResult-height": "The height of the block in the block chain",
"getBlockVerboseResult-version": "The block version",
"getBlockVerboseResult-versionHex": "The block version in hexadecimal",
"getBlockVerboseResult-merkleRoot": "Root hash of the merkle tree",
"getBlockVerboseResult-tx": "The transaction hashes (only when verbosetx=false)",
"getBlockVerboseResult-rawRx": "The transactions as JSON objects (only when verbosetx=true)",
"getBlockVerboseResult-time": "The block time in seconds since 1 Jan 1970 GMT",
"getBlockVerboseResult-nonce": "The block nonce",
"getBlockVerboseResult-bits": "The bits which represent the block difficulty",
"getBlockVerboseResult-difficulty": "The proof-of-work difficulty as a multiple of the minimum difficulty",
"getBlockVerboseResult-parentHashes": "The hashes of the parent blocks",
"getBlockVerboseResult-nextHashes": "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.",
@ -262,64 +262,64 @@ var helpDescsEnUS = map[string]string{
"getBlockHeader--result0": "The block header hash",
// GetBlockHeaderVerboseResult help.
"getblockheaderverboseresult-hash": "The hash of the block (same as provided)",
"getblockheaderverboseresult-confirmations": "The number of confirmations",
"getblockheaderverboseresult-height": "The height of the block in the block chain",
"getblockheaderverboseresult-version": "The block version",
"getblockheaderverboseresult-versionHex": "The block version in hexadecimal",
"getblockheaderverboseresult-merkleroot": "Root hash of the merkle tree",
"getblockheaderverboseresult-time": "The block time in seconds since 1 Jan 1970 GMT",
"getblockheaderverboseresult-nonce": "The block nonce",
"getblockheaderverboseresult-bits": "The bits which represent the block difficulty",
"getblockheaderverboseresult-difficulty": "The proof-of-work difficulty as a multiple of the minimum difficulty",
"getblockheaderverboseresult-parentblockhashes": "The hashes of the parent blocks",
"getblockheaderverboseresult-nextblockhashes": "The hashes of the next blocks (only if there are any)",
"getBlockHeaderVerboseResult-hash": "The hash of the block (same as provided)",
"getBlockHeaderVerboseResult-confirmations": "The number of confirmations",
"getBlockHeaderVerboseResult-height": "The height of the block in the block chain",
"getBlockHeaderVerboseResult-version": "The block version",
"getBlockHeaderVerboseResult-versionHex": "The block version in hexadecimal",
"getBlockHeaderVerboseResult-merkleRoot": "Root hash of the merkle tree",
"getBlockHeaderVerboseResult-time": "The block time in seconds since 1 Jan 1970 GMT",
"getBlockHeaderVerboseResult-nonce": "The block nonce",
"getBlockHeaderVerboseResult-bits": "The bits which represent the block difficulty",
"getBlockHeaderVerboseResult-difficulty": "The proof-of-work difficulty as a multiple of the minimum difficulty",
"getBlockHeaderVerboseResult-parentHashes": "The hashes of the parent blocks",
"getBlockHeaderVerboseResult-nextHashes": "The hashes of the next blocks (only if there are any)",
// TemplateRequest help.
"templaterequest-mode": "This is 'template', 'proposal', or omitted",
"templaterequest-capabilities": "List of capabilities",
"templaterequest-longpollid": "The long poll ID of a job to monitor for expiration; required and valid only for long poll requests ",
"templaterequest-sigoplimit": "Number of signature operations allowed in blocks (this parameter is ignored)",
"templaterequest-sizelimit": "Number of bytes allowed in blocks (this parameter is ignored)",
"templaterequest-maxversion": "Highest supported block version number (this parameter is ignored)",
"templaterequest-target": "The desired target for the block template (this parameter is ignored)",
"templaterequest-data": "Hex-encoded block data (only for mode=proposal)",
"templaterequest-workid": "The server provided workid if provided in block template (not applicable)",
"templateRequest-mode": "This is 'template', 'proposal', or omitted",
"templateRequest-capabilities": "List of capabilities",
"templateRequest-longPollId": "The long poll ID of a job to monitor for expiration; required and valid only for long poll requests ",
"templateRequest-sigOpLimit": "Number of signature operations allowed in blocks (this parameter is ignored)",
"templateRequest-sizeLimit": "Number of bytes allowed in blocks (this parameter is ignored)",
"templateRequest-maxVersion": "Highest supported block version number (this parameter is ignored)",
"templateRequest-target": "The desired target for the block template (this parameter is ignored)",
"templateRequest-data": "Hex-encoded block data (only for mode=proposal)",
"templateRequest-workId": "The server provided workid if provided in block template (not applicable)",
// GetBlockTemplateResultTx help.
"getblocktemplateresulttx-data": "Hex-encoded transaction data (byte-for-byte)",
"getblocktemplateresulttx-hash": "Hex-encoded transaction hash (little endian if treated as a 256-bit number)",
"getblocktemplateresulttx-depends": "Other transactions before this one (by 1-based index in the 'transactions' list) that must be present in the final block if this one is",
"getblocktemplateresulttx-fee": "Difference in value between transaction inputs and outputs (in Satoshi)",
"getblocktemplateresulttx-sigops": "Total number of signature operations as counted for purposes of block limits",
"getBlockTemplateResultTx-data": "Hex-encoded transaction data (byte-for-byte)",
"getBlockTemplateResultTx-hash": "Hex-encoded transaction hash (little endian if treated as a 256-bit number)",
"getBlockTemplateResultTx-depends": "Other transactions before this one (by 1-based index in the 'transactions' list) that must be present in the final block if this one is",
"getBlockTemplateResultTx-fee": "Difference in value between transaction inputs and outputs (in Satoshi)",
"getBlockTemplateResultTx-sigOps": "Total number of signature operations as counted for purposes of block limits",
// GetBlockTemplateResultAux help.
"getblocktemplateresultaux-flags": "Hex-encoded byte-for-byte data to include in the coinbase signature script",
"getBlockTemplateResultAux-flags": "Hex-encoded byte-for-byte data to include in the coinbase signature script",
// GetBlockTemplateResult help.
"getblocktemplateresult-bits": "Hex-encoded compressed difficulty",
"getblocktemplateresult-curtime": "Current time as seen by the server (recommended for block time); must fall within mintime/maxtime rules",
"getblocktemplateresult-height": "Height of the block to be solved",
"getblocktemplateresult-parentblockhashes": "Hex-encoded big-endian hashes of the parent blocks",
"getblocktemplateresult-sigoplimit": "Number of sigops allowed in blocks ",
"getblocktemplateresult-sizelimit": "Number of bytes allowed in blocks",
"getblocktemplateresult-transactions": "Array of transactions as JSON objects",
"getblocktemplateresult-version": "The block version",
"getblocktemplateresult-coinbaseaux": "Data that should be included in the coinbase signature script",
"getblocktemplateresult-coinbasetxn": "Information about the coinbase transaction",
"getblocktemplateresult-coinbasevalue": "Total amount available for the coinbase in Satoshi",
"getblocktemplateresult-workid": "This value must be returned with result if provided (not provided)",
"getblocktemplateresult-longpollid": "Identifier for long poll request which allows monitoring for expiration",
"getblocktemplateresult-longpolluri": "An alternate URI to use for long poll requests if provided (not provided)",
"getblocktemplateresult-submitold": "Not applicable",
"getblocktemplateresult-target": "Hex-encoded big-endian number which valid results must be less than",
"getblocktemplateresult-expires": "Maximum number of seconds (starting from when the server sent the response) this work is valid for",
"getblocktemplateresult-maxtime": "Maximum allowed time",
"getblocktemplateresult-mintime": "Minimum allowed time",
"getblocktemplateresult-mutable": "List of mutations the server explicitly allows",
"getblocktemplateresult-noncerange": "Two concatenated hex-encoded big-endian 64-bit integers which represent the valid ranges of nonces the miner may scan",
"getblocktemplateresult-capabilities": "List of server capabilities including 'proposal' to indicate support for block proposals",
"getblocktemplateresult-reject-reason": "Reason the proposal was invalid as-is (only applies to proposal responses)",
"getBlockTemplateResult-bits": "Hex-encoded compressed difficulty",
"getBlockTemplateResult-curTime": "Current time as seen by the server (recommended for block time); must fall within mintime/maxtime rules",
"getBlockTemplateResult-height": "Height of the block to be solved",
"getBlockTemplateResult-parentHashes": "Hex-encoded big-endian hashes of the parent blocks",
"getBlockTemplateResult-sigOpLimit": "Number of sigops allowed in blocks ",
"getBlockTemplateResult-sizeLimit": "Number of bytes allowed in blocks",
"getBlockTemplateResult-transactions": "Array of transactions as JSON objects",
"getBlockTemplateResult-version": "The block version",
"getBlockTemplateResult-coinbaseAux": "Data that should be included in the coinbase signature script",
"getBlockTemplateResult-coinbaseTxn": "Information about the coinbase transaction",
"getBlockTemplateResult-coinbaseValue": "Total amount available for the coinbase in Satoshi",
"getBlockTemplateResult-workId": "This value must be returned with result if provided (not provided)",
"getBlockTemplateResult-longPollId": "Identifier for long poll request which allows monitoring for expiration",
"getBlockTemplateResult-longPollUri": "An alternate URI to use for long poll requests if provided (not provided)",
"getBlockTemplateResult-submitOld": "Not applicable",
"getBlockTemplateResult-target": "Hex-encoded big-endian number which valid results must be less than",
"getBlockTemplateResult-expires": "Maximum number of seconds (starting from when the server sent the response) this work is valid for",
"getBlockTemplateResult-maxTime": "Maximum allowed time",
"getBlockTemplateResult-minTime": "Minimum allowed time",
"getBlockTemplateResult-mutable": "List of mutations the server explicitly allows",
"getBlockTemplateResult-nonceRange": "Two concatenated hex-encoded big-endian 64-bit integers which represent the valid ranges of nonces the miner may scan",
"getBlockTemplateResult-capabilities": "List of server capabilities including 'proposal' to indicate support for block proposals",
"getBlockTemplateResult-rejectReason": "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" +
@ -332,13 +332,13 @@ var helpDescsEnUS = map[string]string{
// 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-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-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",
@ -363,39 +363,39 @@ var helpDescsEnUS = map[string]string{
"getHashesPerSec--result0": "The number of hashes per second",
// InfoDAGResult help.
"infodagresult-version": "The version of the server",
"infodagresult-protocolversion": "The latest supported protocol version",
"infodagresult-blocks": "The number of blocks processed",
"infodagresult-timeoffset": "The time offset",
"infodagresult-connections": "The number of connected peers",
"infodagresult-proxy": "The proxy used by the server",
"infodagresult-difficulty": "The current target difficulty",
"infodagresult-testnet": "Whether or not server is using testnet",
"infodagresult-relayfee": "The minimum relay fee for non-free transactions in BTC/KB",
"infodagresult-errors": "Any current errors",
"infoDagResult-version": "The version of the server",
"infoDagResult-protocolVersion": "The latest supported protocol version",
"infoDagResult-blocks": "The number of blocks processed",
"infoDagResult-timeOffset": "The time offset",
"infoDagResult-connections": "The number of connected peers",
"infoDagResult-proxy": "The proxy used by the server",
"infoDagResult-difficulty": "The current target difficulty",
"infoDagResult-testNet": "Whether or not server is using testnet",
"infoDagResult-relayFee": "The minimum relay fee for non-free transactions in BTC/KB",
"infoDagResult-errors": "Any current errors",
// InfoWalletResult help.
"infowalletresult-version": "The version of the server",
"infowalletresult-protocolversion": "The latest supported protocol version",
"infowalletresult-walletversion": "The version of the wallet server",
"infowalletresult-balance": "The total bitcoin balance of the wallet",
"infowalletresult-blocks": "The number of blocks processed",
"infowalletresult-timeoffset": "The time offset",
"infowalletresult-connections": "The number of connected peers",
"infowalletresult-proxy": "The proxy used by the server",
"infowalletresult-difficulty": "The current target difficulty",
"infowalletresult-testnet": "Whether or not server is using testnet",
"infowalletresult-keypoololdest": "Seconds since 1 Jan 1970 GMT of the oldest pre-generated key in the key pool",
"infowalletresult-keypoolsize": "The number of new keys that are pre-generated",
"infowalletresult-unlocked_until": "The timestamp in seconds since 1 Jan 1970 GMT that the wallet is unlocked for transfers, or 0 if the wallet is locked",
"infowalletresult-paytxfee": "The transaction fee set in BTC/KB",
"infowalletresult-relayfee": "The minimum relay fee for non-free transactions in BTC/KB",
"infowalletresult-errors": "Any current errors",
"infoWalletResult-version": "The version of the server",
"infoWalletResult-protocolVersion": "The latest supported protocol version",
"infoWalletResult-walletVersion": "The version of the wallet server",
"infoWalletResult-balance": "The total bitcoin balance of the wallet",
"infoWalletResult-blocks": "The number of blocks processed",
"infoWalletResult-timeOffset": "The time offset",
"infoWalletResult-connections": "The number of connected peers",
"infoWalletResult-proxy": "The proxy used by the server",
"infoWalletResult-difficulty": "The current target difficulty",
"infoWalletResult-testNet": "Whether or not server is using testnet",
"infoWalletResult-keypoolOldest": "Seconds since 1 Jan 1970 GMT of the oldest pre-generated key in the key pool",
"infoWalletResult-keypoolSize": "The number of new keys that are pre-generated",
"infoWalletResult-unlockedUntil": "The timestamp in seconds since 1 Jan 1970 GMT that the wallet is unlocked for transfers, or 0 if the wallet is locked",
"infoWalletResult-payTxFee": "The transaction fee set in BTC/KB",
"infoWalletResult-relayFee": "The minimum relay fee for non-free transactions in BTC/KB",
"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-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.
@ -405,21 +405,21 @@ var helpDescsEnUS = map[string]string{
"getMempoolInfo--synopsis": "Returns memory pool information",
// GetMempoolInfoResult help.
"getmempoolinforesult-bytes": "Size in bytes of the mempool",
"getmempoolinforesult-size": "Number of transactions in the mempool",
"getMempoolInfoResult-bytes": "Size in bytes of the mempool",
"getMempoolInfoResult-size": "Number of transactions in the mempool",
// GetMiningInfoResult help.
"getmininginforesult-blocks": "Height of the latest best block",
"getmininginforesult-currentblocksize": "Size of the latest best block",
"getmininginforesult-currentblocktx": "Number of transactions in the latest best block",
"getmininginforesult-difficulty": "Current target difficulty",
"getmininginforesult-errors": "Any current errors",
"getmininginforesult-generate": "Whether or not server is set to generate coins",
"getmininginforesult-genproclimit": "Number of processors to use for coin generation (-1 when disabled)",
"getmininginforesult-hashespersec": "Recent hashes per second performance measurement while generating coins",
"getmininginforesult-networkhashps": "Estimated network hashes per second for the most recent blocks",
"getmininginforesult-pooledtx": "Number of transactions in the memory pool",
"getmininginforesult-testnet": "Whether or not server is using testnet",
"getMiningInfoResult-blocks": "Height of the latest best block",
"getMiningInfoResult-currentBlockSize": "Size of the latest best block",
"getMiningInfoResult-currentBlockTx": "Number of transactions in the latest best block",
"getMiningInfoResult-difficulty": "Current target difficulty",
"getMiningInfoResult-errors": "Any current errors",
"getMiningInfoResult-generate": "Whether or not server is set to generate coins",
"getMiningInfoResult-genProcLimit": "Number of processors to use for coin generation (-1 when disabled)",
"getMiningInfoResult-hashesPerSec": "Recent hashes per second performance measurement while generating coins",
"getMiningInfoResult-networkHashPs": "Estimated network hashes per second for the most recent blocks",
"getMiningInfoResult-pooledTx": "Number of transactions in the memory pool",
"getMiningInfoResult-testNet": "Whether or not server is using testnet",
// GetMiningInfoCmd help.
"getMiningInfo--synopsis": "Returns a JSON object containing mining-related information.",
@ -434,43 +434,43 @@ var helpDescsEnUS = map[string]string{
"getNetTotals--synopsis": "Returns a JSON object containing network traffic statistics.",
// GetNetTotalsResult help.
"getnettotalsresult-totalbytesrecv": "Total bytes received",
"getnettotalsresult-totalbytessent": "Total bytes sent",
"getnettotalsresult-timemillis": "Number of milliseconds since 1 Jan 1970 GMT",
"getNetTotalsResult-totalBytesRecv": "Total bytes received",
"getNetTotalsResult-totalBytesSent": "Total bytes sent",
"getNetTotalsResult-timeMillis": "Number of milliseconds since 1 Jan 1970 GMT",
// GetPeerInfoResult help.
"getpeerinforesult-id": "A unique node ID",
"getpeerinforesult-addr": "The ip address and port of the peer",
"getpeerinforesult-services": "Services bitmask which represents the services supported by the peer",
"getpeerinforesult-relaytxes": "Peer has requested transactions be relayed to it",
"getpeerinforesult-lastsend": "Time the last message was received in seconds since 1 Jan 1970 GMT",
"getpeerinforesult-lastrecv": "Time the last message was sent in seconds since 1 Jan 1970 GMT",
"getpeerinforesult-bytessent": "Total bytes sent",
"getpeerinforesult-bytesrecv": "Total bytes received",
"getpeerinforesult-conntime": "Time the connection was made in seconds since 1 Jan 1970 GMT",
"getpeerinforesult-timeoffset": "The time offset of the peer",
"getpeerinforesult-pingtime": "Number of microseconds the last ping took",
"getpeerinforesult-pingwait": "Number of microseconds a queued ping has been waiting for a response",
"getpeerinforesult-version": "The protocol version of the peer",
"getpeerinforesult-subver": "The user agent of the peer",
"getpeerinforesult-inbound": "Whether or not the peer is an inbound connection",
"getpeerinforesult-startingheight": "The latest block height the peer knew about when the connection was established",
"getpeerinforesult-currentheight": "The current height of the peer",
"getpeerinforesult-banscore": "The ban score",
"getpeerinforesult-feefilter": "The requested minimum fee a transaction must have to be announced to the peer",
"getpeerinforesult-syncnode": "Whether or not the peer is the sync peer",
"getPeerInfoResult-id": "A unique node ID",
"getPeerInfoResult-addr": "The ip address and port of the peer",
"getPeerInfoResult-services": "Services bitmask which represents the services supported by the peer",
"getPeerInfoResult-relayTxes": "Peer has requested transactions be relayed to it",
"getPeerInfoResult-lastSend": "Time the last message was received in seconds since 1 Jan 1970 GMT",
"getPeerInfoResult-lastRecv": "Time the last message was sent in seconds since 1 Jan 1970 GMT",
"getPeerInfoResult-bytesSent": "Total bytes sent",
"getPeerInfoResult-bytesRecv": "Total bytes received",
"getPeerInfoResult-connTime": "Time the connection was made in seconds since 1 Jan 1970 GMT",
"getPeerInfoResult-timeOffset": "The time offset of the peer",
"getPeerInfoResult-pingTime": "Number of microseconds the last ping took",
"getPeerInfoResult-pingWait": "Number of microseconds a queued ping has been waiting for a response",
"getPeerInfoResult-version": "The protocol version of the peer",
"getPeerInfoResult-subVer": "The user agent of the peer",
"getPeerInfoResult-inbound": "Whether or not the peer is an inbound connection",
"getPeerInfoResult-startingHeight": "The latest block height the peer knew about when the connection was established",
"getPeerInfoResult-currentHeight": "The current height of the peer",
"getPeerInfoResult-banScore": "The ban score",
"getPeerInfoResult-feeFilter": "The requested minimum fee a transaction must have to be announced to the peer",
"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.",
// GetRawMempoolVerboseResult help.
"getrawmempoolverboseresult-size": "Transaction size in bytes",
"getrawmempoolverboseresult-fee": "Transaction fee in bitcoins",
"getrawmempoolverboseresult-time": "Local time transaction entered pool in seconds since 1 Jan 1970 GMT",
"getrawmempoolverboseresult-height": "Block height when transaction entered the pool",
"getrawmempoolverboseresult-startingpriority": "Priority when transaction entered the pool",
"getrawmempoolverboseresult-currentpriority": "Current priority",
"getrawmempoolverboseresult-depends": "Unconfirmed transactions used as inputs for this transaction",
"getRawMempoolVerboseResult-size": "Transaction size in bytes",
"getRawMempoolVerboseResult-fee": "Transaction fee in bitcoins",
"getRawMempoolVerboseResult-time": "Local time transaction entered pool in seconds since 1 Jan 1970 GMT",
"getRawMempoolVerboseResult-height": "Block height when transaction entered the pool",
"getRawMempoolVerboseResult-startingPriority": "Priority when transaction entered the pool",
"getRawMempoolVerboseResult-currentPriority": "Current priority",
"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.",
@ -481,25 +481,25 @@ var helpDescsEnUS = map[string]string{
// GetRawTransactionCmd help.
"getRawTransaction--synopsis": "Returns information about a transaction given its hash.",
"getRawTransaction-txid": "The hash of the transaction",
"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",
"gettxoutresult-confirmations": "The number of confirmations",
"gettxoutresult-value": "The transaction amount in BTC",
"gettxoutresult-scriptPubKey": "The public key script used to pay coins as a JSON object",
"gettxoutresult-version": "The transaction version",
"gettxoutresult-coinbase": "Whether or not the transaction is a coinbase",
"getTxOutResult-bestBlock": "The block hash that contains the transaction output",
"getTxOutResult-confirmations": "The number of confirmations",
"getTxOutResult-value": "The transaction amount in BTC",
"getTxOutResult-scriptPubKey": "The public key script used to pay coins as a JSON object",
"getTxOutResult-version": "The transaction version",
"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-txId": "The hash of the transaction",
"getTxOut-vout": "The index of the output",
"getTxOut-includemempool": "Include the mempool when true",
"getTxOut-includeMempool": "Include the mempool when true",
// HelpCmd help.
"help--synopsis": "Returns a list of all commands or help for a specified command.",
@ -529,40 +529,40 @@ var helpDescsEnUS = map[string]string{
"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-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-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-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-genProcLimit": "The number of processors (cores) to limit generation to or -1 for default",
// StopCmd help.
"stop--synopsis": "Shutdown btcd.",
"stop--result0": "The string 'btcd stopping.'",
// SubmitBlockOptions help.
"submitblockoptions-workid": "This parameter is currently ignored",
"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-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)",
"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.",
@ -570,12 +570,12 @@ var helpDescsEnUS = map[string]string{
// VerifyChainCmd help.
"verifyDag--synopsis": "Verifies the block DAG database.\n" +
"The actual checks performed by the checklevel parameter are implementation specific.\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",
"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",
// VerifyMessageCmd help.
@ -589,7 +589,7 @@ var helpDescsEnUS = map[string]string{
// Session help.
"session--synopsis": "Return details regarding a websocket client's current connection session.",
"sessionresult-sessionid": "The unique session ID for a client's websocket connection.",
"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.",
@ -614,41 +614,41 @@ var helpDescsEnUS = map[string]string{
"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-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-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-outPoints": "Array of outpoints to add to the transaction filter",
// Rescan help.
"rescan--synopsis": "Rescan block chain for transactions to addresses.\n" +
"When the endblock parameter is omitted, the rescan continues through the best block in the main chain.\n" +
"Rescan results are sent as recvtx and redeemingtx notifications.\n" +
"This call returns once the rescan completes.",
"rescan-beginblock": "Hash of the first block to begin rescanning",
"rescan-beginBlock": "Hash of the first block to begin rescanning",
"rescan-addresses": "List of addresses to include in the rescan",
"rescan-outpoints": "List of transaction outpoints to include in the rescan",
"rescan-endblock": "Hash of final block to rescan",
"rescan-outPoints": "List of transaction outpoints to include in the rescan",
"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-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.",
"rescannedblock-transactions": "List of matching transactions, serialized and hex-encoded.",
"rescannedBlock-hash": "Hash of the matching block.",
"rescannedBlock-transactions": "List of matching transactions, serialized and hex-encoded.",
// Uptime help.
"uptime--synopsis": "Returns the total uptime of the server.",
@ -661,12 +661,12 @@ var helpDescsEnUS = map[string]string{
"version--result0--value": "Object containing the semantic version",
// VersionResult help.
"versionresult-versionstring": "The JSON-RPC API version (semver)",
"versionresult-major": "The major component of the JSON-RPC API version",
"versionresult-minor": "The minor component of the JSON-RPC API version",
"versionresult-patch": "The patch component of the JSON-RPC API version",
"versionresult-prerelease": "Prerelease info about the current build",
"versionresult-buildmetadata": "Metadata about the current build",
"versionResult-versionString": "The JSON-RPC API version (semver)",
"versionResult-major": "The major component of the JSON-RPC API version",
"versionResult-minor": "The minor component of the JSON-RPC API version",
"versionResult-patch": "The patch component of the JSON-RPC API version",
"versionResult-prerelease": "Prerelease info about the current build",
"versionResult-buildMetadata": "Metadata about the current build",
}
// rpcResultTypes specifies the result types that each RPC command can return.

View File

@ -1361,7 +1361,7 @@ out:
//
// RPC quirks can be enabled by the user to avoid compatibility issues
// with software relying on Core's behavior.
if request.ID == nil && !(config.MainConfig().RPCQuirks && request.Jsonrpc == "") {
if request.ID == nil && !(config.MainConfig().RPCQuirks && request.JsonRPC == "") {
if !c.authenticated {
break out
}

69
util/btcstrings.go Normal file
View File

@ -0,0 +1,69 @@
package util
import (
"strings"
"unicode"
)
// ToCamelCase converts a camelCase-ish string into a typical JSON camelCase string.
// Example conversion: MyJSONVariable -> myJsonVariable
func ToCamelCase(str string) string {
if len(str) == 0 {
return ""
}
// Split the string into words
words := make([]string, 0)
wordStartIndex := 0
wordEndIndex := -1
var previousCharacter rune
for i, character := range str {
if i > 0 {
if unicode.IsLower(previousCharacter) && unicode.IsUpper(character) {
// previousCharacter is definitely the end of a word
wordEndIndex = i - 1
word := str[wordStartIndex:i]
words = append(words, word)
} else if unicode.IsUpper(previousCharacter) && unicode.IsLower(character) {
// previousCharacter is definitely the start of a word
wordStartIndex = i - 1
if wordStartIndex-wordEndIndex > 1 {
// This handles consequent uppercase words, such as acronyms.
// Example: getBlockDAGInfo
// ^^^
word := str[wordEndIndex+1 : wordStartIndex]
words = append(words, word)
}
}
}
previousCharacter = character
}
if unicode.IsUpper(previousCharacter) {
// This handles consequent uppercase words, such as acronyms, at the end of the string
// Example: TxID
// ^^
for i := len(str) - 1; i >= 0; i-- {
if unicode.IsLower(rune(str[i])) {
break
}
wordStartIndex = i
}
}
lastWord := str[wordStartIndex:]
words = append(words, lastWord)
// Build a PascalCase string out of the words
var camelCaseBuilder strings.Builder
for _, word := range words {
lowercaseWord := strings.ToLower(word)
capitalizedWord := strings.ToUpper(string(lowercaseWord[0])) + lowercaseWord[1:]
camelCaseBuilder.WriteString(capitalizedWord)
}
camelCaseString := camelCaseBuilder.String()
// Un-capitalize the first character to covert PascalCase into camelCase
return strings.ToLower(string(camelCaseString[0])) + camelCaseString[1:]
}

61
util/btcstrings_test.go Normal file
View File

@ -0,0 +1,61 @@
package util
import "testing"
// TestToCamelCase tests whether ToCamelCase correctly converts camelCase-ish strings to camelCase.
func TestToCamelCase(t *testing.T) {
tests := []struct {
name string
input string
expectedResult string
}{
{
name: "single word that's already in camelCase",
input: "abc",
expectedResult: "abc",
},
{
name: "single word in PascalCase",
input: "Abc",
expectedResult: "abc",
},
{
name: "single word in all caps",
input: "ABC",
expectedResult: "abc",
},
{
name: "multiple words that are already in camelCase",
input: "aaaBbbCcc",
expectedResult: "aaaBbbCcc",
},
{
name: "multiple words in PascalCase",
input: "AaaBbbCcc",
expectedResult: "aaaBbbCcc",
},
{
name: "acronym in start position",
input: "AAABbbCcc",
expectedResult: "aaaBbbCcc",
},
{
name: "acronym in middle position",
input: "aaaBBBCcc",
expectedResult: "aaaBbbCcc",
},
{
name: "acronym in end position",
input: "aaaBbbCCC",
expectedResult: "aaaBbbCcc",
},
}
for _, test := range tests {
result := ToCamelCase(test.input)
if result != test.expectedResult {
t.Errorf("ToCamelCase for test \"%s\" returned an unexpected result. "+
"Expected: \"%s\", got: \"%s\"", test.name, test.expectedResult, result)
}
}
}