This removes a bunch of boilerplate, makes the code easier to read. Also, C++11 member initialization avoids accidental uninitialized members.
Can be reviewed with the git option "--word-diff-regex=." or with "git difftool --tool=meld".
This removes a bunch of boilerplate, makes the code easier to read. Also, C++11 member initialization avoids accidental uninitialized members.
Can be reviewed with the git option "--word-diff-regex=." or with "git difftool --tool=meld".
Code review ACK fa922062c2eb122e6c4972f20b67723332adcb8c
114 | @@ -115,10 +115,10 @@ class CTxMemPoolEntry 115 | int64_t nSigOpCostWithAncestors; 116 | 117 | public: 118 | - CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee, 119 | - int64_t _nTime, unsigned int _entryHeight, 120 | - bool spendsCoinbase, 121 | - int64_t nSigOpsCost, LockPoints lp); 122 | + CTxMemPoolEntry(const CTransactionRef& tx, const CAmount& fee,
Feel free to ignore but if you retouch, while changing this function declaration and definition, could also do
CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee,
Thanks, done
Approach ACK
55 | + nSizeWithDescendants{GetTxSize()}, 56 | + nModFeesWithDescendants{nFee}, 57 | + nCountWithAncestors{1}, 58 | + nSizeWithAncestors{GetTxSize()}, 59 | + nModFeesWithAncestors{nFee}, 60 | + nSigOpCostWithAncestors{sigOpCost} {}
Sorry for painting the bikeshed, but wouldn't standard project style be to put the body of the function on a new line?
nSigOpCostWithAncestors{sigOpCost}
{}
Clang-format accepts the trailing {}, so I think it is fine
47 | + nUsageSize{RecursiveDynamicUsage(tx)}, 48 | + nTime{time}, 49 | + entryHeight{entry_height}, 50 | + spendsCoinbase{spends_coinbase}, 51 | + sigOpCost{sigops_cost}, 52 | + feeDelta{0},
What do you think about initializing this (and perhaps nCountWithDescendants and nCountWithAncestors) with default initialization rather than in the initializer list?
Thanks, done
Concept ACK
This removes a bunch of boilerplate, makes the code easier to read.
Also, C++11 member initialization avoids accidental uninitialized
members.
Can be reviewed with the git option "--word-diff-regex=." or with "git
difftool --tool=meld".
Concept ACK since #17786 :)
Thanks, took the other diff from there.
Code Review ACK fa08d4cfb1e3447a76093d46edc1c9de5ceee454
This PR simplifies the code, removing unnecessary parts, at the same time, keeping the same functionality. The involved constants are now initialized through default initialization rather than from the function. The Clang Formatting of the PR is correct. So there are no formatting issues either. Thanks, @MarcoFalke, for catching these redundancies.
Code review ACK fa08d4cfb1e3447a76093d46edc1c9de5ceee454
Failing CI can be ignored
107 | uint64_t nSizeWithDescendants; //!< ... and size 108 | CAmount nModFeesWithDescendants; //!< ... and total fees (all including us) 109 | 110 | // Analogous statistics for ancestor transactions 111 | - uint64_t nCountWithAncestors; 112 | + uint64_t nCountWithAncestors{1};
I don't see a reason to not use the initializer list for these fields, seems more consistent style wise.
I changed this because several people asked me to, see #23054 (review)
Post-merge ACK fa08d4cfb1e3447a76093d46edc1c9de5ceee454.