Skip to content

Commit f05e692

Browse files
committed
Drop unused GetType() from CSizeComputer
Based on btc@da74db0940720407fafaf3582bbaf9c81a4d3b4d
1 parent 5c36b3d commit f05e692

19 files changed

+54
-67
lines changed

src/coins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ bool CCoinsViewCache::PruneInvalidEntries()
429429
return Flush();
430430
}
431431

432-
static const size_t MAX_OUTPUTS_PER_BLOCK = MAX_BLOCK_SIZE_CURRENT / ::GetSerializeSize(CTxOut(), SER_NETWORK, PROTOCOL_VERSION); // TODO: merge with similar definition in undo.h.
432+
static const size_t MAX_OUTPUTS_PER_BLOCK = MAX_BLOCK_SIZE_CURRENT / ::GetSerializeSize(CTxOut(), PROTOCOL_VERSION); // TODO: merge with similar definition in undo.h.
433433

434434
const Coin& AccessByTxid(const CCoinsViewCache& view, const uint256& txid)
435435
{

src/core_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry)
167167
entry.pushKV("txid", tx.GetHash().GetHex());
168168
entry.pushKV("version", tx.nVersion);
169169
entry.pushKV("type", tx.nType);
170-
entry.pushKV("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION));
170+
entry.pushKV("size", (int)::GetSerializeSize(tx, PROTOCOL_VERSION));
171171
entry.pushKV("locktime", (int64_t)tx.nLockTime);
172172

173173
UniValue vin(UniValue::VARR);

src/dbwrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ class CDBTransaction {
607607
template <typename V>
608608
void Write(const CDataStream& ssKey, const V& v)
609609
{
610-
auto valueMemoryUsage = ::GetSerializeSize(v, SER_DISK, CLIENT_VERSION);
610+
auto valueMemoryUsage = ::GetSerializeSize(v, CLIENT_VERSION);
611611
if (deletes.erase(ssKey)) {
612612
memoryUsage -= ssKey.size();
613613
}

src/miner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake)
188188
IncrementExtraNonce(pblock, pindexPrev->nHeight + 1, nExtraNonce);
189189

190190
LogPrintf("Running PIVXMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
191-
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
191+
::GetSerializeSize(*pblock, PROTOCOL_VERSION));
192192

193193
//
194194
// Search

src/policy/policy.cpp

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

34-
size_t nSize = GetSerializeSize(txout, SER_DISK, 0);
34+
size_t nSize = GetSerializeSize(txout, 0);
3535
nSize += (32 + 4 + 1 + 107 + 4); // the 148 mentioned above
3636
return dustRelayFeeIn.GetFee(nSize);
3737
}

src/primitives/transaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const
252252
// Providing any more cleanup incentive than making additional inputs free would
253253
// risk encouraging people to create junk outputs to redeem later.
254254
if (nTxSize == 0)
255-
nTxSize = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
255+
nTxSize = ::GetSerializeSize(*this, PROTOCOL_VERSION);
256256
for (std::vector<CTxIn>::const_iterator it(vin.begin()); it != vin.end(); ++it)
257257
{
258258
unsigned int offset = 41U + std::min(110U, (unsigned int)it->scriptSig.size());
@@ -264,7 +264,7 @@ unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const
264264

265265
unsigned int CTransaction::GetTotalSize() const
266266
{
267-
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
267+
return ::GetSerializeSize(*this, PROTOCOL_VERSION);
268268
}
269269

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

src/qt/walletmodeltransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CTransactionRef& WalletModelTransaction::getTransaction()
3030

3131
unsigned int WalletModelTransaction::getTransactionSize()
3232
{
33-
return (!walletTransaction ? 0 : (::GetSerializeSize(*walletTransaction, SER_NETWORK, PROTOCOL_VERSION)));
33+
return (!walletTransaction ? 0 : (::GetSerializeSize(*walletTransaction, PROTOCOL_VERSION)));
3434
}
3535

3636
CAmount WalletModelTransaction::getTransactionFee()

src/rpc/blockchain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
137137
if (chainActive.Contains(blockindex))
138138
confirmations = chainActive.Height() - blockindex->nHeight + 1;
139139
result.pushKV("confirmations", confirmations);
140-
result.pushKV("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION));
140+
result.pushKV("size", (int)::GetSerializeSize(block, PROTOCOL_VERSION));
141141
result.pushKV("height", blockindex->nHeight);
142142
result.pushKV("version", block.nVersion);
143143
result.pushKV("merkleroot", block.hashMerkleRoot.GetHex());
@@ -1361,7 +1361,7 @@ UniValue getblockindexstats(const JSONRPCRequest& request) {
13611361
continue;
13621362

13631363
// Transaction size
1364-
nBytes += GetSerializeSize(tx, SER_NETWORK, CLIENT_VERSION);
1364+
nBytes += GetSerializeSize(tx, CLIENT_VERSION);
13651365

13661366
// Transparent inputs
13671367
for (unsigned int j = 0; j < tx.vin.size(); j++) {

src/sapling/sapling_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ OperationResult CheckTransactionSize(std::vector<SendManyRecipient>& recipients,
569569
}
570570
}
571571
CTransaction tx(mtx);
572-
size_t txsize = GetSerializeSize(tx, SER_NETWORK, tx.nVersion) + CTXOUT_REGULAR_SIZE * nTransparentOuts;
572+
size_t txsize = tx.GetTotalSize() + CTXOUT_REGULAR_SIZE * nTransparentOuts;
573573
if (fromTaddr) {
574574
txsize += CTXIN_SPEND_DUST_SIZE;
575575
txsize += CTXOUT_REGULAR_SIZE; // There will probably be taddr change

src/script/bitcoinconsensus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned i
8181
CTransaction tx(deserialize, stream);
8282
if (nIn >= tx.vin.size())
8383
return set_error(err, bitcoinconsensus_ERR_TX_INDEX);
84-
if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen)
84+
if (GetSerializeSize(tx, PROTOCOL_VERSION) != txToLen)
8585
return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
8686

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

0 commit comments

Comments
 (0)