-
Notifications
You must be signed in to change notification settings - Fork 8
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
Reorganise and refactor repository to prepare for integration testing. #10
Conversation
fdd1f87
to
c20e380
Compare
Test fails: ./target/debug/loptos --conf=LOPTOS.conf 10 03dde129510a7075c76cd759d1b29fea22d1ba1047a7a11b063008936931882fd0@192.168.160.7:9735 250000 10000 we get this error even without a connection to the peer. Maybe there's a transform where there shouldn't be. |
|
||
#[macro_use] | ||
extern crate serde_derive; | ||
extern crate configure_me; | ||
|
||
configure_me::include_config!(); | ||
|
||
#[cfg(not(feature = "test_paths"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed and not replaced. Please put that change in its own commit to document the change for review
Another test error after the latest revision: Running |
Please separate this into commits each consist of 1 change and all build. That's easier for us to review and find errors |
9b1efd3
to
1cd9eaf
Compare
In summary, the codebase is now split into the following modules: * `lnd`: Contains the lnd-client codebase. * `scheduler`: Contains the business logic of scheduling and satisfying "payjoin-channel-funding" requests. * `api`: Contains all the endpoint logic (currently only for HTTP). `lnd`: * The lnd client (now named `lnd::LndClient`) now implements `Sync` and `Send` allowing for better parallelism. * Lnd client "Verify funding" logic now interacts with remote lightning nodes in parallel (`lnd::LndClient::verify_funding`). * Added `lnd::LndError` to properly catch errors instead of panicing. `scheduler`: * `ScheduledPayJoin` includes additional member functions for checkout output amounts and generating `open_channel` messages (from it's scheduled channels). * `ScheduledPayJoin::test_connections` now tests connections in parallel. * Introduce `scheduler::ProposalPsbt` (which needs a better name), that handles state for satisfying a scheduled payjoin-channel-funding. * Introduce `SchedulerError` for handling error cases instead of panicing. * `Scheduler` contains the business logic. `api`: * Handles HTTP requests with a given `Scheduler` and options. * Introduce `ApiError` which can turn into a non-SUCCESS HTTP response instead of panicing. * We embed static files into the binary with `include_bytes!` macro instead of requiring specification of static file location.
These comments express the following: * In general, further explains what the code does. * Show where the original logic resides in the original codebase via `REPLACES`. * Show intended future changes via `TODO`. Additionally, I have tweaked a comment in the `lnd` crate as well.
1cd9eaf
to
257831b
Compare
Manual integration test passing ✅ The code just needs thorough review |
Seems like ProposalPsbt is 1 to 1 with Scheduled PayJoin. Why not just add it to Scheduled PayJoin? If it's a separate struct, I'd say ScheduledPayJoin has a Psbt rather than the other way around, which is proposed in this pr |
I hope that makes sense! |
The proposed changes have been adapted to #17 |
let sched = sched.clone(); | ||
async move { | ||
let handler = move |req| handle_request(sched.clone(), opts, req); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evanlinjin What's going on with the double clone here? Are we going to get inconsistencies with differing copies of the Scheduler rather than a singleton?
Description
This is basically a rewrite of the codebase. In summary, the codebase is now split into the following modules:
lnd
: Contains the lnd-client codebase.scheduler
: Contains the business logic of scheduling and "payjoin-channel-funding" requests.api
: Contains all the endpoint logic (currently only for HTTP).lnd
:lnd::LndClient
) now implementsSync
andSend
allowing for better parallelism.lnd::LndClient::verify_funding
).lnd::LndError
to properly catch errors instead of panicing.scheduler
:ScheduledPayJoin
includes additional member functions for checkout output amounts and generatingopen_channel
messages (from it's scheduled channels).ScheduledPayJoin::test_connections
now tests connections in parallel.scheduler::ProposalPsbt
(which needs a better name), that handles state for satisfying a scheduled payjoin-channel-funding.SchedulerError
for handling error cases instead of panicing.Scheduler
contains the business logic.api
:Scheduler
and options.ApiError
which can turn into a non-SUCCESS HTTP response instead of panicing.include_bytes!
macro instead of requiring specification of static file location.For Reviewers
As mentioned by @DanGould, I should have kept this as multiple commits from the beginning to have 1 commit reflect 1 change (as this is easier on the reviewer). However, I have already merged all commits into one and splitting things out is not worth it (imo).
Instead, I have included various comments in the codebase prepended with
REPLACES:
that informs of where the associated logic is in the original code (before this PR).Next Steps
I think it is important to prioritize changes that will allow us to write a simple integration test with a (relatively) simple bash script. Even if we transition over to container-based integration tests, having a bash script is something to start off from.
To get there faster, I propose integrating HTTPS (we won't need to depend on a reverse proxy this way) and add associated cli flags. The fewer dependencies our bash-integration-test has, the better. This should not take long.
Then we need to add the
payjoin-client
executable into this repository.The actual integration test should use the
btcd
andlnd
stack (as it seems the easiest to set up).We need to know whether these changes break anything before merging.