From 905f744baf31944a5ffcba00ed2e9ccfeac85520 Mon Sep 17 00:00:00 2001 From: Brannon King Date: Sun, 19 Apr 2020 10:34:43 -0600 Subject: [PATCH] fixed missing flags in getblocktemplate --- configure.ac | 2 +- src/rpc/mining.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1c0fdde62..aff8f3fa3 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 19) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 1) +define(_CLIENT_VERSION_BUILD, 2) define(_CLIENT_VERSION_RC, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2020) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index eb94a1fd8..300276d2e 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -369,6 +369,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) UniValue lpval = NullUniValue; std::set setClientRules; int64_t nMaxVersionPreVB = -1; + UniValue aMutable(UniValue::VARR); if (!request.params[0].isNull()) { const UniValue& oparam = request.params[0].get_obj(); @@ -383,6 +384,13 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); lpval = find_value(oparam, "longpollid"); + const UniValue& capval = find_value(oparam, "capabilities"); + if (capval.isArray()) { + for (std::size_t i = 0; i < capval.size(); ++i) + if (capval[i].get_str().rfind("coinbase/", 0) == 0) // we don't care what they do to the coinbase + aMutable.push_back(capval[i]); + } + if (strMode == "proposal") { const UniValue& dataval = find_value(oparam, "data"); @@ -573,7 +581,6 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); - UniValue aMutable(UniValue::VARR); aMutable.push_back("time"); aMutable.push_back("transactions"); aMutable.push_back("prevblock"); @@ -623,6 +630,10 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) } } } + if (pindexPrev->nHeight + 1 >= consensusParams.CSVHeight) + aRules.push_back("csv"); + if (pindexPrev->nHeight + 1 >= consensusParams.SegwitHeight) + aRules.push_back("segwit"); result.pushKV("version", pblock->nVersion); result.pushKV("rules", aRules); result.pushKV("vbavailable", vbavailable);