ensure we don't return witness data in the transaction w/o segwit rule

This commit is contained in:
Brannon King 2019-10-09 21:53:07 -06:00 committed by Anthony Fieroni
parent b10163f1ce
commit 9252cbf32d

View file

@ -443,7 +443,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if (Params().NetworkIDString() != CBaseChainParams::REGTEST) // who should own this constant?
if (Params().NetworkIDString() == CBaseChainParams::MAIN)
{
if (!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
@ -572,7 +572,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
UniValue entry(UniValue::VOBJ);
entry.pushKV("data", EncodeHexTx(tx));
entry.pushKV("data", EncodeHexTx(tx, fSupportsSegwit ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS));
entry.pushKV("txid", txHash.GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());