From c256e83ce8032cd3937a72c74da393ba5352522d Mon Sep 17 00:00:00 2001 From: evoskuil Date: Fri, 5 Jun 2026 20:51:01 -0400 Subject: [PATCH] Add warn dirty paging settings. --- include/bitcoin/node/settings.hpp | 10 ++++++---- src/settings.cpp | 6 ++++-- test/settings.cpp | 10 ++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/bitcoin/node/settings.hpp b/include/bitcoin/node/settings.hpp index ae6ff022..88983129 100644 --- a/include/bitcoin/node/settings.hpp +++ b/include/bitcoin/node/settings.hpp @@ -34,6 +34,7 @@ class BCN_API settings settings(system::chain::selection context) NOEXCEPT; /// Properties. + uint32_t threads; bool delay_inbound; bool headers_first; bool thread_priority; @@ -47,14 +48,15 @@ class BCN_API settings float minimum_bump_rate; uint16_t announcement_cache; uint16_t fee_estimate_horizon; - ////uint64_t snapshot_bytes; - ////uint32_t snapshot_valid; - ////uint32_t snapshot_confirm; uint32_t maximum_height; uint32_t maximum_concurrency; uint16_t sample_period_seconds; uint32_t currency_window_minutes; - uint32_t threads; + uint16_t warn_dirty_background_ratio; + uint16_t warn_dirty_ratio; + ////uint64_t snapshot_bytes; + ////uint32_t snapshot_valid; + ////uint32_t snapshot_confirm; /// Helpers. virtual size_t threads_() const NOEXCEPT; diff --git a/src/settings.cpp b/src/settings.cpp index 02bbd06e..af900e3f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -30,7 +30,8 @@ namespace libbitcoin { namespace node { settings::settings() NOEXCEPT - : delay_inbound{ true }, + : threads{ 1 }, + delay_inbound{ true }, headers_first{ true }, memory_priority{ true }, thread_priority{ true }, @@ -50,7 +51,8 @@ settings::settings() NOEXCEPT maximum_concurrency{ 50'000 }, sample_period_seconds{ 10 }, currency_window_minutes{ 1440 }, - threads{ 1 } + warn_dirty_background_ratio{ 90_u16 }, + warn_dirty_ratio{ 90_u16 } { } diff --git a/test/settings.cpp b/test/settings.cpp index 38739f21..f63af133 100644 --- a/test/settings.cpp +++ b/test/settings.cpp @@ -30,6 +30,7 @@ BOOST_AUTO_TEST_CASE(settings__node__default_context__expected) using namespace network; const node::settings node{}; + BOOST_REQUIRE_EQUAL(node.threads, 1_u32); BOOST_REQUIRE_EQUAL(node.delay_inbound, true); BOOST_REQUIRE_EQUAL(node.headers_first, true); BOOST_REQUIRE_EQUAL(node.memory_priority, true); @@ -43,16 +44,17 @@ BOOST_AUTO_TEST_CASE(settings__node__default_context__expected) BOOST_REQUIRE_EQUAL(node.allowed_deviation, 1.5); BOOST_REQUIRE_EQUAL(node.announcement_cache, 42_u16); BOOST_REQUIRE_EQUAL(node.fee_estimate_horizon, 0u); - ////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); BOOST_REQUIRE_EQUAL(node.maximum_height, 0_u32); BOOST_REQUIRE_EQUAL(node.maximum_height_(), max_size_t); BOOST_REQUIRE_EQUAL(node.maximum_concurrency, 50000_u32); 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.threads, 1_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); BOOST_REQUIRE_EQUAL(node.threads_(), one); BOOST_REQUIRE_EQUAL(node.maximum_height_(), max_size_t);