Remove deprecated -rpcserialversion

This commit is contained in:
MarcoFalke
2023-11-16 10:35:08 +01:00
parent d5e5810bd3
commit fa46cc22bc
14 changed files with 19 additions and 80 deletions

View File

@@ -189,7 +189,7 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn
// coinbase transaction (i.e. i == 0) doesn't have undo data
const CTxUndo* txundo = (have_undo && i > 0) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
UniValue objTx(UniValue::VOBJ);
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, /*without_witness=*/RPCSerializationWithoutWitness(), txundo, verbosity);
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, txundo, verbosity);
txs.push_back(objTx);
}
break;
@@ -738,10 +738,9 @@ static RPCHelpMan getblock()
const CBlock block{GetBlockChecked(chainman.m_blockman, pblockindex)};
if (verbosity <= 0)
{
if (verbosity <= 0) {
DataStream ssBlock;
ssBlock << RPCTxSerParams(block);
ssBlock << TX_WITH_WITNESS(block);
std::string strHex = HexStr(ssBlock);
return strHex;
}

View File

@@ -400,7 +400,7 @@ static RPCHelpMan generateblock()
obj.pushKV("hash", block_out->GetHash().GetHex());
if (!process_new_block) {
DataStream block_ser;
block_ser << RPCTxSerParams(*block_out);
block_ser << TX_WITH_WITNESS(*block_out);
obj.pushKV("hex", HexStr(block_ser));
}
return obj;

View File

@@ -62,7 +62,7 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
// Blockchain contextual information (confirmations and blocktime) is not
// available to code in bitcoin-common, so we query them here and push the
// data into the returned UniValue.
TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, RPCSerializationWithoutWitness(), txundo, verbosity);
TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, txundo, verbosity);
if (!hashBlock.IsNull()) {
LOCK(cs_main);
@@ -383,7 +383,7 @@ static RPCHelpMan getrawtransaction()
}
if (verbosity <= 0) {
return EncodeHexTx(*tx, /*without_witness=*/RPCSerializationWithoutWitness());
return EncodeHexTx(*tx);
}
UniValue result(UniValue::VOBJ);

View File

@@ -595,9 +595,4 @@ void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nS
deadlineTimers.emplace(name, std::unique_ptr<RPCTimerBase>(timerInterface->NewTimer(func, nSeconds*1000)));
}
bool RPCSerializationWithoutWitness()
{
return (gArgs.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) == 0);
}
CRPCTable tableRPC;

View File

@@ -16,8 +16,6 @@
#include <univalue.h>
static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1;
class CRPCCommand;
namespace RPCServer
@@ -183,14 +181,4 @@ void InterruptRPC();
void StopRPC();
std::string JSONRPCExecBatch(const JSONRPCRequest& jreq, const UniValue& vReq);
// Drop witness when serializing for RPC?
bool RPCSerializationWithoutWitness();
template<typename T>
auto RPCTxSerParams(T&& t)
{
if (RPCSerializationWithoutWitness()) return TX_NO_WITNESS(t);
return TX_WITH_WITNESS(t);
}
#endif // BITCOIN_RPC_SERVER_H