@@ -52,6 +52,7 @@ class CTxMemPoolEntry
5252 const int64_t sigOpCost; // !< Total sigop cost
5353 int64_t feeDelta{0 }; // !< Used for determining the priority of the transaction for mining in a block
5454 LockPoints lockPoints; // !< Track the height and time at which tx was final
55+ const int64_t m_tx_size; // !< Virtual transaction size
5556
5657 // Information about descendants of this transaction that are in the
5758 // mempool; if we remove this transaction we must remove all of these
@@ -74,21 +75,19 @@ class CTxMemPoolEntry
7475 nTime (_nTime), entryHeight(_entryHeight),
7576 spendsCoinbase(_spendsCoinbase), sigOpCost(_sigOpsCost), lockPoints(lp),
7677 {
77- nSizeWithDescendants = GetTxSize ();
78+ m_tx_size = GetVirtualTransactionSize (nTxWeight, _sigOpsCost);
79+ nSizeWithDescendants = m_tx_size;
7880 nModFeesWithDescendants = nFee;
7981
80- nSizeWithAncestors = GetTxSize () ;
82+ nSizeWithAncestors = m_tx_size ;
8183 nModFeesWithAncestors = nFee;
8284 nSigOpCostWithAncestors = sigOpCost;
8385 }
8486
8587 const CTransaction& GetTx () const { return *this ->tx ; }
8688 CTransactionRef GetSharedTx () const { return this ->tx ; }
8789 const CAmount& GetFee () const { return nFee; }
88- size_t GetTxSize () const
89- {
90- return GetVirtualTransactionSize (nTxWeight, sigOpCost);
91- }
90+ size_t GetTxSize () const { return m_tx_size; }
9291 size_t GetTxWeight () const { return nTxWeight; }
9392 std::chrono::seconds GetTime () const { return std::chrono::seconds{nTime}; }
9493 unsigned int GetHeight () const { return entryHeight; }
0 commit comments