error w/o segwit after fork

This commit is contained in:
Brannon King 2019-10-11 14:16:38 -06:00 committed by Anthony Fieroni
parent 7a18c405e3
commit c4ee529ab4

View file

@ -554,6 +554,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
// NOTE: If at some point we support pre-segwit miners post-segwit-activation, this needs to take segwit support into consideration
const bool fPreSegWit = (pindexPrev->nHeight + 1 < consensusParams.SegwitHeight);
if (!fPreSegWit && !fSupportsSegwit)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Segwit support is now required. Please include \"segwit\" in the client's rules.");
UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");
UniValue result(UniValue::VOBJ);
@ -572,7 +574,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
UniValue entry(UniValue::VOBJ);
entry.pushKV("data", EncodeHexTx(tx, fSupportsSegwit ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS));
entry.pushKV("data", EncodeHexTx(tx));
entry.pushKV("txid", txHash.GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
@ -608,7 +610,6 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
aMutable.push_back("time");
aMutable.push_back("transactions");
aMutable.push_back("prevblock");
aMutable.push_back("submit/coinbase");
result.pushKV("capabilities", aCaps);