Skip to content

Commit 890396c

Browse files
committed
cli: replace testnet with chain and return network name as per BIP70.
1 parent 12408d3 commit 890396c

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

doc/release-notes-15566.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Miscellaneous CLI Changes
2+
-------------------------
3+
- 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).

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class GetinfoRequestHandler: public BaseRequestHandler
262262
result.pushKV("connections", batch[ID_NETWORKINFO]["result"]["connections"]);
263263
result.pushKV("proxy", batch[ID_NETWORKINFO]["result"]["networks"][0]["proxy"]);
264264
result.pushKV("difficulty", batch[ID_BLOCKCHAININFO]["result"]["difficulty"]);
265-
result.pushKV("testnet", UniValue(batch[ID_BLOCKCHAININFO]["result"]["chain"].get_str() == "test"));
265+
result.pushKV("chain", UniValue(batch[ID_BLOCKCHAININFO]["result"]["chain"]));
266266
if (!batch[ID_WALLETINFO].isNull()) {
267267
result.pushKV("walletversion", batch[ID_WALLETINFO]["result"]["walletversion"]);
268268
result.pushKV("balance", batch[ID_WALLETINFO]["result"]["balance"]);

test/functional/interface_bitcoin_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def run_test(self):
6565
assert_equal(cli_get_info['connections'], network_info['connections'])
6666
assert_equal(cli_get_info['proxy'], network_info['networks'][0]['proxy'])
6767
assert_equal(cli_get_info['difficulty'], blockchain_info['difficulty'])
68-
assert_equal(cli_get_info['testnet'], blockchain_info['chain'] == "test")
68+
assert_equal(cli_get_info['chain'], blockchain_info['chain'])
6969
if self.is_wallet_compiled():
7070
assert_equal(cli_get_info['balance'], wallet_info['balance'])
7171
assert_equal(cli_get_info['keypoololdest'], wallet_info['keypoololdest'])

0 commit comments

Comments
 (0)