Skip to content

Commit 371718b

Browse files
MarcoFalkeapoelstra
MarcoFalke
authored andcommitted
Use CAmount for fee delta and modified fee
Cherry-pick of fa84a49 bitcoin/bitcoin#24625 (2/2)
1 parent 3e46754 commit 371718b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/node/miner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct CTxMemPoolModifiedEntry {
4646
nSigOpCostWithAncestors = entry->GetSigOpCostWithAncestors();
4747
}
4848

49-
int64_t GetModifiedFee() const { return iter->GetModifiedFee(); }
49+
CAmount GetModifiedFee() const { return iter->GetModifiedFee(); }
5050
uint64_t GetSizeWithAncestors() const { return nSizeWithAncestors; }
5151
uint64_t GetDiscountSizeWithAncestors() const { return discountSizeWithAncestors; }
5252
CAmount GetModFeesWithAncestors() const { return nModFeesWithAncestors; }

src/txmempool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee,
9898
discountSizeWithAncestors{GetDiscountTxSize()},
9999
setPeginsSpent(_setPeginsSpent) {}
100100

101-
void CTxMemPoolEntry::UpdateFeeDelta(int64_t newFeeDelta)
101+
void CTxMemPoolEntry::UpdateFeeDelta(CAmount newFeeDelta)
102102
{
103103
nModFeesWithDescendants += newFeeDelta - feeDelta;
104104
nModFeesWithAncestors += newFeeDelta - feeDelta;

src/txmempool.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class CTxMemPoolEntry
102102
const unsigned int entryHeight; //!< Chain height when entering the mempool
103103
const bool spendsCoinbase; //!< keep track of transactions that spend a coinbase
104104
const int64_t sigOpCost; //!< Total sigop cost
105-
int64_t feeDelta{0}; //!< Used for determining the priority of the transaction for mining in a block
105+
CAmount feeDelta{0}; //!< Used for determining the priority of the transaction for mining in a block
106106
LockPoints lockPoints; //!< Track the height and time at which tx was final
107107

108108
// Information about descendants of this transaction that are in the
@@ -135,7 +135,7 @@ class CTxMemPoolEntry
135135
std::chrono::seconds GetTime() const { return std::chrono::seconds{nTime}; }
136136
unsigned int GetHeight() const { return entryHeight; }
137137
int64_t GetSigOpCost() const { return sigOpCost; }
138-
int64_t GetModifiedFee() const { return nFee + feeDelta; }
138+
CAmount GetModifiedFee() const { return nFee + feeDelta; }
139139
size_t DynamicMemoryUsage() const { return nUsageSize; }
140140
const LockPoints& GetLockPoints() const { return lockPoints; }
141141

@@ -144,8 +144,8 @@ class CTxMemPoolEntry
144144
// Adjusts the ancestor state
145145
void UpdateAncestorState(int64_t modifySize, CAmount modifyFee, int64_t modifyCount, int64_t modifySigOps, int64_t discountSize);
146146
// Updates the fee delta used for mining priority score, and the
147-
// modified fees with descendants.
148-
void UpdateFeeDelta(int64_t feeDelta);
147+
// modified fees with descendants/ancestors.
148+
void UpdateFeeDelta(CAmount newFeeDelta);
149149
// Update the LockPoints after a reorg
150150
void UpdateLockPoints(const LockPoints& lp);
151151

0 commit comments

Comments
 (0)