txmempool.h
contains functions:
uint64_t GetSizeWithDescendants() const
uint64_t GetSizeWithAncestors() const
A return value (i.e. uint64_t
) of these functions can be used to instantiate CFeeRate
. In the current master branch, this would require a cast to uint32_t
because CFeeRate
has the following constructor:
This PR attempts to remove the need for the casting.
The PR’s commit is cherry-picked from sipa’s https://github.com/sipa/bitcoin/commits/202111_mempoolfr branch (see #21422 (comment)) which improves #21422.
The PR is currently a draft as I get:
0policy/feerate.cpp: In constructor ‘CFeeRate::CFeeRate(const CAmount&, uint64_t)’:
1policy/feerate.cpp:14:25: warning: narrowing conversion of ‘num_bytes’ from ‘uint64_t’ {aka ‘long unsigned int’} to ‘int64_t’ {aka ‘long int’} [-Wnarrowing]
2 14 | const int64_t nSize{num_bytes};
3 | ^~~~~~~~~
4policy/feerate.cpp: In member function ‘CAmount CFeeRate::GetFee(uint64_t) const’:
5policy/feerate.cpp:25:25: warning: narrowing conversion of ‘num_bytes’ from ‘uint64_t’ {aka ‘long unsigned int’} to ‘int64_t’ {aka ‘long int’} [-Wnarrowing]
6 25 | const int64_t nSize{num_bytes};
during compilation.
Anyway, I would like to get some early feedback if the PR makes sense to you or not.