forked from lightningdevkit/ldk-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/mixed probing strategy #10
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
Open
dzdidi
wants to merge
20
commits into
fix/no-route-error
Choose a base branch
from
feat/mixed-probing-strategy
base: fix/no-route-error
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9cd9518
mixed probing strategy initial
dzdidi 026b992
mixed probing strategy refactored
dzdidi fc09cbd
remove json config support
dzdidi ed2a67c
fix random probing race condition
dzdidi 7e44f10
optimize param passing
dzdidi 848fdc6
probing: clean up timeouted to avoid memory leak
dzdidi 3d330f7
probing: penalty params unification
dzdidi 2283e41
probing: fix parsing
dzdidi abbf976
probing: random probing memory optimization through reservoir sampling
dzdidi 54948c8
logs: full key (again)
dzdidi 2a536d4
fix: restore to send_probe -> Result (after sloppy rebase)
dzdidi 9931999
logs: clean up logs in scorer
dzdidi 37aba12
refactor: probing logic
dzdidi 17b38a9
clippy fix
dzdidi 0883e2d
refactor: run probe loop clean up
dzdidi d2091f0
example: fix config example
dzdidi 9205189
Refactoring p1
dzdidi 8ef1fbf
Refactor: cli error management
dzdidi 0d9a145
Refactoring p3
dzdidi 889548f
refactor: major changes
dzdidi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,35 @@ | ||
| use crate::cli::LdkUserInfo; | ||
| use crate::runtime_config::LdkUserInfo; | ||
| use std::env; | ||
| use std::fs; | ||
| use thiserror::Error; | ||
|
|
||
| pub(crate) fn parse_startup_args() -> Result<LdkUserInfo, ()> { | ||
| #[derive(Debug, Error)] | ||
| pub(crate) enum StartupArgsError { | ||
| #[error("missing storage directory argument")] | ||
| MissingStorageDirectory, | ||
| #[error("failed to create LDK data directory {path}: {source}")] | ||
| CreateDataDir { | ||
| path: String, | ||
| #[source] | ||
| source: std::io::Error, | ||
| }, | ||
| #[error(transparent)] | ||
| Config(#[from] crate::config::ConfigError), | ||
| } | ||
|
|
||
| pub(crate) fn parse_startup_args() -> Result<LdkUserInfo, StartupArgsError> { | ||
| let args: Vec<String> = env::args().collect(); | ||
| if args.len() < 2 { | ||
| println!("Usage: {} <ldk_storage_directory_path>", args[0]); | ||
| println!(); | ||
| println!( | ||
| "The config.toml file should be located at <ldk_storage_directory_path>/.ldk/config.toml", | ||
| ); | ||
| crate::config::print_config_help(); | ||
| return Err(()); | ||
| return Err(StartupArgsError::MissingStorageDirectory); | ||
| } | ||
|
|
||
| let ldk_storage_dir_path = args[1].clone(); | ||
| let ldk_data_dir = format!("{}/.ldk", ldk_storage_dir_path); | ||
|
|
||
| if let Err(e) = fs::create_dir_all(&ldk_data_dir) { | ||
| println!("ERROR: Failed to create LDK data directory {}: {}", ldk_data_dir, e); | ||
| return Err(()); | ||
| if let Err(source) = fs::create_dir_all(&ldk_data_dir) { | ||
| return Err(StartupArgsError::CreateDataDir { path: ldk_data_dir, source }); | ||
| } | ||
|
|
||
| let config = match crate::config::NodeConfig::load(&ldk_data_dir) { | ||
| Ok(c) => c, | ||
| Err(crate::config::ConfigError::FileNotFound(path)) => { | ||
| println!("ERROR: Config file not found at {}", path); | ||
| println!(); | ||
| crate::config::print_config_help(); | ||
| return Err(()); | ||
| }, | ||
| Err(crate::config::ConfigError::ParseError(msg)) => { | ||
| println!("ERROR: {}", msg); | ||
| println!(); | ||
| crate::config::print_config_help(); | ||
| return Err(()); | ||
| }, | ||
| Err(crate::config::ConfigError::ValidationError(msg)) => { | ||
| println!("ERROR: Config validation failed: {}", msg); | ||
| return Err(()); | ||
| }, | ||
| }; | ||
|
|
||
| let config = crate::config::NodeConfig::load(&ldk_data_dir)?; | ||
| Ok(config.into_ldk_user_info(ldk_storage_dir_path)) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.