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
3 changes: 2 additions & 1 deletion include/bitcoin/node/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ enum error_t : uint8_t
silent_pruned,
filter_pruned,
filter_unindexed,
excessive_cutoff
excessive_cutoff,
signet_unwitnessed
};

// No current need for error_code equivalence mapping.
Expand Down
3 changes: 3 additions & 0 deletions src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ code configuration::initialize() NOEXCEPT
if (node.provide_filters && node.limited_blocks)
return error::filter_pruned;

if (bitcoin.forks.signet && !bitcoin.forks.bip141)
return error::signet_unwitnessed;

if (node.pool.cutoff_rate_() > node.pool.minimum_fee_rate_())
return error::excessive_cutoff;

Expand Down
3 changes: 2 additions & 1 deletion src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
{ silent_pruned, "silent payments start in pruned blocks" },
{ filter_pruned, "client filters require unpruned blocks" },
{ filter_unindexed, "client filters are not indexed by the store" },
{ excessive_cutoff, "cutoff rate exceeds the minimum fee rate" }
{ excessive_cutoff, "cutoff rate exceeds the minimum fee rate" },
{ signet_unwitnessed, "signet requires witness" }
};

DEFINE_ERROR_T_CATEGORY(error, "node", "node code")
Expand Down
8 changes: 7 additions & 1 deletion src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ settings::settings(chain::selection context) NOEXCEPT
{
network = context;

// Test network blocks are small, so the download window is raised.
switch (context)
{
// Test network blocks are small, so the download window is raised.
case chain::selection::testnet3:
{
maximum_concurrency = 1'000'000;
Expand All @@ -134,6 +134,12 @@ settings::settings(chain::selection context) NOEXCEPT
break;
}

case chain::selection::regtest:
{
currency_window_minutes = 0;
break;
}

default:
{
}
Expand Down
7 changes: 7 additions & 0 deletions test/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ BC_AUTO_TEST_CASE(configuration__initialize__custom_signet__success_peer_identif
BC_REQUIRE_EQUAL(instance.network.peer.identifier, from_little_endian<uint32_t>(bitcoin_hash(base16_chunk("0151"))));
}

BC_AUTO_TEST_CASE(configuration__initialize__signet_without_bip141__signet_unwitnessed)
{
node::configuration instance(chain::selection::signet);
instance.bitcoin.forks.bip141 = false;
BC_REQUIRE_EQUAL(instance.initialize(), node::error::signet_unwitnessed);
}

BC_AUTO_TEST_CASE(configuration__initialize__silent_without_witness__silent_unwitnessed)
{
node::configuration instance(test::node_configuration());
Expand Down
9 changes: 9 additions & 0 deletions test/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,15 @@ BC_AUTO_TEST_CASE(error_t__code__filter_pruned__true_expected_message)
BC_REQUIRE_EQUAL(ec.message(), "client filters require unpruned blocks");
}

BC_AUTO_TEST_CASE(error_t__code__signet_unwitnessed__true_expected_message)
{
constexpr auto value = error::signet_unwitnessed;
const auto ec = code(value);
BC_REQUIRE(ec);
BC_REQUIRE(ec == value);
BC_REQUIRE_EQUAL(ec.message(), "signet requires witness");
}

BC_AUTO_TEST_CASE(error_t__code__excessive_cutoff__true_expected_message)
{
constexpr auto value = error::excessive_cutoff;
Expand Down
1 change: 1 addition & 0 deletions test/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ BC_AUTO_TEST_CASE(settings__node__regtest_context__expected)
BC_REQUIRE(node.network == system::chain::selection::regtest);
BC_REQUIRE_EQUAL(node.maximum_concurrency, 50'000_u32);
BC_REQUIRE_EQUAL(node.batch_verify, 1'000'000_u64);
BC_REQUIRE_EQUAL(node.currency_window_minutes, 0_u32);
}

BC_AUTO_TEST_CASE(settings__node__signet_context__expected)
Expand Down
Loading