Skip to content

Commit a264d57

Browse files
committed
Merge 143ace6 into merged_master (Bitcoin PR bitcoin/bitcoin#28890)
2 parents ab7b9b0 + 143ace6 commit a264d57

File tree

15 files changed

+22
-82
lines changed

15 files changed

+22
-82
lines changed

src/core_io.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ bool ParseHashStr(const std::string& strHex, uint256& result);
5353
// core_write.cpp
5454
UniValue ValueFromAmount(const CAmount amount);
5555
std::string FormatScript(const CScript& script);
56-
std::string EncodeHexTx(const CTransaction& tx, const bool without_witness = false);
56+
std::string EncodeHexTx(const CTransaction& tx);
5757
UniValue EncodeHexScriptWitness(const CScriptWitness& witness);
5858
std::string SighashToStr(unsigned char sighash_type);
5959
void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex = true, bool include_address = false, const SigningProvider* provider = nullptr);
60-
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);
60+
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex = true, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS);
6161

6262
#endif // BITCOIN_CORE_IO_H

src/core_write.cpp

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

172-
std::string EncodeHexTx(const CTransaction& tx, const bool without_witness)
172+
std::string EncodeHexTx(const CTransaction& tx)
173173
{
174174
DataStream ssTx;
175-
if (without_witness) {
176-
ssTx << TX_NO_WITNESS(tx);
177-
} else {
178-
ssTx << TX_WITH_WITNESS(tx);
179-
}
175+
ssTx << TX_WITH_WITNESS(tx);
180176
return HexStr(ssTx);
181177
}
182178

@@ -228,7 +224,7 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool i
228224
}
229225
}
230226

231-
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, bool without_witness, const CTxUndo* txundo, TxVerbosity verbosity)
227+
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, const CTxUndo* txundo, TxVerbosity verbosity)
232228
{
233229
CHECK_NONFATAL(verbosity >= TxVerbosity::SHOW_DETAILS);
234230

@@ -426,6 +422,6 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
426422
}
427423

428424
if (include_hex) {
429-
entry.pushKV("hex", EncodeHexTx(tx, without_witness)); // The hex-encoded transaction. Used the name "hex" to be consistent with the verbose output of "getrawtransaction".
425+
entry.pushKV("hex", EncodeHexTx(tx)); // The hex-encoded transaction. Used the name "hex" to be consistent with the verbose output of "getrawtransaction".
430426
}
431427
}

