Deprecate old hash fields of `getblocktemplate`

This commit is contained in:
Jack Grigg 2022-12-03 23:27:19 +00:00
parent 09cd65327b
commit 0ff86213ce
6 changed files with 24 additions and 7 deletions

View File

@ -37,6 +37,7 @@ the node, or if an `allowdeprecated=none` line is added to `zcash.conf`.
| `feature` | Deprecated | Feature details
|-----------------------|------------|----------------
| `gbt_oldhashes` | 5.4.0 | The `finalsaplingroothash`, `lightclientroothash`, and `blockcommitmentshash` fields in the output of `getblocktemplate`, which are replaced by the `defaultroots` field.
Stage 2
-------

View File

@ -17,6 +17,15 @@ RPC Changes
[Deprecations](https://zcash.github.io/zcash/user/deprecation.html)
--------------
The following features have been deprecated, but remain available by default.
These features may be disabled by setting `-allowdeprecated=none`. 18 weeks
after this release, these features will be disabled by default and the following
flags to `-allowdeprecated` will be required to permit their continued use:
- `gbt_oldhashes`: the `finalsaplingroothash`, `lightclientroothash`, and
`blockcommitmentshash` fields in the output of `getblocktemplate` have been
replaced by the `defaultroots` field.
The following previously-deprecated features have been disabled by default, and
will be removed in 18 weeks:

View File

@ -35,10 +35,10 @@ Options:
-allowdeprecated=<feature>
Explicitly allow the use of the specified deprecated feature. Multiple
instances of this parameter are permitted; values for <feature> must be
selected from among {"none", "addrtype", "getnewaddress",
"getrawchangeaddress", "legacy_privacy", "wallettxvjoinsplit",
"z_getbalance", "z_getnewaddress", "z_gettotalbalance",
"z_listaddresses"}
selected from among {"none", "gbt_oldhashes", "addrtype",
"getnewaddress", "getrawchangeaddress", "legacy_privacy",
"wallettxvjoinsplit", "z_getbalance", "z_getnewaddress",
"z_gettotalbalance", "z_listaddresses"}
-blocknotify=<cmd>
Execute command when the best block changes (%s in cmd is replaced by

View File

@ -12,6 +12,7 @@
#include "chainparams.h"
// Flags that enable deprecated functionality.
bool fEnableGbtOldHashes = true;
#ifdef ENABLE_WALLET
bool fEnableGetNewAddress = true;
bool fEnableGetRawChangeAddress = true;
@ -91,6 +92,7 @@ std::optional<std::string> SetAllowedDeprecatedFeaturesFromCLIArgs() {
unrecMsg, GetAllowableDeprecatedFeatures());
}
fEnableGbtOldHashes = allowdeprecated.count("gbt_oldhashes") > 0;
#ifdef ENABLE_WALLET
fEnableLegacyPrivacyStrategy = allowdeprecated.count("legacy_privacy") > 0;
fEnableGetNewAddress = allowdeprecated.count("getnewaddress") > 0;

View File

@ -23,6 +23,7 @@ static const int DEPRECATION_WARN_LIMIT = 14 * 24 * EXPECTED_BLOCKS_PER_HOUR;
//! Defaults for -allowdeprecated
static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
// Node-level features
"gbt_oldhashes"
// Wallet-level features
#ifdef ENABLE_WALLET
@ -46,6 +47,7 @@ static const std::set<std::string> DEFAULT_DENY_DEPRECATED{{
}};
// Flags that enable deprecated functionality.
extern bool fEnableGbtOldHashes;
#ifdef ENABLE_WALLET
extern bool fEnableGetNewAddress;
extern bool fEnableGetRawChangeAddress;

View File

@ -14,6 +14,7 @@
#ifdef ENABLE_MINING
#include "crypto/equihash.h"
#endif
#include "deprecation.h"
#include "init.h"
#include "key_io.h"
#include "main.h"
@ -782,9 +783,11 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
result.pushKV("version", pblock->nVersion);
result.pushKV("previousblockhash", pblock->hashPrevBlock.GetHex());
// The following 3 are deprecated; remove in a future release.
result.pushKV("blockcommitmentshash", pblock->hashBlockCommitments.GetHex());
result.pushKV("lightclientroothash", pblock->hashBlockCommitments.GetHex());
result.pushKV("finalsaplingroothash", pblock->hashBlockCommitments.GetHex());
if (fEnableGbtOldHashes) {
result.pushKV("blockcommitmentshash", pblock->hashBlockCommitments.GetHex());
result.pushKV("lightclientroothash", pblock->hashBlockCommitments.GetHex());
result.pushKV("finalsaplingroothash", pblock->hashBlockCommitments.GetHex());
}
{
// These are items in the result object that are valid only if the
// block template returned by this RPC is used unmodified. Otherwise,