Skip to content

Commit da74db0

Browse files
committed
Drop unused GetType() from CSizeComputer
1 parent 4e9a6f8 commit da74db0

17 files changed

+33
-35
lines changed

src/blockencodings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
162162
break;
163163
}
164164

165-
LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock, SER_NETWORK, PROTOCOL_VERSION));
165+
LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock, PROTOCOL_VERSION));
166166

167167
return READ_STATUS_OK;
168168
}

src/coins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
244244
return true;
245245
}
246246

247-
static const size_t MIN_TRANSACTION_OUTPUT_WEIGHT = WITNESS_SCALE_FACTOR * ::GetSerializeSize(CTxOut(), SER_NETWORK, PROTOCOL_VERSION);
247+
static const size_t MIN_TRANSACTION_OUTPUT_WEIGHT = WITNESS_SCALE_FACTOR * ::GetSerializeSize(CTxOut(), PROTOCOL_VERSION);
248248
static const size_t MAX_OUTPUTS_PER_BLOCK = MAX_BLOCK_WEIGHT / MIN_TRANSACTION_OUTPUT_WEIGHT;
249249

250250
const Coin& AccessByTxid(const CCoinsViewCache& view, const uint256& txid)

src/consensus/tx_verify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
164164
if (tx.vout.empty())
165165
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty");
166166
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
167-
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
167+
if (::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
168168
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
169169

170170
// Check for negative or overflow output values

src/consensus/validation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ class CValidationState {
9595
// weight = (stripped_size * 3) + total_size.
9696
static inline int64_t GetTransactionWeight(const CTransaction& tx)
9797
{
98-
return ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
98+
return ::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(tx, PROTOCOL_VERSION);
9999
}
100100
static inline int64_t GetBlockWeight(const CBlock& block)
101101
{
102-
return ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION);
102+
return ::GetSerializeSize(block, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(block, PROTOCOL_VERSION);
103103
}
104104
static inline int64_t GetTransactionInputWeight(const CTxIn& txin)
105105
{
106106
// scriptWitness size is added here because witnesses and txins are split up in segwit serialization.
107-
return ::GetSerializeSize(txin, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txin, SER_NETWORK, PROTOCOL_VERSION) + ::GetSerializeSize(txin.scriptWitness.stack, SER_NETWORK, PROTOCOL_VERSION);
107+
return ::GetSerializeSize(txin, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txin, PROTOCOL_VERSION) + ::GetSerializeSize(txin.scriptWitness.stack, PROTOCOL_VERSION);
108108
}
109109

110110
#endif // BITCOIN_CONSENSUS_VALIDATION_H

src/core_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
181181
entry.pushKV("txid", tx.GetHash().GetHex());
182182
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
183183
entry.pushKV("version", tx.nVersion);
184-
entry.pushKV("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION));
184+
entry.pushKV("size", (int)::GetSerializeSize(tx, PROTOCOL_VERSION));
185185
entry.pushKV("vsize", (GetTransactionWeight(tx) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR);
186186
entry.pushKV("weight", GetTransactionWeight(tx));
187187
entry.pushKV("locktime", (int64_t)tx.nLockTime);

src/index/txindex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ bool TxIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex)
250250
vPos.reserve(block.vtx.size());
251251
for (const auto& tx : block.vtx) {
252252
vPos.emplace_back(tx->GetHash(), pos);
253-
pos.nTxOffset += ::GetSerializeSize(*tx, SER_DISK, CLIENT_VERSION);
253+
pos.nTxOffset += ::GetSerializeSize(*tx, CLIENT_VERSION);
254254
}
255255
return m_db->WriteTxs(vPos);
256256
}

src/policy/policy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
3434
if (txout.scriptPubKey.IsUnspendable())
3535
return 0;
3636

37-
size_t nSize = GetSerializeSize(txout, SER_DISK, 0);
37+
size_t nSize = GetSerializeSize(txout);
3838
int witnessversion = 0;
3939
std::vector<unsigned char> witnessprogram;
4040

src/primitives/transaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ CAmount CTransaction::GetValueOut() const
9393

9494
unsigned int CTransaction::GetTotalSize() const
9595
{
96-
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
96+
return ::GetSerializeSize(*this, PROTOCOL_VERSION);
9797
}
9898

9999
std::string CTransaction::ToString() const

src/rpc/blockchain.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
121121
if (chainActive.Contains(blockindex))
122122
confirmations = chainActive.Height() - blockindex->nHeight + 1;
123123
result.pushKV("confirmations", confirmations);
124-
result.pushKV("strippedsize", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS));
125-
result.pushKV("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION));
124+
result.pushKV("strippedsize", (int)::GetSerializeSize(block, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS));
125+
result.pushKV("size", (int)::GetSerializeSize(block, PROTOCOL_VERSION));
126126
result.pushKV("weight", (int)::GetBlockWeight(block));
127127
result.pushKV("height", blockindex->nHeight);
128128
result.pushKV("version", block.nVersion);
@@ -1831,7 +1831,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
18311831
if (loop_outputs) {
18321832
for (const CTxOut& out : tx->vout) {
18331833
tx_total_out += out.nValue;
1834-
utxo_size_inc += GetSerializeSize(out, SER_NETWORK, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
1834+
utxo_size_inc += GetSerializeSize(out, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
18351835
}
18361836
}
18371837

@@ -1882,7 +1882,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
18821882
CTxOut prevoutput = tx_in->vout[in.prevout.n];
18831883

18841884
tx_total_in += prevoutput.nValue;
1885-
utxo_size_inc -= GetSerializeSize(prevoutput, SER_NETWORK, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
1885+
utxo_size_inc -= GetSerializeSize(prevoutput, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
18861886
}
18871887

18881888
CAmount txfee = tx_total_in - tx_total_out;

src/script/bitcoinconsensus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int verify_script(const unsigned char *scriptPubKey, unsigned int scriptP
8888
CTransaction tx(deserialize, stream);
8989
if (nIn >= tx.vin.size())
9090
return set_error(err, bitcoinconsensus_ERR_TX_INDEX);
91-
if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen)
91+
if (GetSerializeSize(tx, PROTOCOL_VERSION) != txToLen)
9292
return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
9393

9494
// Regardless of the verification result, the tx did not error.

0 commit comments

Comments
 (0)