Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network: Make the min_nodes_to_process network specific #173

Merged
merged 1 commit into from
Nov 2, 2023
Merged
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
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