diff --git a/console/executor.cpp b/console/executor.cpp index 884cfe02..8df57b7b 100644 --- a/console/executor.cpp +++ b/console/executor.cpp @@ -736,72 +736,39 @@ void executor::scan_collisions() const // arbitrary testing (const). void executor::read_test() const { - auto start = fine_clock::now(); - auto count = query_.header_records(); - uint32_t block{ one }; - - logger("Find strong blocks."); - while (!cancel_ && (block < count) && query_.is_strong_block(block)) - { - ++block; - } - - auto span = duration_cast(fine_clock::now() - start); - logger(format("Top strong block is [%1%] in [%2%] ms.") % sub1(block) % span.count()); - start = fine_clock::now(); - count = query_.header_records(); - uint32_t milestone{ 295'001 }; - - logger("Find milestone blocks."); - while (!cancel_ && (milestone < count) && query_.is_milestone(milestone)) - { - ++milestone; - } - - span = duration_cast(fine_clock::now() - start); - logger(format("Top milestone block is [%1%] in [%2%] ms.") % sub1(milestone) % span.count()); - start = fine_clock::now(); - uint32_t tx{ one }; - - logger("Find strong txs."); - count = query_.tx_records(); - while (!cancel_ && (tx < count) && query_.is_strong_tx(tx) ) - { - ++tx; - } - - span = duration_cast(fine_clock::now() - start); - logger(format("Top strong tx is [%1%] in [%2%] ms.") % sub1(tx) % span.count()); -} - -#if defined(UNDEFINED) - -void executor::read_test() const -{ - const auto from = 481'824_u32; - const auto top = 840'000_u32; ////query_.get_top_associated(); + logger("Wire size computation."); const auto start = fine_clock::now(); - // segwit activation - uint32_t block{ from }; - size_t total{}; + ////constexpr auto last = 500'000_size; + const auto last = query_.get_top_candidate(); - logger("Get all coinbases."); - while (!cancel_ && (block <= top)) + size_t size{}; + for (auto height = zero; !cancel_ && height <= last; ++height) { - const auto count = query_.get_tx_count(query_.to_candidate(block++)); - if (is_zero(count)) + const auto link = query_.to_candidate(height); + if (link.is_terminal()) + { + logger(format("Max candidate height is (%1%).") % sub1(height)); return; + } - total += system::ceilinged_log2(count); + const auto bytes = query_.get_block_size(link); + if (is_zero(bytes)) + { + logger(format("Block (%1%) is not associated.") % height); + return; + } + + size += bytes; } - const auto average = total / (top - from); const auto span = duration_cast(fine_clock::now() - start); - logger(format("Total block depths [%1%] to [%2%] avg [%3%] in [%4%] ms.") - % total % top % average % span.count()); + logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") % + size % last % span.count()); } +#if defined(UNDEFINED) + void executor::read_test() const { constexpr auto start_tx = 15'000_u32; @@ -1035,7 +1002,7 @@ void executor::read_test() const outs.size() % keys.size() % span.count()); // Write it all... -#if defined(UNDEFINED) +#if !defined(UNDEFINED) logger( "output_script_hash, " "output_fk, " @@ -1056,7 +1023,7 @@ void executor::read_test() const "input_bk_fk, " "input_bk_hash, " - "sinput_bk_height, " + "input_bk_height, " "output_script " "input_script, " @@ -1102,33 +1069,68 @@ void executor::read_test() const void executor::read_test() const { - logger("Wire size computation."); - const auto start = fine_clock::now(); - constexpr auto last = 500'000_size; + auto start = fine_clock::now(); + auto count = query_.header_records(); + uint32_t block{ one }; - size_t size{}; - for (auto height = zero; !cancel_ && height <= last; ++height) + logger("Find strong blocks."); + while (!cancel_ && (block < count) && query_.is_strong_block(block)) { - const auto link = query_.to_candidate(height); - if (link.is_terminal()) - { - logger(format("Max candidate height is (%1%).") % sub1(height)); - return; - } + ++block; + } - const auto bytes = query_.get_block_size(link); - if (is_zero(bytes)) - { - logger(format("Block (%1%) is not associated.") % height); + auto span = duration_cast(fine_clock::now() - start); + logger(format("Top strong block is [%1%] in [%2%] ms.") % sub1(block) % span.count()); + start = fine_clock::now(); + count = query_.header_records(); + uint32_t milestone{ 295'001 }; + + logger("Find milestone blocks."); + while (!cancel_ && (milestone < count) && query_.is_milestone(milestone)) + { + ++milestone; + } + + span = duration_cast(fine_clock::now() - start); + logger(format("Top milestone block is [%1%] in [%2%] ms.") % sub1(milestone) % span.count()); + start = fine_clock::now(); + uint32_t tx{ one }; + + logger("Find strong txs."); + count = query_.tx_records(); + while (!cancel_ && (tx < count) && query_.is_strong_tx(tx)) + { + ++tx; + } + + span = duration_cast(fine_clock::now() - start); + logger(format("Top strong tx is [%1%] in [%2%] ms.") % sub1(tx) % span.count()); +} + +void executor::read_test() const +{ + const auto from = 481'824_u32; + const auto top = 840'000_u32; ////query_.get_top_associated(); + const auto start = fine_clock::now(); + + // segwit activation + uint32_t block{ from }; + size_t total{}; + + logger("Get all coinbases."); + while (!cancel_ && (block <= top)) + { + const auto count = query_.get_tx_count(query_.to_candidate(block++)); + if (is_zero(count)) return; - } - size += bytes; + total += system::ceilinged_log2(count); } + const auto average = total / (top - from); const auto span = duration_cast(fine_clock::now() - start); - logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") % - size % last % span.count()); + logger(format("Total block depths [%1%] to [%2%] avg [%3%] in [%4%] ms.") + % total % top % average % span.count()); } void executor::read_test() const diff --git a/src/parser.cpp b/src/parser.cpp index c4a6397b..6e31098a 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -55,8 +55,11 @@ parser::parser(system::chain::selection context) NOEXCEPT configured.network.outbound_connections = 100; configured.network.protocol_minimum = level::headers_protocol; configured.network.protocol_maximum = level::bip130; - configured.network.services_minimum = service::node_network; - configured.network.services_maximum = service::node_network | + + // 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; // database @@ -123,13 +126,6 @@ parser::parser(system::chain::selection context) NOEXCEPT configured.database.neutrino_buckets = 0; configured.database.neutrino_size = 1; configured.database.neutrino_rate = 5; - - ////configured.database.buffer_buckets = 100; - ////configured.database.buffer_size = 1; - ////configured.database.buffer_rate = 5; - - ////configured.database.bootstrap_size = 1; - ////configured.database.bootstrap_rate = 5; } options_metadata parser::load_options() THROWS @@ -486,7 +482,7 @@ options_metadata parser::load_settings() THROWS ( "network.services_minimum", value(&configured.network.services_minimum), - "The minimum services exposed by network connections, defaults to 1 (full node)." + "The minimum services exposed by network connections, defaults to 9 (full node, witness)." ) ( "network.invalid_services",