Skip to content

RFC: Sample architecture and onboarding documentation #1

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

Closed
wants to merge 99 commits into from

Conversation

ariard
Copy link

@ariard ariard commented Feb 7, 2021

Ready for at least a high-level conceptual review.

For now, the sample is mostly a code skeleton with some commands functional (connect/open/...). Don't intend to use it beyond your local regtest.

TheBlueMatt and others added 21 commits February 21, 2020 16:15
This is a meaningful rewrite of the previous sample rust-lightning
based node. Mainly, it switches the code architecture to a new
threading model, where each major LN components gets its own and
communicate with others through dedidcated channels. It also splits
the command line in its own binary, move logging in its own file,
and vets the whole with a configuration file.

Documentation is work in progress and aims to expose Rust-Lightning
architecture usage.

This is still experimental software and shouldn't be used beyond
a local regtest. You still have wide holes which would provoke
certain loss of funds.
@jkczyz
Copy link
Collaborator

jkczyz commented Feb 7, 2021

Could you update the description to summarize the architecture?

Copy link
Contributor

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from a quick once-over, I'll take a real look later.

src/init.rs Outdated
let persister = Arc::new(FilesystemPersister::new(data_path.clone() + "/monitors"));

//TODO: if doesn't exist take best chain from bitcoind
let starting_blockhash = if let Ok(mut blockhash_file) = OpenOptions::new().read(true).open(data_path.clone() + "/blockhash") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Can't we just use the ChannelManager's serialized version?

src/utils.rs Outdated
}

/// Basic JSON-RPC client storing server host and credentials
pub struct RpcClient {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this can be dropped in favor of the one now on RL upstream?

src/init.rs Outdated
const FEE_PROPORTIONAL_MILLIONTHS: u32 = 10;
const ANNOUNCE_CHANNELS: bool = false;

#[tokio::main]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to specify a threaded executor :)

src/init.rs Outdated
let handles = setup_rpc_server(outbound_rpc_server_connector, ldk_port).await;
join_handles.push(handles);

loop {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just wait on all the join handles to finish?

src/sampled.rs Outdated
"invoice" => {
let amount = u64::from_str_radix(v_obj.get("amt").unwrap().as_str().unwrap(), 10).unwrap();
let payment_preimage = [1; 32];
//thread_rng().fill_bytes(&mut payment_preimage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want a TODO :)

@ariard ariard force-pushed the draft-sample branch 2 times, most recently from a0fae31 to 797028f Compare February 9, 2021 22:19
ARCH.md Outdated

# Why the sharing messages approach over the sharing memory one ?

Long-term, it might be interesting to provide a multi-process LDK sample, better fitted for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that a big part of the motivation for this in Core is that its written in a memory-unsafe language. Without unsafe code, there's little reason to do this (absent compiler and other similar bugs). Cross-host, not just cross-process, stuff is cooler, though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Come on, playing with the security capabilities or privileges framework of your system is cool too. Or even control groups for intensive process like routing or throwing a load balancer between p2p stack and channel processing. For high-availability, high-security node, multi-process is way better :p

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, I mean I guess if you want capabilities enforcement that's cool. I still prefer multi-host, but whatever :)

@ariard ariard closed this Feb 19, 2021
orbitalturtle added a commit to orbitalturtle/ldk-sample that referenced this pull request Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants