diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -5,3 +5,5 @@ This release includes the following features and fixes: - Remove the bip9params configuration. - Remove the bip9_softforks result from the getblockchaininfo RPC call. + - Remove the rules, vbavailable and vbrequired result from the getblocktemplate RPC call. + - Remove the rules argument from the getblocktemplate RPC call. diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -326,15 +326,6 @@ return "valid?"; } -std::string gbt_vb_name(const Consensus::DeploymentPos pos) { - const struct BIP9DeploymentInfo &vbinfo = VersionBitsDeploymentInfo[pos]; - std::string s = vbinfo.name; - if (!vbinfo.gbt_force) { - s.insert(s.begin(), '!'); - } - return s; -} - static UniValue getblocktemplate(const Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() > 1) { @@ -367,12 +358,6 @@ "feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', " "'serverlist', 'workid'\n" " ,...\n" - " ],\n" - " \"rules\":[ (array, optional) A list of " - "strings\n" - " \"support\" (string) client side supported " - "softfork deployment\n" - " ,...\n" " ]\n" " }\n" "\n" @@ -381,17 +366,6 @@ "{\n" " \"version\" : n, (numeric) The preferred " "block version\n" - " \"rules\" : [ \"rulename\", ... ], (array of strings) " - "specific block rules that are to be enforced\n" - " \"vbavailable\" : { (json object) set of " - "pending, supported versionbit (BIP 9) softfork deployments\n" - " \"rulename\" : bitnumber (numeric) identifies the " - "bit number as indicating acceptance and readiness for the named " - "softfork rule\n" - " ,...\n" - " },\n" - " \"vbrequired\" : n, (numeric) bit mask of " - "versionbits the server requires set in submissions\n" " \"previousblockhash\" : \"xxxx\", (string) The hash of " "current highest block\n" " \"transactions\" : [ (array) contents of " @@ -471,7 +445,6 @@ std::string strMode = "template"; UniValue lpval = NullUniValue; std::set setClientRules; - int64_t nMaxVersionPreVB = -1; if (request.params.size() > 0) { const UniValue &oparam = request.params[0].get_obj(); const UniValue &modeval = find_value(oparam, "mode"); @@ -522,21 +495,6 @@ validationOptions); return BIP22ValidationResult(config, state); } - - const UniValue &aClientRules = find_value(oparam, "rules"); - if (aClientRules.isArray()) { - for (size_t i = 0; i < aClientRules.size(); ++i) { - const UniValue &v = aClientRules[i]; - setClientRules.insert(v.get_str()); - } - } else { - // NOTE: It is important that this NOT be read if versionbits is - // supported - const UniValue &uvMaxVersion = find_value(oparam, "maxversion"); - if (uvMaxVersion.isNum()) { - nMaxVersionPreVB = uvMaxVersion.get_int64(); - } - } } if (strMode != "template") { @@ -638,8 +596,6 @@ // pointer for convenience CBlock *pblock = &pblocktemplate->block; - const Consensus::Params &consensusParams = - config.GetChainParams().GetConsensus(); // Update nTime UpdateTime(pblock, config, pindexPrev); @@ -697,75 +653,7 @@ UniValue result(UniValue::VOBJ); result.push_back(Pair("capabilities", aCaps)); - UniValue aRules(UniValue::VARR); - UniValue vbavailable(UniValue::VOBJ); - for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) { - Consensus::DeploymentPos pos = Consensus::DeploymentPos(j); - ThresholdState state = VersionBitsState(pindexPrev, consensusParams, - pos, versionbitscache); - switch (state) { - case THRESHOLD_DEFINED: - case THRESHOLD_FAILED: - // Not exposed to GBT at all - break; - case THRESHOLD_LOCKED_IN: { - // Ensure bit is set in block version, then fallthrough to get - // vbavailable set. - pblock->nVersion |= VersionBitsMask(consensusParams, pos); - } - // FALLTHROUGH - case THRESHOLD_STARTED: { - const struct BIP9DeploymentInfo &vbinfo = - VersionBitsDeploymentInfo[pos]; - vbavailable.push_back(Pair( - gbt_vb_name(pos), consensusParams.vDeployments[pos].bit)); - if (setClientRules.find(vbinfo.name) == setClientRules.end()) { - if (!vbinfo.gbt_force) { - // If the client doesn't support this, don't indicate it - // in the [default] version - pblock->nVersion &= - ~VersionBitsMask(consensusParams, pos); - } - } - break; - } - case THRESHOLD_ACTIVE: { - // Add to rules only - const struct BIP9DeploymentInfo &vbinfo = - VersionBitsDeploymentInfo[pos]; - aRules.push_back(gbt_vb_name(pos)); - if (setClientRules.find(vbinfo.name) == setClientRules.end()) { - // Not supported by the client; make sure it's safe to - // proceed - if (!vbinfo.gbt_force) { - // If we do anything other than throw an exception here, - // be sure version/force isn't sent to old clients - throw JSONRPCError( - RPC_INVALID_PARAMETER, - strprintf("Support for '%s' rule requires explicit " - "client support", - vbinfo.name)); - } - } - break; - } - } - } result.push_back(Pair("version", pblock->nVersion)); - result.push_back(Pair("rules", aRules)); - result.push_back(Pair("vbavailable", vbavailable)); - result.push_back(Pair("vbrequired", int(0))); - - if (nMaxVersionPreVB >= 2) { - // If VB is supported by the client, nMaxVersionPreVB is -1, so we won't - // get here. Because BIP 34 changed how the generation transaction is - // serialized, we can only use version/force back to v2 blocks. This is - // safe to do [otherwise-]unconditionally only because we are throwing - // an exception above if a non-force deployment gets activated. Note - // that this can probably also be removed entirely after the first BIP9 - // non-force deployment (ie, probably segwit) gets activated. - aMutable.push_back("version/force"); - } result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); @@ -777,7 +665,7 @@ i64tostr(nTransactionsUpdatedLast))); result.push_back(Pair("target", hashTarget.GetHex())); result.push_back( - Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast() + 1)); + Pair("mintime", int64_t(pindexPrev->GetMedianTimePast()) + 1)); result.push_back(Pair("mutable", aMutable)); result.push_back(Pair("noncerange", "00000000ffffffff")); // FIXME: Allow for mining block greater than 1M. @@ -786,7 +674,7 @@ result.push_back(Pair("sizelimit", DEFAULT_MAX_BLOCK_SIZE)); result.push_back(Pair("curtime", pblock->GetBlockTime())); result.push_back(Pair("bits", strprintf("%08x", pblock->nBits))); - result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight + 1))); + result.push_back(Pair("height", int64_t(pindexPrev->nHeight) + 1)); return result; }