Skip to content

Commit fa46cc2

Browse files
author
MarcoFalke
committed
Remove deprecated -rpcserialversion
1 parent d5e5810 commit fa46cc2

File tree

14 files changed

+19
-80
lines changed

14 files changed

+19
-80
lines changed

src/core_io.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ bool ParseHashStr(const std::string& strHex, uint256& result);
5151
// core_write.cpp
5252
UniValue ValueFromAmount(const CAmount amount);
5353
std::string FormatScript(const CScript& script);
54-
std::string EncodeHexTx(const CTransaction& tx, const bool without_witness = false);
54+
std::string EncodeHexTx(const CTransaction& tx);
5555
std::string SighashToStr(unsigned char sighash_type);
5656
void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex = true, bool include_address = false, const SigningProvider* provider = nullptr);
57-
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex = true, bool without_witness = false, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS);
57+
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex = true, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS);
5858

5959
#endif // BITCOIN_CORE_IO_H

src/core_write.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,10 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
140140
return str;
141141
}
142142

143-
std::string EncodeHexTx(const CTransaction& tx, const bool without_witness)
143+
std::string EncodeHexTx(const CTransaction& tx)
144144
{
145145
DataStream ssTx;
146-
if (without_witness) {
147-
ssTx << TX_NO_WITNESS(tx);
148-
} else {
149-
ssTx << TX_WITH_WITNESS(tx);
150-
}
146+
ssTx << TX_WITH_WITNESS(tx);
151147
return HexStr(ssTx);
152148
}
153149

@@ -172,7 +168,7 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool i
172168
out.pushKV("type", GetTxnOutputType(type));
173169
}
174170

175-
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, bool without_witness, const CTxUndo* txundo, TxVerbosity verbosity)
171+
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, const CTxUndo* txundo, TxVerbosity verbosity)
176172
{
177173
CHECK_NONFATAL(verbosity >= TxVerbosity::SHOW_DETAILS);
178174

@@ -268,6 +264,6 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
268264
}
269265

270266
if (include_hex) {
271-
entry.pushKV("hex", EncodeHexTx(tx, without_witness)); // The hex-encoded transaction. Used the name "hex" to be consistent with the verbose output of "getrawtransaction".
267+
entry.pushKV("hex", EncodeHexTx(tx)); // The hex-encoded transaction. Used the name "hex" to be consistent with the verbose output of "getrawtransaction".
272268
}
273269
}

