Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ uint64_t estimator::estimate(size_t target, mode mode) const NOEXCEPT
case mode::economical:
{
const auto target1 = to_half(target);
const auto target2 = std::min(one, target);
const auto target2 = target;
const auto target3 = std::min(large, two * target);
const auto fee1 = compute(target1, confidence::low);
const auto fee2 = compute(target2, confidence::mid);
Expand All @@ -62,7 +62,7 @@ uint64_t estimator::estimate(size_t target, mode mode) const NOEXCEPT
case mode::conservative:
{
const auto target1 = to_half(target);
const auto target2 = std::min(one, target);
const auto target2 = target;
const auto target3 = std::min(large, two * target);
const auto fee1 = compute(target1, confidence::low);
const auto fee2 = compute(target2, confidence::mid);
Expand Down
16 changes: 16 additions & 0 deletions test/estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,14 @@ BC_AUTO_TEST_CASE(estimator__estimate__economical_all_targets_pass__expected)
BC_REQUIRE_EQUAL(instance->estimate(1, estimator::mode::economical), 1u);
}

BC_AUTO_TEST_CASE(estimator__estimate__economical_target_failed__max_uint64)
{
const auto instance = acessor::create();
instance->history().small[0].total = 20u;
instance->history().small[0].confirmed[4] = 10u;
BC_REQUIRE_EQUAL(instance->estimate(4, estimator::mode::economical), max_uint64);
}

BC_AUTO_TEST_CASE(estimator__estimate__conservative_double_target_failed__max_uint64)
{
const auto instance = acessor::create();
Expand All @@ -765,6 +773,14 @@ BC_AUTO_TEST_CASE(estimator__estimate__conservative_all_targets_pass__expected)
BC_REQUIRE_EQUAL(instance->estimate(1, estimator::mode::conservative), 1u);
}

BC_AUTO_TEST_CASE(estimator__estimate__conservative_target_failed__max_uint64)
{
const auto instance = acessor::create();
instance->history().small[0].total = 20u;
instance->history().small[0].confirmed[4] = 10u;
BC_REQUIRE_EQUAL(instance->estimate(4, estimator::mode::conservative), max_uint64);
}

// history

BC_AUTO_TEST_CASE(estimator__history__const__expected)
Expand Down
1 change: 1 addition & 0 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ network::settings network_settings() NOEXCEPT
out.enable_witness_tx = false;
out.enable_compact = false;
out.enable_not_found = false;
out.enable_memory_pool = false;
out.enable_relay = false;
out.maximum_skew_minutes = 120;

Expand Down
Loading