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/network/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ struct BCT_API settings
config::authorities whitelists{};

/// Helpers.
virtual bool pruned_node() const NOEXCEPT;
virtual bool encrypt_node() const NOEXCEPT;
virtual bool witness_node() const NOEXCEPT;
virtual steady_clock::duration retry_timeout() const NOEXCEPT;
Expand Down
5 changes: 5 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ settings::settings(chain::selection context) NOEXCEPT
{
}

bool settings::pruned_node() const NOEXCEPT
{
return to_bool(services_maximum & service::node_network_limited);
}

bool settings::encrypt_node() const NOEXCEPT
{
return to_bool(services_minimum & service::node_encrypted_transport);
Expand Down
13 changes: 13 additions & 0 deletions test/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ BOOST_AUTO_TEST_CASE(settings__construct__regtest__expected)

// helpers

BOOST_AUTO_TEST_CASE(settings__pruned_node__default__false)
{
settings instance{ system::chain::selection::mainnet };
BOOST_REQUIRE(!instance.pruned_node());
}

BOOST_AUTO_TEST_CASE(settings__pruned_node__node_network_limited__true)
{
settings instance{ system::chain::selection::mainnet };
instance.services_maximum = service::node_network_limited;
BOOST_REQUIRE(instance.pruned_node());
}

BOOST_AUTO_TEST_CASE(settings__encrypt_node__default__false)
{
settings instance{ system::chain::selection::mainnet };
Expand Down
Loading