Merge #17368: cli: fix -getinfo output when compiled with no wallet

3d05d33269 cli: fix -getinfo output when compiled with no wallet (fanquake)

Pull request description:

  master (33b155f287):
  ```bash
  src/bitcoin-cli -getinfo
  {
    "version": 199900,
    "protocolversion": 70015,
    "blocks": 602348,
    "headers": 602348,
    "verificationprogress": 0.9999995592310106,
    "timeoffset": 0,
    "connections": 10,
    "proxy": "",
    "difficulty": 13691480038694.45,
    "chain": "main",
    "walletversion": null,
    "balance": null,
    "keypoololdest": null,
    "keypoolsize": null,
    "paytxfee": null,
    "relayfee": 0.00001000,
    "warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
  }
  ```

  This PR (3d05d33269):
  ```bash
  {
    "version": 199900,
    "protocolversion": 70015,
    "blocks": 602348,
    "headers": 602348,
    "verificationprogress": 0.9999996313568186,
    "timeoffset": 0,
    "connections": 10,
    "proxy": "",
    "difficulty": 13691480038694.45,
    "chain": "main",
    "relayfee": 0.00001000,
    "warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
  }
  ```

ACKs for top commit:
  MarcoFalke:
    ouch ACK 3d05d33269
  laanwj:
    ACK 3d05d33269
  darosior:
    ACK 3d05d33269

Tree-SHA512: 055424e122a082cbfea410da287d9ceb7ed405fd68d53e2f5bef62beea80bc374a7d00366de0479d23faecb7f063b232aca52e9fdbdb97c58ddf46e7749136a9
This commit is contained in:
Wladimir J. van der Laan 2019-11-06 11:07:07 +01:00
commit 7967104aee
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -265,7 +265,7 @@ public:
result.pushKV("proxy", batch[ID_NETWORKINFO]["result"]["networks"][0]["proxy"]);
result.pushKV("difficulty", batch[ID_BLOCKCHAININFO]["result"]["difficulty"]);
result.pushKV("chain", UniValue(batch[ID_BLOCKCHAININFO]["result"]["chain"]));
if (!batch[ID_WALLETINFO].isNull()) {
if (!batch[ID_WALLETINFO]["result"].isNull()) {
result.pushKV("walletversion", batch[ID_WALLETINFO]["result"]["walletversion"]);
result.pushKV("balance", batch[ID_WALLETINFO]["result"]["balance"]);
result.pushKV("keypoololdest", batch[ID_WALLETINFO]["result"]["keypoololdest"]);