Skip to content

Commit 150b85c

Browse files
committed
Rename estimate.ipp to fees.ipp.
1 parent 6a8ed10 commit 150b85c

10 files changed

Lines changed: 46 additions & 35 deletions

File tree

Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ test_libbitcoin_database_test_SOURCES = \
9191
test/query/confirm.cpp \
9292
test/query/consensus.cpp \
9393
test/query/context.cpp \
94-
test/query/estimate.cpp \
9594
test/query/extent.cpp \
95+
test/query/fees.cpp \
9696
test/query/height.cpp \
9797
test/query/initialize.cpp \
9898
test/query/merkle.cpp \
@@ -182,8 +182,8 @@ include_bitcoin_database_impl_query_HEADERS = \
182182
include/bitcoin/database/impl/query/confirm.ipp \
183183
include/bitcoin/database/impl/query/consensus.ipp \
184184
include/bitcoin/database/impl/query/context.ipp \
185-
include/bitcoin/database/impl/query/estimate.ipp \
186185
include/bitcoin/database/impl/query/extent.ipp \
186+
include/bitcoin/database/impl/query/fees.ipp \
187187
include/bitcoin/database/impl/query/height.ipp \
188188
include/bitcoin/database/impl/query/initialize.ipp \
189189
include/bitcoin/database/impl/query/merkle.ipp \

builds/cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ if (with-tests)
301301
"../../test/query/confirm.cpp"
302302
"../../test/query/consensus.cpp"
303303
"../../test/query/context.cpp"
304-
"../../test/query/estimate.cpp"
305304
"../../test/query/extent.cpp"
305+
"../../test/query/fees.cpp"
306306
"../../test/query/height.cpp"
307307
"../../test/query/initialize.cpp"
308308
"../../test/query/merkle.cpp"

builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
<ClCompile Include="..\..\..\..\test\query\confirm.cpp" />
153153
<ClCompile Include="..\..\..\..\test\query\consensus.cpp" />
154154
<ClCompile Include="..\..\..\..\test\query\context.cpp" />
155-
<ClCompile Include="..\..\..\..\test\query\estimate.cpp" />
156155
<ClCompile Include="..\..\..\..\test\query\extent.cpp" />
156+
<ClCompile Include="..\..\..\..\test\query\fees.cpp" />
157157
<ClCompile Include="..\..\..\..\test\query\height.cpp">
158158
<ObjectFileName>$(IntDir)test_query_height.obj</ObjectFileName>
159159
</ClCompile>

builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@
123123
<ClCompile Include="..\..\..\..\test\query\context.cpp">
124124
<Filter>src\query</Filter>
125125
</ClCompile>
126-
<ClCompile Include="..\..\..\..\test\query\estimate.cpp">
126+
<ClCompile Include="..\..\..\..\test\query\extent.cpp">
127127
<Filter>src\query</Filter>
128128
</ClCompile>
129-
<ClCompile Include="..\..\..\..\test\query\extent.cpp">
129+
<ClCompile Include="..\..\..\..\test\query\fees.cpp">
130130
<Filter>src\query</Filter>
131131
</ClCompile>
132132
<ClCompile Include="..\..\..\..\test\query\height.cpp">

builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@
219219
<None Include="..\..\..\..\include\bitcoin\database\impl\query\confirm.ipp" />
220220
<None Include="..\..\..\..\include\bitcoin\database\impl\query\consensus.ipp" />
221221
<None Include="..\..\..\..\include\bitcoin\database\impl\query\context.ipp" />
222-
<None Include="..\..\..\..\include\bitcoin\database\impl\query\estimate.ipp" />
223222
<None Include="..\..\..\..\include\bitcoin\database\impl\query\extent.ipp" />
223+
<None Include="..\..\..\..\include\bitcoin\database\impl\query\fees.ipp" />
224224
<None Include="..\..\..\..\include\bitcoin\database\impl\query\height.ipp" />
225225
<None Include="..\..\..\..\include\bitcoin\database\impl\query\initialize.ipp" />
226226
<None Include="..\..\..\..\include\bitcoin\database\impl\query\merkle.ipp" />

builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,10 @@
346346
<None Include="..\..\..\..\include\bitcoin\database\impl\query\context.ipp">
347347
<Filter>include\bitcoin\database\impl\query</Filter>
348348
</None>
349-
<None Include="..\..\..\..\include\bitcoin\database\impl\query\estimate.ipp">
349+
<None Include="..\..\..\..\include\bitcoin\database\impl\query\extent.ipp">
350350
<Filter>include\bitcoin\database\impl\query</Filter>
351351
</None>
352-
<None Include="..\..\..\..\include\bitcoin\database\impl\query\extent.ipp">
352+
<None Include="..\..\..\..\include\bitcoin\database\impl\query\fees.ipp">
353353
<Filter>include\bitcoin\database\impl\query</Filter>
354354
</None>
355355
<None Include="..\..\..\..\include\bitcoin\database\impl\query\height.ipp">

include/bitcoin/database/impl/query/estimate.ipp renamed to include/bitcoin/database/impl/query/fees.ipp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,27 @@
2929

