Skip to content

Commit ddd395f

Browse files
author
MarcoFalke
committed
Mark CTxMemPoolEntry members that should not be modified const
1 parent fa5ed4f commit ddd395f

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/txmempool.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020

2121
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee,
2222
int64_t _nTime, unsigned int _entryHeight,
23-
bool _spendsCoinbase, int64_t _sigOpsCost, LockPoints lp):
24-
tx(_tx), nFee(_nFee), nTime(_nTime), entryHeight(_entryHeight),
23+
bool _spendsCoinbase, int64_t _sigOpsCost, LockPoints lp)
24+
: tx(_tx), nFee(_nFee), nTxWeight(GetTransactionWeight(*tx)), nUsageSize(RecursiveDynamicUsage(tx)), nTime(_nTime), entryHeight(_entryHeight),
2525
spendsCoinbase(_spendsCoinbase), sigOpCost(_sigOpsCost), lockPoints(lp)
2626
{
27-
nTxWeight = GetTransactionWeight(*tx);
28-
nUsageSize = RecursiveDynamicUsage(tx);
29-
3027
nCountWithDescendants = 1;
3128
nSizeWithDescendants = GetTxSize();
3229
nModFeesWithDescendants = nFee;

src/txmempool.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ class CTxMemPool;
6464
class CTxMemPoolEntry
6565
{
6666
private:
67-
CTransactionRef tx;
68-
CAmount nFee; //!< Cached to avoid expensive parent-transaction lookups
69-
size_t nTxWeight; //!< ... and avoid recomputing tx weight (also used for GetTxSize())
70-
size_t nUsageSize; //!< ... and total memory usage
71-
int64_t nTime; //!< Local time when entering the mempool
72-
unsigned int entryHeight; //!< Chain height when entering the mempool
73-
bool spendsCoinbase; //!< keep track of transactions that spend a coinbase
74-
int64_t sigOpCost; //!< Total sigop cost
67+
const CTransactionRef tx;
68+
const CAmount nFee; //!< Cached to avoid expensive parent-transaction lookups
69+
const size_t nTxWeight; //!< ... and avoid recomputing tx weight (also used for GetTxSize())
70+
const size_t nUsageSize; //!< ... and total memory usage
71+
const int64_t nTime; //!< Local time when entering the mempool
72+
const unsigned int entryHeight; //!< Chain height when entering the mempool
73+
const bool spendsCoinbase; //!< keep track of transactions that spend a coinbase
74+
const int64_t sigOpCost; //!< Total sigop cost
7575
int64_t feeDelta; //!< Used for determining the priority of the transaction for mining in a block
7676
LockPoints lockPoints; //!< Track the height and time at which tx was final
7777

0 commit comments

Comments
 (0)