From 334f44f84620ea923f8ea8ab4a4a7dd22cb9a9ef Mon Sep 17 00:00:00 2001 From: evoskuil Date: Fri, 21 Nov 2025 13:54:56 -0500 Subject: [PATCH 1/3] Fix thread safety of block out superseded flag, remove assert. --- include/bitcoin/node/protocols/protocol_block_out_70012.hpp | 4 ++-- src/protocols/protocol_block_out_70012.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/bitcoin/node/protocols/protocol_block_out_70012.hpp b/include/bitcoin/node/protocols/protocol_block_out_70012.hpp index 708f8223d..e5f3acb08 100644 --- a/include/bitcoin/node/protocols/protocol_block_out_70012.hpp +++ b/include/bitcoin/node/protocols/protocol_block_out_70012.hpp @@ -50,8 +50,8 @@ class BCN_API protocol_block_out_70012 const network::messages::peer::send_headers::cptr& message) NOEXCEPT; private: - // This is protected by strand. - bool superseded_{}; + // This is thread safe. + std::atomic_bool superseded_{}; }; } // namespace node diff --git a/src/protocols/protocol_block_out_70012.cpp b/src/protocols/protocol_block_out_70012.cpp index 8318e0eef..992c0063e 100644 --- a/src/protocols/protocol_block_out_70012.cpp +++ b/src/protocols/protocol_block_out_70012.cpp @@ -65,7 +65,6 @@ bool protocol_block_out_70012::handle_receive_send_headers(const code& ec, // Suspends inventory announcement processing in favor of header announcements. bool protocol_block_out_70012::superseded() const NOEXCEPT { - BC_ASSERT(stranded()); return superseded_; } From 70948c2f47559d97e5412673596bc069cbe21e62 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Fri, 21 Nov 2025 19:27:33 -0500 Subject: [PATCH 2/3] Refactor config and channel construct for network consistency. --- include/bitcoin/node/channels/channel.hpp | 4 +- .../bitcoin/node/channels/channel_http.hpp | 11 ++--- .../bitcoin/node/channels/channel_peer.hpp | 11 +++-- include/bitcoin/node/channels/channel_tcp.hpp | 9 ++-- include/bitcoin/node/channels/channel_ws.hpp | 13 ++---- include/bitcoin/node/chase.hpp | 4 +- include/bitcoin/node/define.hpp | 2 +- .../protocols/protocol_block_in_31800.hpp | 4 +- .../bitcoin/node/protocols/protocol_peer.hpp | 4 ++ .../bitcoin/node/sessions/session_peer.hpp | 8 ++-- .../bitcoin/node/sessions/session_server.hpp | 4 +- include/bitcoin/node/sessions/session_tcp.hpp | 2 + src/parser.cpp | 46 ++++++++----------- src/protocols/protocol_block_in_31800.cpp | 10 ++-- test/settings.cpp | 40 ++++++++++++---- 15 files changed, 97 insertions(+), 75 deletions(-) diff --git a/include/bitcoin/node/channels/channel.hpp b/include/bitcoin/node/channels/channel.hpp index aa46ffab1..6bc0cd6ed 100644 --- a/include/bitcoin/node/channels/channel.hpp +++ b/include/bitcoin/node/channels/channel.hpp @@ -36,8 +36,8 @@ class BCN_API channel DELETE_COPY_MOVE_DESTRUCT(channel); protected: - channel(const network::logger&, const network::socket::ptr&, - const node::configuration&, uint64_t=zero) NOEXCEPT + channel(const network::logger&, const network::socket::ptr&, uint64_t, + const node::configuration&) NOEXCEPT { } }; diff --git a/include/bitcoin/node/channels/channel_http.hpp b/include/bitcoin/node/channels/channel_http.hpp index f69cb8434..1b0c6e5c1 100644 --- a/include/bitcoin/node/channels/channel_http.hpp +++ b/include/bitcoin/node/channels/channel_http.hpp @@ -34,13 +34,12 @@ class BCN_API channel_http { public: typedef std::shared_ptr ptr; - using options_t = network::channel_http::options_t; - channel_http(const network::logger& log, const network::socket::ptr& socket, - const node::configuration& config, uint64_t identifier=zero, - const options_t& options={}) NOEXCEPT - : network::channel_http(log, socket, config.network, identifier, options), - node::channel(log, socket, config, identifier) + channel_http(const network::logger& log, + const network::socket::ptr& socket, uint64_t identifier, + const node::configuration& config, const options_t& options) NOEXCEPT + : network::channel_http(log, socket, identifier, config.network, options), + node::channel(log, socket, identifier, config) { } }; diff --git a/include/bitcoin/node/channels/channel_peer.hpp b/include/bitcoin/node/channels/channel_peer.hpp index fea61640d..4972df41c 100644 --- a/include/bitcoin/node/channels/channel_peer.hpp +++ b/include/bitcoin/node/channels/channel_peer.hpp @@ -35,11 +35,12 @@ class BCN_API channel_peer public: typedef std::shared_ptr ptr; - channel_peer(network::memory& memory, const network::logger& log, - const network::socket::ptr& socket, const node::configuration& config, - uint64_t identifier=zero) NOEXCEPT - : network::channel_peer(memory, log, socket, config.network, identifier), - node::channel(log, socket, config, identifier), + channel_peer(network::memory& allocator, const network::logger& log, + const network::socket::ptr& socket, uint64_t identifier, + const node::configuration& config, const options_t& options) NOEXCEPT + : network::channel_peer(allocator, log, socket, identifier, + config.network, options), + node::channel(log, socket, identifier, config), announced_(config.node.announcement_cache) { } diff --git a/include/bitcoin/node/channels/channel_tcp.hpp b/include/bitcoin/node/channels/channel_tcp.hpp index fccf83303..265885709 100644 --- a/include/bitcoin/node/channels/channel_tcp.hpp +++ b/include/bitcoin/node/channels/channel_tcp.hpp @@ -34,13 +34,12 @@ class BCN_API channel_tcp { public: typedef std::shared_ptr ptr; - using options_t = network::channel_tcp::options_t; channel_tcp(const network::logger& log, const network::socket::ptr& socket, - const node::configuration& config, uint64_t identifier=zero, - const options_t& options={}) NOEXCEPT - : network::channel_tcp(log, socket, config.network, identifier, options), - node::channel(log, socket, config, identifier) + uint64_t identifier, const node::configuration& config, + const options_t& options) NOEXCEPT + : network::channel_tcp(log, socket, identifier, config.network, options), + node::channel(log, socket, identifier, config) { } }; diff --git a/include/bitcoin/node/channels/channel_ws.hpp b/include/bitcoin/node/channels/channel_ws.hpp index 5497d2b8f..0c8b006de 100644 --- a/include/bitcoin/node/channels/channel_ws.hpp +++ b/include/bitcoin/node/channels/channel_ws.hpp @@ -35,15 +35,12 @@ class BCN_API channel_ws { public: typedef std::shared_ptr ptr; - using options_t = network::channel_ws::options_t; - channel_ws(const network::logger& log, - const network::socket::ptr& socket, - const node::configuration& config, uint64_t identifier=zero, - const options_t& options={}) NOEXCEPT - : network::channel_ws(log, socket, config.network, identifier, - options), - node::channel(log, socket, config, identifier) + channel_ws(const network::logger& log, const network::socket::ptr& socket, + uint64_t identifier, const node::configuration& config, + const options_t& options) NOEXCEPT + : network::channel_ws(log, socket, identifier, config.network, options), + node::channel(log, socket, identifier, config) { } }; diff --git a/include/bitcoin/node/chase.hpp b/include/bitcoin/node/chase.hpp index e23797368..2f23520e2 100644 --- a/include/bitcoin/node/chase.hpp +++ b/include/bitcoin/node/chase.hpp @@ -61,11 +61,11 @@ enum class chase /// Issued by 'session_outbound' and handled by 'block_in_31800'. split, - /// Channels (all with work) directed to split work and stop (channel_t). + /// Channels (all with work) directed to split work and stop (peer_t). /// Issued by 'session_outbound' and handled by 'block_in_31800'. stall, - /// Channels (all with work) directed to drop work and stop (channel_t). + /// Channels (all with work) directed to drop work and stop (peer_t). /// Issued by 'check' and handled by 'block_in_31800'. purge, diff --git a/include/bitcoin/node/define.hpp b/include/bitcoin/node/define.hpp index d2e483806..59f583d97 100644 --- a/include/bitcoin/node/define.hpp +++ b/include/bitcoin/node/define.hpp @@ -70,7 +70,7 @@ using object_key = uint64_t; /// Event value types. using count_t = size_t; using height_t = size_t; -using channel_t = uint64_t; +using peer_t = uint64_t; using object_t = object_key; using header_t = database::header_link::integer; using transaction_t = database::tx_link::integer; diff --git a/include/bitcoin/node/protocols/protocol_block_in_31800.hpp b/include/bitcoin/node/protocols/protocol_block_in_31800.hpp index 51814b333..f79abd156 100644 --- a/include/bitcoin/node/protocols/protocol_block_in_31800.hpp +++ b/include/bitcoin/node/protocols/protocol_block_in_31800.hpp @@ -65,8 +65,8 @@ class BCN_API protocol_block_in_31800 /// Manage work splitting. bool is_idle() const NOEXCEPT override; - virtual void do_purge(channel_t) NOEXCEPT; - virtual void do_split(channel_t) NOEXCEPT; + virtual void do_purge(peer_t) NOEXCEPT; + virtual void do_split(peer_t) NOEXCEPT; virtual void do_report(count_t count) NOEXCEPT; /// Check incoming block message. diff --git a/include/bitcoin/node/protocols/protocol_peer.hpp b/include/bitcoin/node/protocols/protocol_peer.hpp index 448ab9c45..433b53ae7 100644 --- a/include/bitcoin/node/protocols/protocol_peer.hpp +++ b/include/bitcoin/node/protocols/protocol_peer.hpp @@ -35,6 +35,10 @@ class BCN_API protocol_peer : public network::protocol_peer, public node::protocol { +public: + // Replace base class channel_t (network::channel_peer). + using channel_t = node::channel_peer; + protected: /// Constructors. /// ----------------------------------------------------------------------- diff --git a/include/bitcoin/node/sessions/session_peer.hpp b/include/bitcoin/node/sessions/session_peer.hpp index bca26304a..849936506 100644 --- a/include/bitcoin/node/sessions/session_peer.hpp +++ b/include/bitcoin/node/sessions/session_peer.hpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -39,6 +39,7 @@ class session_peer { public: typedef std::shared_ptr> ptr; + using options_t = network::settings::tcp_server; using channel_t = node::channel_peer; /// Construct an instance. @@ -59,9 +60,10 @@ class session_peer { BC_ASSERT(this->stranded()); + // TODO: send options_t. const auto channel = std::make_shared( - this->get_memory(), this->log, socket, this->config(), - this->create_key()); + this->get_memory(), this->log, socket, this->create_key(), + this->config(), options_t{}); return std::static_pointer_cast(channel); } diff --git a/include/bitcoin/node/sessions/session_server.hpp b/include/bitcoin/node/sessions/session_server.hpp index 504510e59..ec4f6cd0e 100644 --- a/include/bitcoin/node/sessions/session_server.hpp +++ b/include/bitcoin/node/sessions/session_server.hpp @@ -71,8 +71,8 @@ class session_server { BC_ASSERT(stranded()); - const auto channel = std::make_shared(log, socket, config(), - create_key(), options_); + const auto channel = std::make_shared(log, socket, + create_key(), config(), options_); return std::static_pointer_cast(channel); } diff --git a/include/bitcoin/node/sessions/session_tcp.hpp b/include/bitcoin/node/sessions/session_tcp.hpp index ea33879af..f28ecf4cd 100644 --- a/include/bitcoin/node/sessions/session_tcp.hpp +++ b/include/bitcoin/node/sessions/session_tcp.hpp @@ -19,6 +19,7 @@ #ifndef LIBBITCOIN_NODE_SESSIONS_SESSION_TCP_HPP #define LIBBITCOIN_NODE_SESSIONS_SESSION_TCP_HPP +#include #include #include @@ -34,6 +35,7 @@ class BCN_API session_tcp public: typedef std::shared_ptr ptr; using options_t = network::session_tcp::options_t; + using channel_t = node::channel_tcp; // (network::net&) cast due to full_node forward ref (inheritance hidden). session_tcp(full_node& node, uint64_t identifier, diff --git a/src/parser.cpp b/src/parser.cpp index a54ac1732..aaa4fd171 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -45,9 +45,6 @@ parser::parser(system::chain::selection context, // node configured.node.threads = 32; - ////configured.node.snapshot_bytes = 0; - ////configured.node.snapshot_valid = 0; - ////configured.node.snapshot_confirm = 0; // network @@ -67,9 +64,6 @@ parser::parser(system::chain::selection context, configured.network.protocol_minimum = level::headers_protocol; configured.network.protocol_maximum = level::bip130; - // TODO: presently network::messages::peer::block/tx/compact hardwire witness - // to true, but that should be drive off of configured and peer services. - // services_minimum must be node_witness to be a witness node. configured.network.services_minimum = service::node_network | service::node_witness; @@ -1112,9 +1106,9 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "web.timeout_seconds", - value(&configured.server.web.timeout_seconds), - "The idle timeout (http keep-alive), defaults to '60'." + "web.inactivity_minutes", + value(&configured.server.web.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) ( "web.server", @@ -1159,8 +1153,8 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "explore.timeout_seconds", - value(&configured.server.explore.timeout_seconds), + "explore.inactivity_minutes", + value(&configured.server.explore.inactivity_minutes), "The idle timeout (http keep-server), defaults to '60'." ) ( @@ -1206,9 +1200,9 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "socket.timeout_seconds", - value(&configured.server.socket.timeout_seconds), - "The idle timeout (http keep-alive), defaults to '60'." + "socket.inactivity_minutes", + value(&configured.server.socket.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) ( "socket.server", @@ -1238,9 +1232,9 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "bitcoind.timeout_seconds", - value(&configured.server.bitcoind.timeout_seconds), - "The idle timeout (http keep-alive), defaults to '60'." + "bitcoind.inactivity_minutes", + value(&configured.server.bitcoind.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) ( "bitcoind.server", @@ -1270,9 +1264,9 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "electrum.timeout_seconds", - value(&configured.server.electrum.timeout_seconds), - "The idle timeout (http keep-alive), defaults to '60'." + "electrum.inactivity_minutes", + value(&configured.server.electrum.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) /* [stratum_v1] */ @@ -1292,9 +1286,9 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "stratum_v1.timeout_seconds", - value(&configured.server.stratum_v1.timeout_seconds), - "The idle timeout (http keep-alive), defaults to '60'." + "stratum_v1.inactivity_minutes", + value(&configured.server.stratum_v1.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) /* [stratum_v2] */ @@ -1314,9 +1308,9 @@ options_metadata parser::load_settings() THROWS "The required maximum number of connections, defaults to '0'." ) ( - "stratum_v2.timeout_seconds", - value(&configured.server.stratum_v2.timeout_seconds), - "The idle timeout (http keep-alive), defaults to '60'." + "stratum_v2.inactivity_minutes", + value(&configured.server.stratum_v2.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) /* [log] */ diff --git a/src/protocols/protocol_block_in_31800.cpp b/src/protocols/protocol_block_in_31800.cpp index 5a2f1afa6..51c0ed151 100644 --- a/src/protocols/protocol_block_in_31800.cpp +++ b/src/protocols/protocol_block_in_31800.cpp @@ -108,7 +108,7 @@ bool protocol_block_in_31800::handle_event(const code&, chase event_, { // chase::split is posted by notify_one() using subscription key. // 'value' is the channel that requested a split to obtain work. - POST(do_split, channel_t{}); + POST(do_split, peer_t{}); break; } case chase::stall: @@ -118,7 +118,7 @@ bool protocol_block_in_31800::handle_event(const code&, chase event_, // This is initiated by any channel notifying chase::starved. if (map_->size() > one) { - POST(do_split, channel_t{}); + POST(do_split, peer_t{}); } break; @@ -129,7 +129,7 @@ bool protocol_block_in_31800::handle_event(const code&, chase event_, // This is initiated by chase::regressed/disorganized. if (map_->size() > one) { - POST(do_purge, channel_t{}); + POST(do_purge, peer_t{}); } break; @@ -177,7 +177,7 @@ void protocol_block_in_31800::do_get_downloads(count_t) NOEXCEPT } } -void protocol_block_in_31800::do_purge(channel_t) NOEXCEPT +void protocol_block_in_31800::do_purge(peer_t) NOEXCEPT { BC_ASSERT(stranded()); @@ -189,7 +189,7 @@ void protocol_block_in_31800::do_purge(channel_t) NOEXCEPT } } -void protocol_block_in_31800::do_split(channel_t) NOEXCEPT +void protocol_block_in_31800::do_split(peer_t) NOEXCEPT { BC_ASSERT(stranded()); diff --git a/test/settings.cpp b/test/settings.cpp index 119f2eb8b..e5559da91 100644 --- a/test/settings.cpp +++ b/test/settings.cpp @@ -94,8 +94,11 @@ BOOST_AUTO_TEST_CASE(server__html_server__defaults__expected) BOOST_REQUIRE(!instance.secure); BOOST_REQUIRE(instance.binds.empty()); BOOST_REQUIRE_EQUAL(instance.connections, 0u); - BOOST_REQUIRE_EQUAL(instance.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(instance.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(instance.expiration_minutes, 60u); BOOST_REQUIRE(!instance.enabled()); + BOOST_REQUIRE(instance.inactivity() == minutes(10)); + BOOST_REQUIRE(instance.expiration() == minutes(60)); // http_server BOOST_REQUIRE_EQUAL(instance.server, "libbitcoin/4.0"); @@ -127,8 +130,11 @@ BOOST_AUTO_TEST_CASE(server__web_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); // http_server BOOST_REQUIRE_EQUAL(server.server, "libbitcoin/4.0"); @@ -160,8 +166,11 @@ BOOST_AUTO_TEST_CASE(server__explore_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); // http_server BOOST_REQUIRE_EQUAL(server.server, "libbitcoin/4.0"); @@ -193,8 +202,11 @@ BOOST_AUTO_TEST_CASE(server__websocket_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); // http_server BOOST_REQUIRE_EQUAL(server.server, "libbitcoin/4.0"); @@ -214,8 +226,11 @@ BOOST_AUTO_TEST_CASE(server__bitcoind_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); // http_server BOOST_REQUIRE_EQUAL(server.server, "libbitcoin/4.0"); @@ -235,8 +250,11 @@ BOOST_AUTO_TEST_CASE(server__electrum_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); } BOOST_AUTO_TEST_CASE(server__stratum_v1_server__defaults__expected) @@ -251,8 +269,11 @@ BOOST_AUTO_TEST_CASE(server__stratum_v1_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); } BOOST_AUTO_TEST_CASE(server__stratum_v2_server__defaults__expected) @@ -267,8 +288,11 @@ BOOST_AUTO_TEST_CASE(server__stratum_v2_server__defaults__expected) BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u); - BOOST_REQUIRE_EQUAL(server.timeout_seconds, 60u); + BOOST_REQUIRE_EQUAL(server.inactivity_minutes, 10u); + BOOST_REQUIRE_EQUAL(server.expiration_minutes, 60u); BOOST_REQUIRE(!server.enabled()); + BOOST_REQUIRE(server.inactivity() == minutes(10)); + BOOST_REQUIRE(server.expiration() == minutes(60)); } BOOST_AUTO_TEST_SUITE_END() From b5fdf56fe51cbdca47da47aa2cf012fb12cc6c5b Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sun, 23 Nov 2025 19:29:27 -0500 Subject: [PATCH 3/3] Refactor settings for uniform treatment of services. --- console/executor_runner.cpp | 2 +- .../bitcoin/node/sessions/session_peer.hpp | 5 +- include/bitcoin/node/settings.hpp | 6 +- src/chasers/chaser_check.cpp | 4 +- src/parser.cpp | 877 ++++++++++-------- 5 files changed, 491 insertions(+), 403 deletions(-) diff --git a/console/executor_runner.cpp b/console/executor_runner.cpp index 3bece7ea9..ca59361ec 100644 --- a/console/executor_runner.cpp +++ b/console/executor_runner.cpp @@ -139,7 +139,7 @@ bool executor::do_run() logger(BN_NODE_INTERRUPT); // Create node. - metadata_.configured.network.initialize(); + metadata_.configured.network.manual.initialize(); node_ = std::make_shared(query_, metadata_.configured, log_); // Subscribe node. diff --git a/include/bitcoin/node/sessions/session_peer.hpp b/include/bitcoin/node/sessions/session_peer.hpp index 849936506..f8401c624 100644 --- a/include/bitcoin/node/sessions/session_peer.hpp +++ b/include/bitcoin/node/sessions/session_peer.hpp @@ -39,7 +39,7 @@ class session_peer { public: typedef std::shared_ptr> ptr; - using options_t = network::settings::tcp_server; + using options_t = typename Session::options_t; using channel_t = node::channel_peer; /// Construct an instance. @@ -60,10 +60,9 @@ class session_peer { BC_ASSERT(this->stranded()); - // TODO: send options_t. const auto channel = std::make_shared( this->get_memory(), this->log, socket, this->create_key(), - this->config(), options_t{}); + this->config(), this->options()); return std::static_pointer_cast(channel); } diff --git a/include/bitcoin/node/settings.hpp b/include/bitcoin/node/settings.hpp index 57c300eb9..92fa030b0 100644 --- a/include/bitcoin/node/settings.hpp +++ b/include/bitcoin/node/settings.hpp @@ -160,12 +160,12 @@ class BCN_API settings settings(system::chain::selection context, const embedded_pages& explore, const embedded_pages& web) NOEXCEPT; - /// native RESTful block explorer (http/s, stateless html/json) - server::settings::html_server explore; - /// native admin web interface, isolated (http/s, stateless html) server::settings::html_server web; + /// native RESTful block explorer (http/s, stateless html/json) + server::settings::html_server explore; + /// native websocket query interface (http/s->tcp/s, json, handshake) network::settings::websocket_server socket{ "socket" }; diff --git a/src/chasers/chaser_check.cpp b/src/chasers/chaser_check.cpp index c7eedcded..8602102ac 100644 --- a/src/chasers/chaser_check.cpp +++ b/src/chasers/chaser_check.cpp @@ -46,7 +46,7 @@ chaser_check::chaser_check(full_node& node) NOEXCEPT : chaser(node), maximum_concurrency_(node.config().node.maximum_concurrency_()), maximum_height_(node.config().node.maximum_height_()), - connections_(node.config().network.outbound_connections), + connections_(node.config().network.outbound.connections), allowed_deviation_(node.config().node.allowed_deviation) { } @@ -518,7 +518,7 @@ size_t chaser_check::set_unassociated() NOEXCEPT size_t chaser_check::get_inventory_size() const NOEXCEPT { // Either condition means blocks shouldn't be getting downloaded (yet). - const size_t peers = config().network.outbound_connections; + const size_t peers = config().network.outbound.connections; if (is_zero(peers) || !is_current(false)) return zero; diff --git a/src/parser.cpp b/src/parser.cpp index aaa4fd171..7a0aa1a7f 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -57,30 +57,28 @@ parser::parser(system::chain::selection context, configured.network.enable_address_v2 = false; configured.network.enable_witness_tx = false; configured.network.enable_compact = false; - configured.network.host_pool_capacity = 10000; - configured.network.outbound_connections = 100; - configured.network.inbound_connections = 100; + configured.network.outbound.host_pool_capacity = 10000; + configured.network.outbound.connections = 100; + configured.network.inbound.connections = 100; configured.network.maximum_skew_minutes = 120; configured.network.protocol_minimum = level::headers_protocol; configured.network.protocol_maximum = level::bip130; // services_minimum must be node_witness to be a witness node. - configured.network.services_minimum = service::node_network | - service::node_witness; - configured.network.services_maximum = service::node_network | - service::node_witness; + configured.network.services_minimum = service::node_network | service::node_witness; + configured.network.services_maximum = service::node_network | service::node_witness; // TODO: from bitcoind, revert to defaults when seeds are up. - configured.network.seeds.clear(); - configured.network.seeds.emplace_back("seed.bitcoin.sipa.be", 8333_u16); - configured.network.seeds.emplace_back("dnsseed.bluematt.me", 8333_u16); - configured.network.seeds.emplace_back("dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us", 8333_u16); - configured.network.seeds.emplace_back("seed.bitcoin.jonasschnelli.ch", 8333_u16); - configured.network.seeds.emplace_back("seed.btc.petertodd.net", 8333_u16); - configured.network.seeds.emplace_back("seed.bitcoin.sprovoost.nl", 8333_u16); - configured.network.seeds.emplace_back("dnsseed.emzy.de", 8333_u16); - configured.network.seeds.emplace_back("seed.bitcoin.wiz.biz", 8333_u16); - configured.network.seeds.emplace_back("seed.mainnet.achownodes.xyz", 8333_u16); + configured.network.outbound.seeds.clear(); + configured.network.outbound.seeds.emplace_back("seed.bitcoin.sipa.be", 8333_u16); + configured.network.outbound.seeds.emplace_back("dnsseed.bluematt.me", 8333_u16); + configured.network.outbound.seeds.emplace_back("dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us", 8333_u16); + configured.network.outbound.seeds.emplace_back("seed.bitcoin.jonasschnelli.ch", 8333_u16); + configured.network.outbound.seeds.emplace_back("seed.btc.petertodd.net", 8333_u16); + configured.network.outbound.seeds.emplace_back("seed.bitcoin.sprovoost.nl", 8333_u16); + configured.network.outbound.seeds.emplace_back("dnsseed.emzy.de", 8333_u16); + configured.network.outbound.seeds.emplace_back("seed.bitcoin.wiz.biz", 8333_u16); + configured.network.outbound.seeds.emplace_back("seed.mainnet.achownodes.xyz", 8333_u16); // admin configured.server.web.binds.emplace_back(asio::address{}, 8080_u16); @@ -542,11 +540,6 @@ options_metadata parser::load_settings() THROWS value(&configured.network.invalid_services), "The advertised services that cause a peer to be dropped, defaults to '176'." ) - ( - "network.enable_relay", - value(&configured.network.enable_relay), - "Enable transaction relay, defaults to 'true'." - ) ( "network.enable_address", value(&configured.network.enable_address), @@ -578,14 +571,9 @@ options_metadata parser::load_settings() THROWS "Enable reject messages, defaults to 'false'." ) ( - "network.enable_ipv6", - value(&configured.network.enable_ipv6), - "Enable internet protocol version 6 (IPv6), defaults to 'false'." - ) - ( - "network.enable_loopback", - value(&configured.network.enable_loopback), - "Allow connections from the node to itself, defaults to 'false'." + "network.enable_relay", + value(&configured.network.enable_relay), + "Enable transaction relay, defaults to 'true'." ) ( "network.validate_checksum", @@ -597,21 +585,6 @@ options_metadata parser::load_settings() THROWS value(&configured.network.identifier), "The magic number for message headers, defaults to '3652501241'." ) - ( - "network.inbound_connections", - value(&configured.network.inbound_connections), - "The target number of incoming network connections, defaults to '100'." - ) - ( - "network.outbound_connections", - value(&configured.network.outbound_connections), - "The target number of outgoing network connections, defaults to '100'." - ) - ( - "network.connect_batch_size", - value(&configured.network.connect_batch_size), - "The number of concurrent attempts to establish one connection, defaults to '5'." - ) ( "network.retry_timeout_seconds", value(&configured.network.retry_timeout_seconds), @@ -627,36 +600,16 @@ options_metadata parser::load_settings() THROWS value(&configured.network.handshake_timeout_seconds), "The time limit to complete the connection handshake, defaults to '15'." ) - ( - "network.seeding_timeout_seconds", - value(&configured.network.seeding_timeout_seconds), - "The time limit for obtaining seed connections and addresses, defaults to '30'." - ) ( "network.channel_heartbeat_minutes", value(&configured.network.channel_heartbeat_minutes), "The time between ping messages, defaults to '5'." ) - ( - "network.channel_inactivity_minutes", - value(&configured.network.channel_inactivity_minutes), - "The inactivity time limit for any connection, defaults to '10'." - ) - ( - "network.channel_expiration_minutes", - value(&configured.network.channel_expiration_minutes), - "The age limit for any connection, defaults to '1440'." - ) ( "network.maximum_skew_minutes", value(&configured.network.maximum_skew_minutes), "The maximum allowable channel clock skew, defaults to '120'." ) - ( - "network.host_pool_capacity", - value(&configured.network.host_pool_capacity), - "The maximum number of peer hosts in the pool, defaults to '10000'." - ) ( "network.minimum_buffer", value(&configured.network.minimum_buffer), @@ -677,16 +630,6 @@ options_metadata parser::load_settings() THROWS value(&configured.network.path), "The peer address cache file directory, defaults to empty." ) - ( - "network.bind", - value(&configured.network.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8333' (all IPv4)." - ) - ( - "network.self", - value(&configured.network.selfs), - "IP address to advertise, multiple allowed." - ) ( "network.blacklist", value(&configured.network.blacklists), @@ -697,298 +640,385 @@ options_metadata parser::load_settings() THROWS value(&configured.network.whitelists), "IP address to allow as a peer, multiple allowed." ) + + /* [outbound] */ + ////( + //// "outbound.secure", + //// value(&configured.network.outbound.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) + ////( + //// "outbound.bind", + //// value(&configured.network.outbound.binds), + //// "IP address to bind for load balancing, multiple allowed (not implemented)." + ////) ( - "network.peer", - value(&configured.network.peers), - "A persistent peer node, multiple allowed." + "outbound.connections", + value(&configured.network.outbound.connections), + "The target number of outgoing network connections, defaults to '100'." ) ( - "network.seed", - value(&configured.network.seeds), - "A seed node for initializing the host pool, multiple allowed." + "outbound.inactivity_minutes", + value(&configured.network.outbound.inactivity_minutes), + "The inactivity time limit for any connection, defaults to '10'." ) - - /* [database] */ ( - "database.path", - value(&configured.database.path), - "The blockchain database directory, defaults to 'blockchain'." + "outbound.expiration_minutes", + value(&configured.network.outbound.expiration_minutes), + "The age limit for any connection, defaults to '60'." ) - - /* header */ ( - "database.header_buckets", - value(&configured.database.header_buckets), - "The number of buckets in the header table head, defaults to '386364'." + "outbound.use_ipv6", + value(&configured.network.outbound.use_ipv6), + "Use internet protocol version 6 (IPv6) addresses, defaults to 'false'." ) ( - "database.header_size", - value(&configured.database.header_size), - "The minimum allocation of the header table body, defaults to '21000000'." + "outbound.seed", + value(&configured.network.outbound.seeds), + "A seed node for initializing the host pool, multiple allowed." ) ( - "database.header_rate", - value(&configured.database.header_rate), - "The percentage expansion of the header table body, defaults to '5'." + "outbound.connect_batch_size", + value(&configured.network.outbound.connect_batch_size), + "The number of concurrent attempts to establish one connection, defaults to '5'." ) - - /* input */ ( - "database.input_size", - value(&configured.database.input_size), - "The minimum allocation of the input table body, defaults to '92500000000'." + "outbound.host_pool_capacity", + value(&configured.network.outbound.host_pool_capacity), + "The maximum number of peer hosts in the pool, defaults to '10000'." ) ( - "database.input_rate", - value(&configured.database.input_rate), - "The percentage expansion of the input table body, defaults to '5'." + "outbound.seeding_timeout_seconds", + value(&configured.network.outbound.seeding_timeout_seconds), + "The time limit for obtaining seed connections and addresses, defaults to '30'." ) - /* output */ - ( - "database.output_size", - value(&configured.database.output_size), - "The minimum allocation of the output table body, defaults to '25300000000'." - ) + /* [inbound] */ + ////( + //// "inbound.secure", + //// value(&configured.network.inbound.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.output_rate", - value(&configured.database.output_rate), - "The percentage expansion of the output table body, defaults to '5'." + "inbound.bind", + value(&configured.network.inbound.binds), + "IP address to bind for listening, multiple allowed, defaults to '0.0.0.0:8333' (all IPv4)." ) - - /* point */ ( - "database.point_buckets", - value(&configured.database.point_buckets), - "The number of buckets in the spend table head, defaults to '1365977136'." + "inbound.connections", + value(&configured.network.inbound.connections), + "The target number of incoming network connections, defaults to '100'." ) ( - "database.point_size", - value(&configured.database.point_size), - "The minimum allocation of the point table body, defaults to '25700000000'." + "inbound.inactivity_minutes", + value(&configured.network.inbound.inactivity_minutes), + "The inactivity time limit for any connection, defaults to '10'." ) ( - "database.point_rate", - value(&configured.database.point_rate), - "The percentage expansion of the point table body, defaults to '5'." + "inbound.expiration_minutes", + value(&configured.network.inbound.expiration_minutes), + "The age limit for any connection, defaults to '60'." ) - - /* ins */ ( - "database.ins_size", - value(&configured.database.ins_size), - "The minimum allocation of the point table body, defaults to '8550000000'." + "inbound.enable_loopback", + value(&configured.network.inbound.enable_loopback), + "Allow connections from the node to itself, defaults to 'false'." ) ( - "database.ins_rate", - value(&configured.database.ins_rate), - "The percentage expansion of the ins table body, defaults to '5'." + "inbound.self", + value(&configured.network.inbound.selfs), + "IP address to advertise, multiple allowed." ) - /* outs */ + /* [manual] */ + ////( + //// "manual.secure", + //// value(&configured.network.manual.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) + ////( + //// "manual.bind", + //// value(&configured.network.manual.binds), + //// "IP address to bind for load balancing, multiple allowed (not implemented)." + ////) + ////( + //// "manual.connections", + //// value(&configured.network.manual.connections), + //// "The target number of outgoing manual connections (not implemented)." + ////) ( - "database.outs_size", - value(&configured.database.outs_size), - "The minimum allocation of the puts table body, defaults to '3700000000'." + "manual.inactivity_minutes", + value(&configured.network.manual.inactivity_minutes), + "The inactivity time limit for any connection, defaults to '10' (will attempt reconnect)." ) ( - "database.outs_rate", - value(&configured.database.outs_rate), - "The percentage expansion of the puts table body, defaults to '5'." + "manual.expiration_minutes", + value(&configured.network.manual.expiration_minutes), + "The age limit for any connection, defaults to '60' (will attempt reconnect)." ) - - /* tx */ ( - "database.tx_buckets", - value(&configured.database.tx_buckets), - "The number of buckets in the tx table head, defaults to '469222525'." + "manual.peer", + value(&configured.network.manual.peers), + "A persistent peer node, multiple allowed." ) + + /* [web] */ + ////( + //// "web.secure", + //// value(&configured.network.web.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.tx_size", - value(&configured.database.tx_size), - "The minimum allocation of the tx table body, defaults to '17000000000'." + "web.bind", + value(&configured.server.web.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." ) ( - "database.tx_rate", - value(&configured.database.tx_rate), - "The percentage expansion of the tx table body, defaults to '5'." + "web.connections", + value(&configured.server.web.connections), + "The required maximum number of connections, defaults to '0'." ) - - /* txs */ ( - "database.txs_buckets", - value(&configured.database.txs_buckets), - "The number of buckets in the txs table head, defaults to '900001'." + "web.inactivity_minutes", + value(&configured.server.web.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." ) ( - "database.txs_size", - value(&configured.database.txs_size), - "The minimum allocation of the txs table body, defaults to '1050000000'." + "web.expiration_minutes", + value(&configured.server.web.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." ) ( - "database.txs_rate", - value(&configured.database.txs_rate), - "The percentage expansion of the txs table body, defaults to '5'." + "web.server", + value(&configured.server.web.server), + "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." ) - - /* candidate */ ( - "database.candidate_size", - value(&configured.database.candidate_size), - "The minimum allocation of the candidate table body, defaults to '2575500'." + "web.host", + value(&configured.server.web.hosts), + "The host name (http verification), multiple allowed, defaults to empty (disabled)." ) ( - "database.candidate_rate", - value(&configured.database.candidate_rate), - "The percentage expansion of the candidate table body, defaults to '5'." + "web.origin", + value(&configured.server.web.origins), + "The allowed origin (http verification), multiple allowed, defaults to empty (disabled)." ) - - /* confirmed */ ( - "database.confirmed_size", - value(&configured.database.confirmed_size), - "The minimum allocation of the candidate table body, defaults to '2575500'." + "web.path", + value(&configured.server.web.path), + "The required root path of source files to be served, defaults to empty." ) ( - "database.confirmed_rate", - value(&configured.database.confirmed_rate), - "The percentage expansion of the candidate table body, defaults to '5'." + "web.default", + value(&configured.server.web.default_), + "The path of the default source page, defaults to 'index.html'." ) - /* strong_tx */ + /* [explore] */ + ////( + //// "explore.secure", + //// value(&configured.network.explore.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.strong_tx_buckets", - value(&configured.database.strong_tx_buckets), - "The number of buckets in the strong_tx table head, defaults to '469222525'." + "explore.bind", + value(&configured.server.explore.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8180' (all IPv4)." ) ( - "database.strong_tx_size", - value(&configured.database.strong_tx_size), - "The minimum allocation of the strong_tx table body, defaults to '2900000000'." + "explore.connections", + value(&configured.server.explore.connections), + "The required maximum number of connections, defaults to '0'." ) ( - "database.strong_tx_rate", - value(&configured.database.strong_tx_rate), - "The percentage expansion of the strong_tx table body, defaults to '5'." + "explore.inactivity_minutes", + value(&configured.server.explore.inactivity_minutes), + "The idle timeout (http keep-server), defaults to '60'." ) - - /* duplicate */ ( - "database.duplicate_buckets", - value(&configured.database.duplicate_buckets), - "The minimum number of buckets in the duplicate table head, defaults to '1024'." + "explore.expiration_minutes", + value(&configured.server.explore.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." ) ( - "database.duplicate_size", - value(&configured.database.duplicate_size), - "The minimum allocation of the duplicate table body, defaults to '44'." + "explore.server", + value(&configured.server.explore.server), + "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." ) ( - "database.duplicate_rate", - value(&configured.database.duplicate_rate), - "The percentage expansion of the duplicate table, defaults to '5'." + "explore.host", + value(&configured.server.explore.hosts), + "The host name (http verification), multiple allowed, defaults to empty (disabled)." ) - - /* prevout */ ( - "database.prevout_buckets", - value(&configured.database.prevout_buckets), - "The minimum number of buckets in the prevout table head, defaults to '0'." + "explore.origin", + value(&configured.server.explore.origins), + "The allowed origin (http verification), multiple allowed, defaults to empty (disabled)." ) ( - "database.prevout_size", - value(&configured.database.prevout_size), - "The minimum allocation of the prevout table body, defaults to '1'." + "explore.path", + value(&configured.server.explore.path), + "The required root path of source files to be served, defaults to empty." ) ( - "database.prevout_rate", - value(&configured.database.prevout_rate), - "The percentage expansion of the prevout table, defaults to '5'." + "explore.default", + value(&configured.server.explore.default_), + "The path of the default source page, defaults to 'index.html'." ) - /* validated_bk */ + /* [socket] */ + ////( + //// "socket.secure", + //// value(&configured.network.socket.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.validated_bk_buckets", - value(&configured.database.validated_bk_buckets), - "The number of buckets in the validated_bk table head, defaults to '900001'." + "socket.bind", + value(&configured.server.socket.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8280' (all IPv4)." ) ( - "database.validated_bk_size", - value(&configured.database.validated_bk_size), - "The minimum allocation of the validated_bk table body, defaults to '1700000'." + "socket.connections", + value(&configured.server.socket.connections), + "The required maximum number of connections, defaults to '0'." ) ( - "database.validated_bk_rate", - value(&configured.database.validated_bk_rate), - "The percentage expansion of the validated_bk table body, defaults to '5'." + "socket.inactivity_minutes", + value(&configured.server.socket.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." + ) + ( + "socket.expiration_minutes", + value(&configured.server.socket.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." + ) + ( + "socket.server", + value(&configured.server.socket.server), + "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." + ) + ( + "socket.host", + value(&configured.server.socket.hosts), + "The host name (http verification), multiple allowed, defaults to empty (disabled)." ) - /* validated_tx */ + /* [bitcoind] */ + ////( + //// "bitcoind.secure", + //// value(&configured.network.bitcoind.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.validated_tx_buckets", - value(&configured.database.validated_tx_buckets), - "The number of buckets in the validated_tx table head, defaults to '1'." + "bitcoind.bind", + value(&configured.server.bitcoind.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8380' (all IPv4)." ) ( - "database.validated_tx_size", - value(&configured.database.validated_tx_size), - "The minimum allocation of the validated_tx table body, defaults to '1'." + "bitcoind.connections", + value(&configured.server.bitcoind.connections), + "The required maximum number of connections, defaults to '0'." ) ( - "database.validated_tx_rate", - value(&configured.database.validated_tx_rate), - "The percentage expansion of the validated_tx table body, defaults to '5'." + "bitcoind.inactivity_minutes", + value(&configured.server.bitcoind.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." + ) + ( + "bitcoind.expiration_minutes", + value(&configured.server.bitcoind.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." + ) + ( + "bitcoind.server", + value(&configured.server.bitcoind.server), + "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." + ) + ( + "bitcoind.host", + value(&configured.server.bitcoind.hosts), + "The host name (http verification), multiple allowed, defaults to empty (disabled)." ) - /* address */ + /* [electrum] */ + ////( + //// "electrum.secure", + //// value(&configured.network.electrum.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.address_buckets", - value(&configured.database.address_buckets), - "The number of buckets in the address table head, defaults to '1' (0|1 disables)." + "electrum.bind", + value(&configured.server.electrum.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8480' (all IPv4)." ) ( - "database.address_size", - value(&configured.database.address_size), - "The minimum allocation of the address table body, defaults to '1'." + "electrum.connections", + value(&configured.server.electrum.connections), + "The required maximum number of connections, defaults to '0'." ) ( - "database.address_rate", - value(&configured.database.address_rate), - "The percentage expansion of the address table body, defaults to '5'." + "electrum.inactivity_minutes", + value(&configured.server.electrum.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." + ) + ( + "electrum.expiration_minutes", + value(&configured.server.electrum.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." ) - /* filter_bk */ + /* [stratum_v1] */ + ////( + //// "stratum_v1.secure", + //// value(&configured.network.stratum_v1.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.filter_bk_buckets", - value(&configured.database.filter_bk_buckets), - "The number of buckets in the filter_bk table head, defaults to '0' (0 disables)." + "stratum_v1.bind", + value(&configured.server.stratum_v1.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8580' (all IPv4)." ) ( - "database.filter_bk_size", - value(&configured.database.filter_bk_size), - "The minimum allocation of the filter_bk table body, defaults to '1'." + "stratum_v1.connections", + value(&configured.server.stratum_v1.connections), + "The required maximum number of connections, defaults to '0'." ) ( - "database.filter_bk_rate", - value(&configured.database.filter_bk_rate), - "The percentage expansion of the filter_bk table body, defaults to '5'." + "stratum_v1.inactivity_minutes", + value(&configured.server.stratum_v1.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." + ) + ( + "stratum_v1.expiration_minutes", + value(&configured.server.stratum_v1.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." ) - /* filter_tx */ + /* [stratum_v2] */ + ////( + //// "stratum_v2.secure", + //// value(&configured.network.stratum_v2.secure), + //// "Require transport layer security, defaults to 'false' (not implemented)." + ////) ( - "database.filter_tx_buckets", - value(&configured.database.filter_tx_buckets), - "The number of buckets in the filter_tx table head, defaults to '0' (0 disables)." + "stratum_v2.bind", + value(&configured.server.stratum_v2.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8680' (all IPv4)." ) ( - "database.filter_tx_size", - value(&configured.database.filter_tx_size), - "The minimum allocation of the filter_tx table body, defaults to '1'." + "stratum_v2.connections", + value(&configured.server.stratum_v2.connections), + "The required maximum number of connections, defaults to '0'." ) ( - "database.filter_tx_rate", - value(&configured.database.filter_tx_rate), - "The percentage expansion of the filter_tx table body, defaults to '5'." + "stratum_v2.inactivity_minutes", + value(&configured.server.stratum_v2.inactivity_minutes), + "The idle timeout (http keep-alive), defaults to '10'." + ) + ( + "stratum_v2.expiration_minutes", + value(&configured.server.stratum_v2.expiration_minutes), + "The idle timeout (http keep-alive), defaults to '60'." ) /* [node] */ @@ -1089,228 +1119,287 @@ options_metadata parser::load_settings() THROWS //// "The minimum output value, defaults to '500'." ////) - /* [web] */ + /* [database] */ ( - "web.secure", - value(&configured.server.web.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.path", + value(&configured.database.path), + "The blockchain database directory, defaults to 'blockchain'." ) + + /* header */ ( - "web.bind", - value(&configured.server.web.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "database.header_buckets", + value(&configured.database.header_buckets), + "The number of buckets in the header table head, defaults to '386364'." ) ( - "web.connections", - value(&configured.server.web.connections), - "The required maximum number of connections, defaults to '0'." + "database.header_size", + value(&configured.database.header_size), + "The minimum allocation of the header table body, defaults to '21000000'." ) ( - "web.inactivity_minutes", - value(&configured.server.web.inactivity_minutes), - "The idle timeout (http keep-alive), defaults to '10'." + "database.header_rate", + value(&configured.database.header_rate), + "The percentage expansion of the header table body, defaults to '5'." ) + + /* input */ ( - "web.server", - value(&configured.server.web.server), - "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." + "database.input_size", + value(&configured.database.input_size), + "The minimum allocation of the input table body, defaults to '92500000000'." ) ( - "web.host", - value(&configured.server.web.hosts), - "The host name (http verification), multiple allowed, defaults to empty (disabled)." + "database.input_rate", + value(&configured.database.input_rate), + "The percentage expansion of the input table body, defaults to '5'." ) + + /* output */ ( - "web.origin", - value(&configured.server.web.origins), - "The allowed origin (http verification), multiple allowed, defaults to empty (disabled)." + "database.output_size", + value(&configured.database.output_size), + "The minimum allocation of the output table body, defaults to '25300000000'." ) ( - "web.path", - value(&configured.server.web.path), - "The required root path of source files to be served, defaults to empty." + "database.output_rate", + value(&configured.database.output_rate), + "The percentage expansion of the output table body, defaults to '5'." ) + + /* point */ ( - "web.default", - value(&configured.server.web.default_), - "The path of the default source page, defaults to 'index.html'." + "database.point_buckets", + value(&configured.database.point_buckets), + "The number of buckets in the spend table head, defaults to '1365977136'." ) - - /* [explore] */ ( - "explore.secure", - value(&configured.server.explore.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.point_size", + value(&configured.database.point_size), + "The minimum allocation of the point table body, defaults to '25700000000'." ) ( - "explore.bind", - value(&configured.server.explore.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8180' (all IPv4)." + "database.point_rate", + value(&configured.database.point_rate), + "The percentage expansion of the point table body, defaults to '5'." ) + + /* ins */ ( - "explore.connections", - value(&configured.server.explore.connections), - "The required maximum number of connections, defaults to '0'." + "database.ins_size", + value(&configured.database.ins_size), + "The minimum allocation of the point table body, defaults to '8550000000'." ) ( - "explore.inactivity_minutes", - value(&configured.server.explore.inactivity_minutes), - "The idle timeout (http keep-server), defaults to '60'." + "database.ins_rate", + value(&configured.database.ins_rate), + "The percentage expansion of the ins table body, defaults to '5'." ) + + /* outs */ ( - "explore.server", - value(&configured.server.explore.server), - "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." + "database.outs_size", + value(&configured.database.outs_size), + "The minimum allocation of the puts table body, defaults to '3700000000'." ) ( - "explore.host", - value(&configured.server.explore.hosts), - "The host name (http verification), multiple allowed, defaults to empty (disabled)." + "database.outs_rate", + value(&configured.database.outs_rate), + "The percentage expansion of the puts table body, defaults to '5'." ) + + /* tx */ ( - "explore.origin", - value(&configured.server.explore.origins), - "The allowed origin (http verification), multiple allowed, defaults to empty (disabled)." + "database.tx_buckets", + value(&configured.database.tx_buckets), + "The number of buckets in the tx table head, defaults to '469222525'." ) ( - "explore.path", - value(&configured.server.explore.path), - "The required root path of source files to be served, defaults to empty." + "database.tx_size", + value(&configured.database.tx_size), + "The minimum allocation of the tx table body, defaults to '17000000000'." ) ( - "explore.default", - value(&configured.server.explore.default_), - "The path of the default source page, defaults to 'index.html'." + "database.tx_rate", + value(&configured.database.tx_rate), + "The percentage expansion of the tx table body, defaults to '5'." ) - /* [socket] */ + /* txs */ ( - "websocket.secure", - value(&configured.server.socket.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.txs_buckets", + value(&configured.database.txs_buckets), + "The number of buckets in the txs table head, defaults to '900001'." ) ( - "socket.bind", - value(&configured.server.socket.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8280' (all IPv4)." + "database.txs_size", + value(&configured.database.txs_size), + "The minimum allocation of the txs table body, defaults to '1050000000'." ) ( - "socket.connections", - value(&configured.server.socket.connections), - "The required maximum number of connections, defaults to '0'." + "database.txs_rate", + value(&configured.database.txs_rate), + "The percentage expansion of the txs table body, defaults to '5'." ) + + /* candidate */ ( - "socket.inactivity_minutes", - value(&configured.server.socket.inactivity_minutes), - "The idle timeout (http keep-alive), defaults to '10'." + "database.candidate_size", + value(&configured.database.candidate_size), + "The minimum allocation of the candidate table body, defaults to '2575500'." ) ( - "socket.server", - value(&configured.server.socket.server), - "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." + "database.candidate_rate", + value(&configured.database.candidate_rate), + "The percentage expansion of the candidate table body, defaults to '5'." ) + + /* confirmed */ ( - "socket.host", - value(&configured.server.socket.hosts), - "The host name (http verification), multiple allowed, defaults to empty (disabled)." + "database.confirmed_size", + value(&configured.database.confirmed_size), + "The minimum allocation of the candidate table body, defaults to '2575500'." + ) + ( + "database.confirmed_rate", + value(&configured.database.confirmed_rate), + "The percentage expansion of the candidate table body, defaults to '5'." ) - /* [bitcoind] */ + /* strong_tx */ ( - "bitcoind.secure", - value(&configured.server.bitcoind.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.strong_tx_buckets", + value(&configured.database.strong_tx_buckets), + "The number of buckets in the strong_tx table head, defaults to '469222525'." ) ( - "bitcoind.bind", - value(&configured.server.bitcoind.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8380' (all IPv4)." + "database.strong_tx_size", + value(&configured.database.strong_tx_size), + "The minimum allocation of the strong_tx table body, defaults to '2900000000'." ) ( - "bitcoind.connections", - value(&configured.server.bitcoind.connections), - "The required maximum number of connections, defaults to '0'." + "database.strong_tx_rate", + value(&configured.database.strong_tx_rate), + "The percentage expansion of the strong_tx table body, defaults to '5'." ) + + /* duplicate */ ( - "bitcoind.inactivity_minutes", - value(&configured.server.bitcoind.inactivity_minutes), - "The idle timeout (http keep-alive), defaults to '10'." + "database.duplicate_buckets", + value(&configured.database.duplicate_buckets), + "The minimum number of buckets in the duplicate table head, defaults to '1024'." ) ( - "bitcoind.server", - value(&configured.server.bitcoind.server), - "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." + "database.duplicate_size", + value(&configured.database.duplicate_size), + "The minimum allocation of the duplicate table body, defaults to '44'." ) ( - "bitcoind.host", - value(&configured.server.bitcoind.hosts), - "The host name (http verification), multiple allowed, defaults to empty (disabled)." + "database.duplicate_rate", + value(&configured.database.duplicate_rate), + "The percentage expansion of the duplicate table, defaults to '5'." ) - /* [electrum] */ + /* prevout */ ( - "electrum.secure", - value(&configured.server.electrum.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.prevout_buckets", + value(&configured.database.prevout_buckets), + "The minimum number of buckets in the prevout table head, defaults to '0'." ) ( - "electrum.bind", - value(&configured.server.electrum.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8480' (all IPv4)." + "database.prevout_size", + value(&configured.database.prevout_size), + "The minimum allocation of the prevout table body, defaults to '1'." ) ( - "electrum.connections", - value(&configured.server.electrum.connections), - "The required maximum number of connections, defaults to '0'." + "database.prevout_rate", + value(&configured.database.prevout_rate), + "The percentage expansion of the prevout table, defaults to '5'." ) + + /* validated_bk */ ( - "electrum.inactivity_minutes", - value(&configured.server.electrum.inactivity_minutes), - "The idle timeout (http keep-alive), defaults to '10'." + "database.validated_bk_buckets", + value(&configured.database.validated_bk_buckets), + "The number of buckets in the validated_bk table head, defaults to '900001'." + ) + ( + "database.validated_bk_size", + value(&configured.database.validated_bk_size), + "The minimum allocation of the validated_bk table body, defaults to '1700000'." + ) + ( + "database.validated_bk_rate", + value(&configured.database.validated_bk_rate), + "The percentage expansion of the validated_bk table body, defaults to '5'." ) - /* [stratum_v1] */ + /* validated_tx */ ( - "stratum_v1.secure", - value(&configured.server.stratum_v1.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.validated_tx_buckets", + value(&configured.database.validated_tx_buckets), + "The number of buckets in the validated_tx table head, defaults to '1'." ) ( - "stratum_v1.bind", - value(&configured.server.stratum_v1.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8580' (all IPv4)." + "database.validated_tx_size", + value(&configured.database.validated_tx_size), + "The minimum allocation of the validated_tx table body, defaults to '1'." ) ( - "stratum_v1.connections", - value(&configured.server.stratum_v1.connections), - "The required maximum number of connections, defaults to '0'." + "database.validated_tx_rate", + value(&configured.database.validated_tx_rate), + "The percentage expansion of the validated_tx table body, defaults to '5'." ) + + /* address */ ( - "stratum_v1.inactivity_minutes", - value(&configured.server.stratum_v1.inactivity_minutes), - "The idle timeout (http keep-alive), defaults to '10'." + "database.address_buckets", + value(&configured.database.address_buckets), + "The number of buckets in the address table head, defaults to '1' (0|1 disables)." + ) + ( + "database.address_size", + value(&configured.database.address_size), + "The minimum allocation of the address table body, defaults to '1'." + ) + ( + "database.address_rate", + value(&configured.database.address_rate), + "The percentage expansion of the address table body, defaults to '5'." ) - /* [stratum_v2] */ + /* filter_bk */ ( - "stratum_v2.secure", - value(&configured.server.stratum_v2.secure), - "The service requires TLS (not implemented), defaults to 'false'." + "database.filter_bk_buckets", + value(&configured.database.filter_bk_buckets), + "The number of buckets in the filter_bk table head, defaults to '0' (0 disables)." ) ( - "stratum_v2.bind", - value(&configured.server.stratum_v2.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8680' (all IPv4)." + "database.filter_bk_size", + value(&configured.database.filter_bk_size), + "The minimum allocation of the filter_bk table body, defaults to '1'." ) ( - "stratum_v2.connections", - value(&configured.server.stratum_v2.connections), - "The required maximum number of connections, defaults to '0'." + "database.filter_bk_rate", + value(&configured.database.filter_bk_rate), + "The percentage expansion of the filter_bk table body, defaults to '5'." ) + + /* filter_tx */ ( - "stratum_v2.inactivity_minutes", - value(&configured.server.stratum_v2.inactivity_minutes), - "The idle timeout (http keep-alive), defaults to '10'." + "database.filter_tx_buckets", + value(&configured.database.filter_tx_buckets), + "The number of buckets in the filter_tx table head, defaults to '0' (0 disables)." + ) + ( + "database.filter_tx_size", + value(&configured.database.filter_tx_size), + "The minimum allocation of the filter_tx table body, defaults to '1'." + ) + ( + "database.filter_tx_rate", + value(&configured.database.filter_tx_rate), + "The percentage expansion of the filter_tx table body, defaults to '5'." ) /* [log] */