From eb740e0965bff65e0b2684e15092422d4287f75e Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 21 Oct 2024 17:32:16 -0400 Subject: [PATCH 1/4] Remove dead comments. --- src/parser.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/parser.cpp b/src/parser.cpp index c4a6397b..60a7e6a3 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -123,13 +123,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 From 07b546be01af0132016ef95cbc4c4d276b790237 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 21 Oct 2024 17:33:27 -0400 Subject: [PATCH 2/4] Restore address query for read [t]est. --- console/executor.cpp | 139 +++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 70 deletions(-) diff --git a/console/executor.cpp b/console/executor.cpp index 884cfe02..e401e101 100644 --- a/console/executor.cpp +++ b/console/executor.cpp @@ -734,74 +734,6 @@ 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(); - 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; - - total += system::ceilinged_log2(count); - } - - 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()); -} - void executor::read_test() const { constexpr auto start_tx = 15'000_u32; @@ -1035,7 +967,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 +988,7 @@ void executor::read_test() const "input_bk_fk, " "input_bk_hash, " - "sinput_bk_height, " + "input_bk_height, " "output_script " "input_script, " @@ -1100,6 +1032,73 @@ void executor::read_test() const #endif // UNDEFINED } +#if defined(UNDEFINED) +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()); +} + +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; + + total += system::ceilinged_log2(count); + } + + 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()); +} + void executor::read_test() const { logger("Wire size computation."); From aa306f4bfd886fce123685cbfe607d1263b1729a Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 22 Oct 2024 13:29:39 -0400 Subject: [PATCH 3/4] Change -t to wire size computation. --- console/executor.cpp | 67 +++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/console/executor.cpp b/console/executor.cpp index e401e101..8df57b7b 100644 --- a/console/executor.cpp +++ b/console/executor.cpp @@ -734,6 +734,41 @@ void executor::scan_collisions() const } // arbitrary testing (const). +void executor::read_test() const +{ + logger("Wire size computation."); + const auto start = fine_clock::now(); + + ////constexpr auto last = 500'000_size; + const auto last = query_.get_top_candidate(); + + size_t size{}; + for (auto height = zero; !cancel_ && height <= last; ++height) + { + const auto link = query_.to_candidate(height); + if (link.is_terminal()) + { + logger(format("Max candidate height is (%1%).") % sub1(height)); + return; + } + + 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 span = duration_cast(fine_clock::now() - start); + 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; @@ -1032,7 +1067,6 @@ void executor::read_test() const #endif // UNDEFINED } -#if defined(UNDEFINED) void executor::read_test() const { auto start = fine_clock::now(); @@ -1099,37 +1133,6 @@ void executor::read_test() const % total % top % average % span.count()); } -void executor::read_test() const -{ - logger("Wire size computation."); - const auto start = fine_clock::now(); - constexpr auto last = 500'000_size; - - size_t size{}; - for (auto height = zero; !cancel_ && height <= last; ++height) - { - const auto link = query_.to_candidate(height); - if (link.is_terminal()) - { - logger(format("Max candidate height is (%1%).") % sub1(height)); - return; - } - - 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 span = duration_cast(fine_clock::now() - start); - logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") % - size % last % span.count()); -} - void executor::read_test() const { // Binance wallet address with 1,380,169 transaction count. From 8f422243f4c88952d3b0c3e202bbfd435816c408 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 22 Oct 2024 13:42:24 -0400 Subject: [PATCH 4/4] Change default configuration to witness. --- src/parser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/parser.cpp b/src/parser.cpp index 60a7e6a3..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 @@ -479,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",