fixed missing flags in getblocktemplate

This commit is contained in:
Brannon King 2020-04-19 10:34:43 -06:00
parent 52d1eddadc
commit 905f744baf
2 changed files with 13 additions and 2 deletions

View file

@ -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)

View file

@ -369,6 +369,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
UniValue lpval = NullUniValue;
std::set<std::string> 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);