3030
namespace libbitcoin {
3131
namespace database {
32-
32+
33+
// TODO: optimize.
34+
35+
TEMPLATE
36+
uint64_t CLASS::get_tx_fee(const tx_link& link) const NOEXCEPT
37+
{
38+
const auto tx = get_transaction(link, false);
39+
if (is_coinbase(link))
40+
return {};
41+
42+
return tx && populate_without_metadata(*tx) ? tx->fee() : max_uint64;
43+
}
44+
45+
TEMPLATE
46+
uint64_t CLASS::get_block_fee(const header_link& link) const NOEXCEPT
47+
{
48+
const auto block = get_block(link, false);
49+
return block && populate_without_metadata(*block) ? block->fees() :
50+
max_uint64;
51+
}
52+
3353
TEMPLATE
3454
bool CLASS::get_tx_fees(fee_rate& out, const tx_link& link) const NOEXCEPT
3555
{

include/bitcoin/database/impl/query/validate.ipp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,6 @@ code CLASS::get_block_state(const header_link& link) const NOEXCEPT
140140
return to_block_code(valid.code);
141141
}
142142

143-
TEMPLATE
144-
uint64_t CLASS::get_block_fee(const header_link& link) const NOEXCEPT
145-
{
146-
// TODO: optimize.
147-
const auto block = get_block(link, false);
148-
return block && populate_without_metadata(*block) ? block->fees() :
149-
max_uint64;
150-
}
151-
152-
TEMPLATE
153-
uint64_t CLASS::get_tx_fee(const tx_link& link) const NOEXCEPT
154-
{
155-
// TODO: optimize.
156-
const auto tx = get_transaction(link, false);
157-
if (is_coinbase(link))
158-
return {};
159-
160-
return tx && populate_without_metadata(*tx) ? tx->fee() : max_uint64;
161-
}
162-
163143
TEMPLATE
164144
inline bool CLASS::is_validated(const header_link& link) const NOEXCEPT
165145
{

include/bitcoin/database/query.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,18 +398,22 @@ class query
398398
bool populate_without_metadata(const block& block) const NOEXCEPT;
399399
bool populate_without_metadata(const transaction& tx) const NOEXCEPT;
400400

401-
/// Services.
401+
/// Fees.
402402
/// -----------------------------------------------------------------------
403403

404+
/// Total fee value by tx or block.
404405
uint64_t get_tx_fee(const tx_link& link) const NOEXCEPT;
405406
uint64_t get_block_fee(const header_link& link) const NOEXCEPT;
406407

407-
/// Gether fee rate tuples by tx, block or branch.
408+
/// Fee rate tuples by tx, block or branch.
408409
bool get_tx_fees(fee_rate& out, const tx_link& link) const NOEXCEPT;
409410
bool get_block_fees(fee_rates& out, const header_link& link) const NOEXCEPT;
410411
bool get_branch_fees(std::atomic_bool& cancel, fee_rate_sets& out,
411412
size_t top, size_t count) const NOEXCEPT;
412413

414+
/// Merkle.
415+
/// -----------------------------------------------------------------------
416+
413417
/// Merkle computations over the index of confirmed headers.
414418
hash_digest get_merkle_root(size_t height) const NOEXCEPT;
415419
code get_merkle_root_and_proof(hash_digest& root, hashes& proof,
@@ -786,13 +790,13 @@ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
786790
#include <bitcoin/database/impl/query/consensus.ipp>
787791
#include <bitcoin/database/impl/query/context.ipp>
788792
#include <bitcoin/database/impl/query/extent.ipp>
793+
#include <bitcoin/database/impl/query/fees.ipp>
789794
#include <bitcoin/database/impl/query/height.ipp>
790795
#include <bitcoin/database/impl/query/initialize.ipp>
791796
#include <bitcoin/database/impl/query/network.ipp>
792797
#include <bitcoin/database/impl/query/objects.ipp>
793798
#include <bitcoin/database/impl/query/optional.ipp>
794799
#include <bitcoin/database/impl/query/merkle.ipp>
795-
#include <bitcoin/database/impl/query/estimate.ipp>
796800
#include <bitcoin/database/impl/query/translate.ipp>
797801
#include <bitcoin/database/impl/query/validate.ipp>
798802

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@
2020
#include "../mocks/blocks.hpp"
2121
#include "../mocks/chunk_store.hpp"
2222

23-
BOOST_FIXTURE_TEST_SUITE(query_estimate_tests, test::directory_setup_fixture)
23+
BOOST_FIXTURE_TEST_SUITE(query_fees__tests, test::directory_setup_fixture)
2424

2525
// nop event handler.
2626
////const auto events_handler = [](auto, auto) {};
2727

28-
BOOST_AUTO_TEST_CASE(query_estimate_test)
28+
// get_tx_fee
29+
// get_block_fee
30+
31+
// get_tx_fees
32+
// get_block_fees
33+
// get_branch_fees
34+
35+
BOOST_AUTO_TEST_CASE(query_fee)
2936
{
3037
BOOST_REQUIRE(true);
3138
}

0 commit comments

Comments
 (0)