aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blockencodings.cpp2
-rw-r--r--src/coins.cpp2
-rw-r--r--src/index/blockfilterindex.cpp4
-rw-r--r--src/node/blockstorage.cpp4
-rw-r--r--src/rpc/blockchain.cpp4
-rw-r--r--src/script/interpreter.cpp2
-rw-r--r--src/script/sign.cpp2
-rw-r--r--src/serialize.h2
-rw-r--r--src/test/flatfile_tests.cpp2
-rw-r--r--src/test/fuzz/miniscript.cpp2
-rw-r--r--src/test/miniscript_tests.cpp2
-rw-r--r--src/test/serialize_tests.cpp48
-rw-r--r--src/test/uint256_tests.cpp8
-rw-r--r--src/wallet/spend.cpp2
14 files changed, 43 insertions, 43 deletions
diff --git a/src/blockencodings.cpp b/src/blockencodings.cpp
index 29306b2229..1e940e8f03 100644
--- a/src/blockencodings.cpp
+++ b/src/blockencodings.cpp
@@ -164,7 +164,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
break;
}
- LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock, PROTOCOL_VERSION));
+ LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock));
return READ_STATUS_OK;
}
diff --git a/src/coins.cpp b/src/coins.cpp
index b44d920ee1..976fb50855 100644
--- a/src/coins.cpp
+++ b/src/coins.cpp
@@ -339,7 +339,7 @@ void CCoinsViewCache::SanityCheck() const
assert(recomputed_usage == cachedCoinsUsage);
}
-static const size_t MIN_TRANSACTION_OUTPUT_WEIGHT = WITNESS_SCALE_FACTOR * ::GetSerializeSize(CTxOut(), PROTOCOL_VERSION);
+static const size_t MIN_TRANSACTION_OUTPUT_WEIGHT = WITNESS_SCALE_FACTOR * ::GetSerializeSize(CTxOut());
static const size_t MAX_OUTPUTS_PER_BLOCK = MAX_BLOCK_WEIGHT / MIN_TRANSACTION_OUTPUT_WEIGHT;
const Coin& AccessByTxid(const CCoinsViewCache& view, const uint256& txid)
diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp
index 5fda798efd..58f777b326 100644
--- a/src/index/blockfilterindex.cpp
+++ b/src/index/blockfilterindex.cpp
@@ -174,8 +174,8 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&
assert(filter.GetFilterType() == GetFilterType());
size_t data_size =
- GetSerializeSize(filter.GetBlockHash(), CLIENT_VERSION) +
- GetSerializeSize(filter.GetEncodedFilter(), CLIENT_VERSION);
+ GetSerializeSize(filter.GetBlockHash()) +
+ GetSerializeSize(filter.GetEncodedFilter());
// If writing the filter would overflow the file, flush and move to the next one.
if (pos.nPos + data_size > MAX_FLTR_FILE_SIZE) {
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index 1108cc676b..c066d1c939 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -662,7 +662,7 @@ bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos
}
// Write index header
- unsigned int nSize = GetSerializeSize(blockundo, CLIENT_VERSION);
+ unsigned int nSize = GetSerializeSize(blockundo);
fileout << GetParams().MessageStart() << nSize;
// Write undo data
@@ -979,7 +979,7 @@ bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValid
// Write undo information to disk
if (block.GetUndoPos().IsNull()) {
FlatFilePos _pos;
- if (!FindUndoPos(state, block.nFile, _pos, ::GetSerializeSize(blockundo, CLIENT_VERSION) + 40)) {
+ if (!FindUndoPos(state, block.nFile, _pos, ::GetSerializeSize(blockundo) + 40)) {
return error("ConnectBlock(): FindUndoPos failed");
}
if (!UndoWriteToDisk(blockundo, _pos, block.pprev->GetBlockHash())) {
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 9a29b73bee..6a3aa397d9 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1861,7 +1861,7 @@ static RPCHelpMan getblockstats()
for (const CTxOut& out : tx->vout) {
tx_total_out += out.nValue;
- size_t out_size = GetSerializeSize(out, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
+ size_t out_size = GetSerializeSize(out) + PER_UTXO_OVERHEAD;
utxo_size_inc += out_size;
// The Genesis block and the repeated BIP30 block coinbases don't change the UTXO
@@ -1913,7 +1913,7 @@ static RPCHelpMan getblockstats()
const CTxOut& prevoutput = coin.out;
tx_total_in += prevoutput.nValue;
- size_t prevout_size = GetSerializeSize(prevoutput, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
+ size_t prevout_size = GetSerializeSize(prevoutput) + PER_UTXO_OVERHEAD;
utxo_size_inc -= prevout_size;
utxo_size_inc_actual -= prevout_size;
}
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index 5f4a1aceb2..c969ce45f1 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -1934,7 +1934,7 @@ static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion,
if ((control[0] & TAPROOT_LEAF_MASK) == TAPROOT_LEAF_TAPSCRIPT) {
// Tapscript (leaf version 0xc0)
exec_script = CScript(script.begin(), script.end());
- execdata.m_validation_weight_left = ::GetSerializeSize(witness.stack, PROTOCOL_VERSION) + VALIDATION_WEIGHT_OFFSET;
+ execdata.m_validation_weight_left = ::GetSerializeSize(witness.stack) + VALIDATION_WEIGHT_OFFSET;
execdata.m_validation_weight_left_init = true;
return ExecuteWitnessScript(stack, exec_script, flags, SigVersion::TAPSCRIPT, checker, execdata, serror);
}
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 251a8420f7..be4b357568 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -379,7 +379,7 @@ static bool SignTaproot(const SigningProvider& provider, const BaseSignatureCrea
result_stack.emplace_back(std::begin(script), std::end(script)); // Push the script
result_stack.push_back(*control_blocks.begin()); // Push the smallest control block
if (smallest_result_stack.size() == 0 ||
- GetSerializeSize(result_stack, PROTOCOL_VERSION) < GetSerializeSize(smallest_result_stack, PROTOCOL_VERSION)) {
+ GetSerializeSize(result_stack) < GetSerializeSize(smallest_result_stack)) {
smallest_result_stack = std::move(result_stack);
}
}
diff --git a/src/serialize.h b/src/serialize.h
index 9d8867fd64..83715866f5 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -1121,7 +1121,7 @@ inline void WriteCompactSize(SizeComputer &s, uint64_t nSize)
}
template <typename T>
-size_t GetSerializeSize(const T& t, int nVersion = 0)
+size_t GetSerializeSize(const T& t)
{
return (SizeComputer() << t).size();
}
diff --git a/src/test/flatfile_tests.cpp b/src/test/flatfile_tests.cpp
index 3874b38f61..21a36d9d43 100644
--- a/src/test/flatfile_tests.cpp
+++ b/src/test/flatfile_tests.cpp
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(flatfile_open)
"lost if a trusted third party is still required to prevent double-spending.");
size_t pos1 = 0;
- size_t pos2 = pos1 + GetSerializeSize(line1, CLIENT_VERSION);
+ size_t pos2 = pos1 + GetSerializeSize(line1);
// Write first line to file.
{
diff --git a/src/test/fuzz/miniscript.cpp b/src/test/fuzz/miniscript.cpp
index 8c73edfa9d..0d0ee59ab3 100644
--- a/src/test/fuzz/miniscript.cpp
+++ b/src/test/fuzz/miniscript.cpp
@@ -1121,7 +1121,7 @@ void TestNode(const MsCtx script_ctx, const NodeRef& node, FuzzedDataProvider& p
assert(mal_success);
assert(stack_nonmal == stack_mal);
// Compute witness size (excluding script push, control block, and witness count encoding).
- const size_t wit_size = GetSerializeSize(stack_nonmal, PROTOCOL_VERSION) - GetSizeOfCompactSize(stack_nonmal.size());
+ const size_t wit_size = GetSerializeSize(stack_nonmal) - GetSizeOfCompactSize(stack_nonmal.size());
assert(wit_size <= *node->GetWitnessSize());
// Test non-malleable satisfaction.
diff --git a/src/test/miniscript_tests.cpp b/src/test/miniscript_tests.cpp
index 996c379962..1f28e61bc9 100644
--- a/src/test/miniscript_tests.cpp
+++ b/src/test/miniscript_tests.cpp
@@ -369,7 +369,7 @@ void TestSatisfy(const KeyConverter& converter, const std::string& testcase, con
CScriptWitness witness_nonmal;
const bool nonmal_success = node->Satisfy(satisfier, witness_nonmal.stack, true) == miniscript::Availability::YES;
// Compute witness size (excluding script push, control block, and witness count encoding).
- const size_t wit_size = GetSerializeSize(witness_nonmal.stack, PROTOCOL_VERSION) - GetSizeOfCompactSize(witness_nonmal.stack.size());
+ const size_t wit_size = GetSerializeSize(witness_nonmal.stack) - GetSizeOfCompactSize(witness_nonmal.stack.size());
SatisfactionToWitness(converter.MsContext(), witness_nonmal, script, builder);
if (nonmal_success) {
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 6d5a14ad9e..d75eb499b4 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -62,31 +62,31 @@ public:
BOOST_AUTO_TEST_CASE(sizes)
{
- BOOST_CHECK_EQUAL(sizeof(unsigned char), GetSerializeSize((unsigned char)0, 0));
- BOOST_CHECK_EQUAL(sizeof(int8_t), GetSerializeSize(int8_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(uint8_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(int16_t), GetSerializeSize(int16_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(uint16_t), GetSerializeSize(uint16_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(int32_t), GetSerializeSize(int32_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(uint32_t), GetSerializeSize(uint32_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(int64_t), GetSerializeSize(int64_t(0), 0));
- BOOST_CHECK_EQUAL(sizeof(uint64_t), GetSerializeSize(uint64_t(0), 0));
+ BOOST_CHECK_EQUAL(sizeof(unsigned char), GetSerializeSize((unsigned char)0));
+ BOOST_CHECK_EQUAL(sizeof(int8_t), GetSerializeSize(int8_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(uint8_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(int16_t), GetSerializeSize(int16_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(uint16_t), GetSerializeSize(uint16_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(int32_t), GetSerializeSize(int32_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(uint32_t), GetSerializeSize(uint32_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(int64_t), GetSerializeSize(int64_t(0)));
+ BOOST_CHECK_EQUAL(sizeof(uint64_t), GetSerializeSize(uint64_t(0)));
// Bool is serialized as uint8_t
- BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(bool(0), 0));
+ BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(bool(0)));
// Sanity-check GetSerializeSize and c++ type matching
- BOOST_CHECK_EQUAL(GetSerializeSize((unsigned char)0, 0), 1U);
- BOOST_CHECK_EQUAL(GetSerializeSize(int8_t(0), 0), 1U);
- BOOST_CHECK_EQUAL(GetSerializeSize(uint8_t(0), 0), 1U);
- BOOST_CHECK_EQUAL(GetSerializeSize(int16_t(0), 0), 2U);
- BOOST_CHECK_EQUAL(GetSerializeSize(uint16_t(0), 0), 2U);
- BOOST_CHECK_EQUAL(GetSerializeSize(int32_t(0), 0), 4U);
- BOOST_CHECK_EQUAL(GetSerializeSize(uint32_t(0), 0), 4U);
- BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8U);
- BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8U);
- BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1U);
- BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 1>{0}, 0), 1U);
- BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 2>{0, 0}, 0), 2U);
+ BOOST_CHECK_EQUAL(GetSerializeSize((unsigned char)0), 1U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(int8_t(0)), 1U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(uint8_t(0)), 1U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(int16_t(0)), 2U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(uint16_t(0)), 2U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(int32_t(0)), 4U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(uint32_t(0)), 4U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0)), 8U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0)), 8U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(bool(0)), 1U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 1>{0}), 1U);
+ BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 2>{0, 0}), 2U);
}
BOOST_AUTO_TEST_CASE(varints)
@@ -97,13 +97,13 @@ BOOST_AUTO_TEST_CASE(varints)
DataStream::size_type size = 0;
for (int i = 0; i < 100000; i++) {
ss << VARINT_MODE(i, VarIntMode::NONNEGATIVE_SIGNED);
- size += ::GetSerializeSize(VARINT_MODE(i, VarIntMode::NONNEGATIVE_SIGNED), 0);
+ size += ::GetSerializeSize(VARINT_MODE(i, VarIntMode::NONNEGATIVE_SIGNED));
BOOST_CHECK(size == ss.size());
}
for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) {
ss << VARINT(i);
- size += ::GetSerializeSize(VARINT(i), 0);
+ size += ::GetSerializeSize(VARINT(i));
BOOST_CHECK(size == ss.size());
}
diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp
index 9caefe43e2..933988dd7a 100644
--- a/src/test/uint256_tests.cpp
+++ b/src/test/uint256_tests.cpp
@@ -184,8 +184,8 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G
BOOST_CHECK(OneL.begin() + 32 == OneL.end());
BOOST_CHECK(MaxL.begin() + 32 == MaxL.end());
BOOST_CHECK(TmpL.begin() + 32 == TmpL.end());
- BOOST_CHECK(GetSerializeSize(R1L, PROTOCOL_VERSION) == 32);
- BOOST_CHECK(GetSerializeSize(ZeroL, PROTOCOL_VERSION) == 32);
+ BOOST_CHECK(GetSerializeSize(R1L) == 32);
+ BOOST_CHECK(GetSerializeSize(ZeroL) == 32);
DataStream ss{};
ss << R1L;
@@ -230,8 +230,8 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G
BOOST_CHECK(OneS.begin() + 20 == OneS.end());
BOOST_CHECK(MaxS.begin() + 20 == MaxS.end());
BOOST_CHECK(TmpS.begin() + 20 == TmpS.end());
- BOOST_CHECK(GetSerializeSize(R1S, PROTOCOL_VERSION) == 20);
- BOOST_CHECK(GetSerializeSize(ZeroS, PROTOCOL_VERSION) == 20);
+ BOOST_CHECK(GetSerializeSize(R1S) == 20);
+ BOOST_CHECK(GetSerializeSize(ZeroS) == 20);
ss << R1S;
BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+20));
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index ed0134375c..86838597e6 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -1081,7 +1081,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
CTxOut txout(recipient.nAmount, GetScriptForDestination(recipient.dest));
// Include the fee cost for outputs.
- coin_selection_params.tx_noinputs_size += ::GetSerializeSize(txout, PROTOCOL_VERSION);
+ coin_selection_params.tx_noinputs_size += ::GetSerializeSize(txout);
if (IsDust(txout, wallet.chain().relayDustFee())) {
return util::Error{_("Transaction amount too small")};