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
1 change: 1 addition & 0 deletions include/bitcoin/node/chasers/chaser_validate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class BCN_API chaser_validate
virtual code start_batch() NOEXCEPT;
virtual void process_batch(bool residual) NOEXCEPT;
virtual code do_process_batch(bool startup) NOEXCEPT;
virtual code purge_batch() NOEXCEPT;
virtual bool mark_valids(header_links& prevalids, bool startup) NOEXCEPT;
virtual bool mark_invalids(header_links& prevalids,
const header_links& invalids, bool startup) NOEXCEPT;
Expand Down
2 changes: 0 additions & 2 deletions include/bitcoin/node/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class BCN_API settings
uint32_t silent_start_height;
uint16_t sample_period_seconds;
uint32_t currency_window_minutes;
uint16_t warn_dirty_background_ratio;
uint16_t warn_dirty_ratio;
////uint64_t snapshot_bytes;
////uint32_t snapshot_valid;
////uint32_t snapshot_confirm;
Expand Down
19 changes: 15 additions & 4 deletions src/chasers/chaser_validate_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)

code chaser_validate::start_batch() NOEXCEPT
{
if (!batch_enabled_)
return {};

const auto& query = archive();
auto& query = archive();
if (is_zero(query.prevalid_records()) &&
is_zero(query.ecdsa_records()) &&
is_zero(query.schnorr_records()))
return {};

// Prevalid is not a validation state, so dropped blocks validate in place.
if (!batch_enabled_)
{
LOGN("Dropping staged batch rows (" << query.prevalid_records() << ").");
return purge_batch();
}

return do_process_batch(true);
}

Expand Down Expand Up @@ -157,6 +161,13 @@ code chaser_validate::do_process_batch(bool startup) NOEXCEPT
if (!mark_valids(prevalids, startup))
return error::batch3;

return purge_batch();
}

code chaser_validate::purge_batch() NOEXCEPT
{
auto& query = archive();

// Purge prevalids before signatures.
return query.purge_prevalids() &&
query.purge_ecdsa_signatures() &&
Expand Down
4 changes: 1 addition & 3 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ settings::settings() NOEXCEPT
silent_start_height{ 0xffffffff_u32 },
maximum_concurrency{ 50'000 },
sample_period_seconds{ 10 },
currency_window_minutes{ 1440 },
warn_dirty_background_ratio{ 90_u16 },
warn_dirty_ratio{ 90_u16 }
currency_window_minutes{ 1440 }
{
}

Expand Down
2 changes: 0 additions & 2 deletions test/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ BOOST_AUTO_TEST_CASE(settings__node__default_context__expected)
BOOST_REQUIRE_EQUAL(node.maximum_concurrency_(), 50000_size);
BOOST_REQUIRE_EQUAL(node.sample_period_seconds, 10_u16);
BOOST_REQUIRE_EQUAL(node.currency_window_minutes, 1440_u32);
BOOST_REQUIRE_EQUAL(node.warn_dirty_background_ratio, 90_u16);
BOOST_REQUIRE_EQUAL(node.warn_dirty_ratio, 90_u16);
////BOOST_REQUIRE_EQUAL(node.snapshot_bytes, 200'000'000'000_u64);
////BOOST_REQUIRE_EQUAL(node.snapshot_valid, 250'000_u32);
////BOOST_REQUIRE_EQUAL(node.snapshot_confirm, 500'000_u32);
Expand Down
Loading