aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2019-03-09 16:15:17 +0800
committerfanquake <fanquake@gmail.com>2019-03-09 16:35:26 +0800
commit890396cbd504b4670597d39ecb037e69ffb8bd3e (patch)
tree304344ed7d24a517ebafc65a95aa56c2cea4ab0a
parent12408d33c6ac85522a0751908230cb0f3b4078fc (diff)
cli: replace testnet with chain and return network name as per BIP70.
-rw-r--r--doc/release-notes-15566.md3
-rw-r--r--src/bitcoin-cli.cpp2
-rwxr-xr-xtest/functional/interface_bitcoin_cli.py2
3 files changed, 5 insertions, 2 deletions
diff --git a/doc/release-notes-15566.md b/doc/release-notes-15566.md
new file mode 100644
index 0000000000..49964d7550
--- /dev/null
+++ b/doc/release-notes-15566.md
@@ -0,0 +1,3 @@
+Miscellaneous CLI Changes
+-------------------------
+- The `testnet` field in `bitcoin-cli -getinfo` has been renamed to `chain` and now returns the current network name as defined in BIP70 (main, test, regtest). \ No newline at end of file
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index b0e1f67d93..62a53e2308 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -262,7 +262,7 @@ public:
result.pushKV("connections", batch[ID_NETWORKINFO]["result"]["connections"]);
result.pushKV("proxy", batch[ID_NETWORKINFO]["result"]["networks"][0]["proxy"]);
result.pushKV("difficulty", batch[ID_BLOCKCHAININFO]["result"]["difficulty"]);
- result.pushKV("testnet", UniValue(batch[ID_BLOCKCHAININFO]["result"]["chain"].get_str() == "test"));
+ result.pushKV("chain", UniValue(batch[ID_BLOCKCHAININFO]["result"]["chain"]));
if (!batch[ID_WALLETINFO].isNull()) {
result.pushKV("walletversion", batch[ID_WALLETINFO]["result"]["walletversion"]);
result.pushKV("balance", batch[ID_WALLETINFO]["result"]["balance"]);
diff --git a/test/functional/interface_bitcoin_cli.py b/test/functional/interface_bitcoin_cli.py
index f44fc768dc..8640ae95c6 100755
--- a/test/functional/interface_bitcoin_cli.py
+++ b/test/functional/interface_bitcoin_cli.py
@@ -65,7 +65,7 @@ class TestBitcoinCli(BitcoinTestFramework):
assert_equal(cli_get_info['connections'], network_info['connections'])
assert_equal(cli_get_info['proxy'], network_info['networks'][0]['proxy'])
assert_equal(cli_get_info['difficulty'], blockchain_info['difficulty'])
- assert_equal(cli_get_info['testnet'], blockchain_info['chain'] == "test")
+ assert_equal(cli_get_info['chain'], blockchain_info['chain'])
if self.is_wallet_compiled():
assert_equal(cli_get_info['balance'], wallet_info['balance'])
assert_equal(cli_get_info['keypoololdest'], wallet_info['keypoololdest'])