rpc: Add AddrIndex and TxIndex bools to getinfo.

These reflect if the dcrd indexes are enabled.
This commit is contained in:
David Hill 2020-05-21 11:02:05 -04:00 committed by Dave Collins
parent b4eea1d59a
commit f5718dd3bd
4 changed files with 9 additions and 1 deletions

View File

@ -1463,7 +1463,9 @@ of the best block.
: <code>difficulty</code>: <code>(numeric)</code> the current target difficulty.
: <code>testnet</code>: <code>(boolean)</code> whether or not server is using testnet.
: <code>relayfee</code>: <code>(numeric)</code> the minimum relay fee for non-free transactions in DCR/KB.
<code>{"version": n,"protocolversion": n, "blocks": n, "timeoffset": n, "connections": n, "proxy": "host:port", "difficulty": n.nn, "testnet": true or false, "relayfee": n.nn}</code>
: <code>addrindex</code>: <code>(boolean)</code> whether or not server has address index enabled.
: <code>txindex</code>: <code>(boolean)</code> whether or not server has transaction index enabled.
<code>{"version": n,"protocolversion": n, "blocks": n, "timeoffset": n, "connections": n, "proxy": "host:port", "difficulty": n.nn, "testnet": true or false, "relayfee": n.nn, "addrindex": true or false, "txindex": true or false}</code>
|-
!Example Return
|<code>{"version": 70000, "protocolversion": 70001, "blocks": 298963, "timeoffset": 0, "connections": 17, "proxy": "", "difficulty": 8000872135.97, "testnet": false,"relayfee": 0.00001}</code>

View File

@ -193,6 +193,8 @@ type InfoChainResult struct {
TestNet bool `json:"testnet"`
RelayFee float64 `json:"relayfee"`
Errors string `json:"errors"`
AddrIndex bool `json:"addrindex"`
TxIndex bool `json:"txindex"`
}
// GetMempoolInfoResult models the data returned from the getmempoolinfo

View File

@ -2345,6 +2345,8 @@ func handleGetInfo(_ context.Context, s *rpcServer, cmd interface{}) (interface{
Difficulty: getDifficultyRatio(best.Bits, s.cfg.ChainParams),
TestNet: cfg.TestNet,
RelayFee: cfg.minRelayTxFee.ToCoin(),
AddrIndex: cfg.AddrIndex,
TxIndex: cfg.TxIndex,
}
return ret, nil

View File

@ -503,6 +503,8 @@ var helpDescsEnUS = map[string]string{
"infochainresult-testnet": "Whether or not server is using testnet",
"infochainresult-relayfee": "The minimum relay fee for non-free transactions in DCR/KB",
"infochainresult-errors": "Any current errors",
"infochainresult-addrindex": "Whether or not server has address index enabled",
"infochainresult-txindex": "Whether or not server has transaction index enabled",
// InfoWalletResult help.
"infowalletresult-version": "The version of the server",