src/init.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,6 @@ void SetupServerArgs(ArgsManager& argsman)
669669
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);
670670
argsman.AddArg("-rpcpassword=<pw>", "Password for JSON-RPC connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
671671
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);
672-
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);
673672
argsman.AddArg("-rpcservertimeout=<n>", strprintf("Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_SERVER_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
674673
argsman.AddArg("-rpcthreads=<n>", strprintf("Set the number of threads to service RPC calls (default: %d)", DEFAULT_HTTP_THREADS), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
675674
argsman.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
@@ -1092,16 +1091,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
10921091
if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
10931092
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
10941093

1095-
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
1096-
return InitError(Untranslated("rpcserialversion must be non-negative."));
1097-
1098-
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
1099-
return InitError(Untranslated("Unknown rpcserialversion requested."));
1100-
1101-
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) == 0 && !IsDeprecatedRPCEnabled("serialversion")) {
1102-
return InitError(Untranslated("-rpcserialversion=0 is deprecated and will be removed in the future. Specify -deprecatedrpc=serialversion to allow anyway."));
1103-
}
1104-
1094+
// ELEMENTS
11051095
try {
11061096
const std::string default_asset_name = gArgs.GetArg("-defaultpeggedassetname", "bitcoin");
11071097
InitGlobalAssetDir(gArgs.GetArgs("-assetdir"), default_asset_name);

src/interfaces/chain.h

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

340-
//! Current RPC serialization flags.
341-
virtual bool rpcSerializationWithoutWitness() = 0;
342-
343340
//! Get settings value.
344341
virtual common::SettingsValue getSetting(const std::string& arg) = 0;
345342

src/node/interfaces.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,6 @@ class ChainImpl : public Chain
779779
{
780780
RPCRunLater(name, std::move(fn), seconds);
781781
}
782-
bool rpcSerializationWithoutWitness() override { return RPCSerializationWithoutWitness(); }
783782
common::SettingsValue getSetting(const std::string& name) override
784783
{
785784
return args().GetSetting(name);

src/rest.cpp

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

332332
case RESTResponseFormat::HEX: {
333333
DataStream ssBlock;
334-
ssBlock << RPCTxSerParams(block);
334+
ssBlock << TX_WITH_WITNESS(block);
335335
std::string strHex = HexStr(ssBlock) + "\n";
336336
req->WriteHeader("Content-Type", "text/plain");
337337
req->WriteReply(HTTP_OK, strHex);
@@ -728,7 +728,7 @@ static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string
728728
switch (rf) {
729729
case RESTResponseFormat::BINARY: {
730730
DataStream ssTx;
731-
ssTx << RPCTxSerParams(tx);
731+
ssTx << TX_WITH_WITNESS(tx);
732732

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

739739
case RESTResponseFormat::HEX: {
740740
DataStream ssTx;
741-
ssTx << RPCTxSerParams(tx);
741+
ssTx << TX_WITH_WITNESS(tx);
742742

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

src/rpc/blockchain.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn
273273
// coinbase transaction (i.e. i == 0) doesn't have undo data
274274
const CTxUndo* txundo = (have_undo && i > 0) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
275275
UniValue objTx(UniValue::VOBJ);
276-
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, /*without_witness=*/RPCSerializationWithoutWitness(), txundo, verbosity);
276+
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, txundo, verbosity);
277277
txs.push_back(std::move(objTx));
278278
}
279279
break;
@@ -868,10 +868,9 @@ static RPCHelpMan getblock()
868868

869869
const CBlock block{GetBlockChecked(chainman.m_blockman, *pblockindex)};
870870

871-
if (verbosity <= 0)
872-
{
871+
if (verbosity <= 0) {
873872
DataStream ssBlock;
874-
ssBlock << RPCTxSerParams(block);
873+
ssBlock << TX_WITH_WITNESS(block);
875874
std::string strHex = HexStr(ssBlock);
876875
return strHex;
877876
}

src/rpc/mining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static RPCHelpMan generateblock()
419419
obj.pushKV("hash", block_out->GetHash().GetHex());
420420
if (!process_new_block) {
421421
DataStream block_ser;
422-
block_ser << RPCTxSerParams(*block_out);
422+
block_ser << TX_WITH_WITNESS(*block_out);
423423
obj.pushKV("hex", HexStr(block_ser));
424424
}
425425
return obj;
@@ -1329,7 +1329,7 @@ static RPCHelpMan combineblocksigs()
13291329
}
13301330

13311331
DataStream ssBlock;
1332-
ssBlock << RPCTxSerParams(block);
1332+
ssBlock << TX_WITH_WITNESS(block);
13331333
UniValue result(UniValue::VOBJ);
13341334
result.pushKV("hex", HexStr(ssBlock));
13351335
result.pushKV("complete", CheckProof(block, params));

src/rpc/rawtransaction.cpp

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

7979
if (!hashBlock.IsNull()) {
8080
LOCK(cs_main);
@@ -450,7 +450,7 @@ static RPCHelpMan getrawtransaction()
450450
}
451451

452452
if (verbosity <= 0) {
453-
return EncodeHexTx(CTransaction(*tx), /*without_witness=*/RPCSerializationWithoutWitness());
453+
return EncodeHexTx(CTransaction(*tx));
454454
}
455455

456456
UniValue result(UniValue::VOBJ);

src/rpc/server.cpp

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

600-
bool RPCSerializationWithoutWitness()
601-
{
602-
return (gArgs.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) == 0);
603-
}
604-
605600
CRPCTable tableRPC;

0 commit comments

Comments
 (0)