diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 4c4e599..be02636 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -579,6 +579,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
transactions.push_back(entry);
}
+ int64_t nBlockReward = pblock->vtx[0].vout[0].nValue;
UniValue aux(UniValue::VOBJ);
aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
@@ -623,14 +624,20 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
{
// 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 (pos == DEPLOYMENT_SEGWIT) {
+ transactions = UniValue(UniValue::VARR);
+ nBlockReward = GetBlockSubsidy(pindexPrev->nHeight+1, consensusParams);
+ aRules.push_back("no-segwit");
+ break;
+ }
// 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));
}
}
+ aRules.push_back(gbt_vb_name(pos));
break;
}
}
@@ -651,7 +658,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
result.push_back(Pair("transactions", transactions));
result.push_back(Pair("coinbaseaux", aux));
- result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
+ result.push_back(Pair("coinbasevalue", nBlockReward));
result.push_back(Pair("longpollid", chainActive.Tip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast)));
result.push_back(Pair("target", hashTarget.GetHex()));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));