diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -4,3 +4,6 @@ This release includes the following features and fixes: - Return amounts from `decoderawtransaction` are padded to 8 decimal places. + - Deprecated 'softforks' information from `getblockchaininfo` RPC call, which + had only been reporting on some very old upgrades. To keep this information, + start bitcoind with the '-deprecatedrpc=getblockchaininfo' option. diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1257,6 +1257,11 @@ "getblockchaininfo\n" "Returns an object containing various state info regarding " "blockchain processing.\n" + "DEPRECATION WARNING: The 'softforks' output has been deprecated " + "and will be\n" + "removed v0.20. For the time being it will only be shown here when " + "bitcoind\n" + "is started with -deprecatedrpc=getblockchaininfo.\n" "\nResult:\n" "{\n" " \"chain\": \"xxxx\", (string) current network name " @@ -1287,8 +1292,8 @@ "pruning is enabled (only present if pruning is enabled)\n" " \"prune_target_size\": xxxxxx, (numeric) the target size " "used by pruning (only present if automatic pruning is enabled)\n" - " \"softforks\": [ (array) status of softforks in " - "progress\n" + " \"softforks\": [ (array) DEPRECATED: status of " + "softforks in progress\n" " {\n" " \"id\": \"xxxx\", (string) name of softfork\n" " \"version\": xx, (numeric) block version\n" @@ -1341,14 +1346,16 @@ } } - const Consensus::Params &consensusParams = - config.GetChainParams().GetConsensus(); - UniValue softforks(UniValue::VARR); - softforks.push_back(SoftForkDesc("bip34", 2, tip, consensusParams)); - softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams)); - softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams)); - softforks.push_back(SoftForkDesc("csv", 5, tip, consensusParams)); - obj.pushKV("softforks", softforks); + if (IsDeprecatedRPCEnabled(gArgs, "getblockchaininfo")) { + const Consensus::Params &consensusParams = + config.GetChainParams().GetConsensus(); + UniValue softforks(UniValue::VARR); + softforks.push_back(SoftForkDesc("bip34", 2, tip, consensusParams)); + softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams)); + softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams)); + softforks.push_back(SoftForkDesc("csv", 5, tip, consensusParams)); + obj.pushKV("softforks", softforks); + } obj.pushKV("warnings", GetWarnings("statusbar")); return obj; diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -403,11 +403,8 @@ self.nodes[0].generate(10) def get_csv_status(self): - softforks = self.nodes[0].getblockchaininfo()['softforks'] - for sf in softforks: - if sf['id'] == 'csv' and sf['version'] == 5: - return sf['reject']['status'] - raise AssertionError('Cannot find CSV fork activation information') + height = self.nodes[0].getblockchaininfo()['blocks'] + return height >= 576 # Make sure that BIP68 isn't being used to validate blocks, prior to # versionbits activation. If more blocks are mined prior to this test diff --git a/test/functional/feature_csv_activation.py b/test/functional/feature_csv_activation.py --- a/test/functional/feature_csv_activation.py +++ b/test/functional/feature_csv_activation.py @@ -103,11 +103,8 @@ def get_csv_status(node): - softforks = node.getblockchaininfo()['softforks'] - for sf in softforks: - if sf['id'] == 'csv' and sf['version'] == 5: - return sf['reject']['status'] - raise AssertionError('Cannot find CSV fork activation information') + height = node.getblockchaininfo()['blocks'] + return height >= 576 class BIP68_112_113Test(ComparisonTestFramework): diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -66,7 +66,6 @@ 'mediantime', 'pruned', 'size_on_disk', - 'softforks', 'verificationprogress', 'warnings', ] diff --git a/test/functional/rpc_deprecated.py b/test/functional/rpc_deprecated.py --- a/test/functional/rpc_deprecated.py +++ b/test/functional/rpc_deprecated.py @@ -12,7 +12,7 @@ self.num_nodes = 2 self.setup_clean_chain = True self.extra_args = [ - [], ["-deprecatedrpc=createmultisig", "-deprecatedrpc=validateaddress"]] + [], ["-deprecatedrpc=createmultisig", "-deprecatedrpc=validateaddress", "-deprecatedrpc=getblockchaininfo"]] def run_test(self): # This test should be used to verify correct behaviour of deprecated @@ -36,6 +36,13 @@ self.nodes[0].createmultisig, 1, [self.nodes[0].getnewaddress()]) self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()]) + self.log.info( + "-deprecatedrpc=getblockchaininfo lets us see old 'softforks' info") + binfo_normal = self.nodes[0].getblockchaininfo() + assert "softforks" not in binfo_normal + binfo_dep = self.nodes[1].getblockchaininfo() + assert "softforks" in binfo_dep and len(binfo_dep['softforks']) == 4 + if __name__ == '__main__': DeprecatedRpcTest().main()