src/init.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,6 @@ void SetupServerArgs(ArgsManager& argsman)
638638
argsman.AddArg("-rpccookiefile=<loc>", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
639639
argsman.AddArg("-rpcpassword=<pw>", "Password for JSON-RPC connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
640640
argsman.AddArg("-rpcport=<port>", strprintf("Listen for JSON-RPC connections on <port> (default: %u, testnet: %u, signet: %u, regtest: %u)", defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort(), signetBaseParams->RPCPort(), regtestBaseParams->RPCPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC);
641-
argsman.AddArg("-rpcserialversion", strprintf("Sets the serialization of raw transaction or block hex returned in non-verbose mode, non-segwit(0) (DEPRECATED) or segwit(1) (default: %d)", DEFAULT_RPC_SERIALIZE_VERSION), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
642641
argsman.AddArg("-rpcservertimeout=<n>", strprintf("Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_SERVER_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
643642
argsman.AddArg("-rpcthreads=<n>", strprintf("Set the number of threads to service RPC calls (default: %d)", DEFAULT_HTTP_THREADS), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
644643
argsman.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
@@ -1007,16 +1006,6 @@ bool AppInitParameterInteraction(const ArgsManager& args)
10071006
if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
10081007
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
10091008

1010-
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
1011-
return InitError(Untranslated("rpcserialversion must be non-negative."));
1012-
1013-
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
1014-
return InitError(Untranslated("Unknown rpcserialversion requested."));
1015-
1016-
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) == 0 && !IsDeprecatedRPCEnabled("serialversion")) {
1017-
return InitError(Untranslated("-rpcserialversion=0 is deprecated and will be removed in the future. Specify -deprecatedrpc=serialversion to allow anyway."));
1018-
}
1019-
10201009
// Also report errors from parsing before daemonization
10211010
{
10221011
kernel::Notifications notifications{};

src/interfaces/chain.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@ class Chain
334334
//! Run function after given number of seconds. Cancel any previous calls with same name.
335335
virtual void rpcRunLater(const std::string& name, std::function<void()> fn, int64_t seconds) = 0;
336336

337-
//! Current RPC serialization flags.
338-
virtual bool rpcSerializationWithoutWitness() = 0;
339-
340337
//! Get settings value.
341338
virtual common::SettingsValue getSetting(const std::string& arg) = 0;
342339

src/node/interfaces.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@ class ChainImpl : public Chain
775775
{
776776
RPCRunLater(name, std::move(fn), seconds);
777777
}
778-
bool rpcSerializationWithoutWitness() override { return RPCSerializationWithoutWitness(); }
779778
common::SettingsValue getSetting(const std::string& name) override
780779
{
781780
return args().GetSetting(name);

src/rest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static bool rest_block(const std::any& context,
317317
switch (rf) {
318318
case RESTResponseFormat::BINARY: {
319319
DataStream ssBlock;
320-
ssBlock << RPCTxSerParams(block);
320+
ssBlock << TX_WITH_WITNESS(block);
321321
std::string binaryBlock = ssBlock.str();
322322
req->WriteHeader("Content-Type", "application/octet-stream");
323323
req->WriteReply(HTTP_OK, binaryBlock);
@@ -326,7 +326,7 @@ static bool rest_block(const std::any& context,
326326

327327
case RESTResponseFormat::HEX: {
328328
DataStream ssBlock;
329-
ssBlock << RPCTxSerParams(block);
329+
ssBlock << TX_WITH_WITNESS(block);
330330
std::string strHex = HexStr(ssBlock) + "\n";
331331
req->WriteHeader("Content-Type", "text/plain");
332332
req->WriteReply(HTTP_OK, strHex);
@@ -723,7 +723,7 @@ static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string
723723
switch (rf) {
724724
case RESTResponseFormat::BINARY: {
725725
DataStream ssTx;
726-
ssTx << RPCTxSerParams(tx);
726+
ssTx << TX_WITH_WITNESS(tx);
727727

728728
std::string binaryTx = ssTx.str();
729729
req->WriteHeader("Content-Type", "application/octet-stream");
@@ -733,7 +733,7 @@ static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string
733733

734734
case RESTResponseFormat::HEX: {
735735
DataStream ssTx;
736-
ssTx << RPCTxSerParams(tx);
736+
ssTx << TX_WITH_WITNESS(tx);
737737

738738
std::string strHex = HexStr(ssTx) + "\n";
739739
req->WriteHeader("Content-Type", "text/plain");

src/rpc/blockchain.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn
189189
// coinbase transaction (i.e. i == 0) doesn't have undo data
190190
const CTxUndo* txundo = (have_undo && i > 0) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
191191
UniValue objTx(UniValue::VOBJ);
192-
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, /*without_witness=*/RPCSerializationWithoutWitness(), txundo, verbosity);
192+
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, txundo, verbosity);
193193
txs.push_back(objTx);
194194
}
195195
break;
@@ -738,10 +738,9 @@ static RPCHelpMan getblock()
738738

739739
const CBlock block{GetBlockChecked(chainman.m_blockman, pblockindex)};
740740

741-
if (verbosity <= 0)
742-
{
741+
if (verbosity <= 0) {
743742
DataStream ssBlock;
744-
ssBlock << RPCTxSerParams(block);
743+
ssBlock << TX_WITH_WITNESS(block);
745744
std::string strHex = HexStr(ssBlock);
746745
return strHex;
747746
}

src/rpc/mining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static RPCHelpMan generateblock()
400400
obj.pushKV("hash", block_out->GetHash().GetHex());
401401
if (!process_new_block) {
402402
DataStream block_ser;
403-
block_ser << RPCTxSerParams(*block_out);
403+
block_ser << TX_WITH_WITNESS(*block_out);
404404
obj.pushKV("hex", HexStr(block_ser));
405405
}
406406
return obj;

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
6262
// Blockchain contextual information (confirmations and blocktime) is not
6363
// available to code in bitcoin-common, so we query them here and push the
6464
// data into the returned UniValue.
65-
TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, RPCSerializationWithoutWitness(), txundo, verbosity);
65+
TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, txundo, verbosity);
6666

6767
if (!hashBlock.IsNull()) {
6868
LOCK(cs_main);
@@ -383,7 +383,7 @@ static RPCHelpMan getrawtransaction()
383383
}
384384

385385
if (verbosity <= 0) {
386-
return EncodeHexTx(*tx, /*without_witness=*/RPCSerializationWithoutWitness());
386+
return EncodeHexTx(*tx);
387387
}
388388

389389
UniValue result(UniValue::VOBJ);

src/rpc/server.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,4 @@ void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nS
595595
deadlineTimers.emplace(name, std::unique_ptr<RPCTimerBase>(timerInterface->NewTimer(func, nSeconds*1000)));
596596
}
597597

598-
bool RPCSerializationWithoutWitness()
599-
{
600-
return (gArgs.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) == 0);
601-
}
602-
603598
CRPCTable tableRPC;

0 commit comments

Comments
 (0)