Skip to content

Commit

Permalink
network: Make the min_nodes_to_process network specific
Browse files Browse the repository at this point in the history
Changelog-Changed: Made the min_nodes_to_process network specific.
  • Loading branch information
ksedgwic committed Nov 2, 2023
1 parent 4f37007 commit 9c050d6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Boss/Mod/ChannelFinderByPopularity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ auto const max_proposals = size_t(5);
*/
auto const min_channels_to_backoff = size_t(4);

/** min_nodes_to_process
*
* @brief if the number of nodes known by this node
* is less than this, go to sleep and try again
* later.
*/
auto const min_nodes_to_process = size_t(800);

/** seconds_after_connect
*
* @brief if we previously stopped looking for popular
Expand Down Expand Up @@ -122,6 +114,14 @@ class ChannelFinderByPopularity::Impl {
/* Previous total_owend amount. */
std::unique_ptr<Ln::Amount> total_owned;

/** min_nodes_to_process
*
* @brief if the number of nodes known by this node
* is less than this, go to sleep and try again
* later.
*/
size_t min_nodes_to_process = size_t(800);

void start() {
running = false;
try_later = false;
Expand All @@ -134,6 +134,11 @@ class ChannelFinderByPopularity::Impl {
rpc = &init.rpc;
self = init.self_id;
db = init.db;
switch (init.network) {
case Boss::Msg::Network_Bitcoin: min_nodes_to_process = 800; break;
case Boss::Msg::Network_Testnet: min_nodes_to_process = 300; break;
default: min_nodes_to_process = 10; break; // others are likely small
}
return db.transact().then([this](Sqlite3::Tx tx) {
/* Create the on-database have_run flag. */
tx.query_execute(R"SQL(
Expand Down

0 comments on commit 9c050d6

Please sign in to comment.