aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2023-09-07 19:16:57 +1000
committerAnthony Towns <aj@erisian.com.au>2023-11-14 08:45:30 +1000
commit6e9e4e6130797b721c8df1eabaf46ec25ebb6abe (patch)
tree6444c337cd23d1e6aabedf229a9efb1583fb7351 /src/rpc/blockchain.cpp
parent5800c558eb5efb4839ed00d6967e43306d68e1c3 (diff)
Use ParamsWrapper for witness serialization
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 7b84747a3f..9a29b73bee 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -166,8 +166,8 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn
{
UniValue result = blockheaderToJSON(tip, blockindex);
- result.pushKV("strippedsize", (int)::GetSerializeSize(block, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS));
- result.pushKV("size", (int)::GetSerializeSize(block, PROTOCOL_VERSION));
+ result.pushKV("strippedsize", (int)::GetSerializeSize(TX_NO_WITNESS(block)));
+ result.pushKV("size", (int)::GetSerializeSize(TX_WITH_WITNESS(block)));
result.pushKV("weight", (int)::GetBlockWeight(block));
UniValue txs(UniValue::VARR);
@@ -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, RPCSerializationFlags(), txundo, verbosity);
+ TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, /*without_witness=*/RPCSerializationWithoutWitness(), txundo, verbosity);
txs.push_back(objTx);
}
break;
@@ -740,8 +740,8 @@ static RPCHelpMan getblock()
if (verbosity <= 0)
{
- CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
- ssBlock << block;
+ DataStream ssBlock;
+ ssBlock << RPCTxSerParams(block);
std::string strHex = HexStr(ssBlock);
return strHex;
}