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

Fix open channel management (Bolt 2) #69

Merged
merged 1 commit into from
Feb 6, 2023

Conversation

crisdut
Copy link
Member

@crisdut crisdut commented Jan 13, 2023

This PR completes all steps to open a channel between lnp-nodes, according to Bolt2, except a initial "refund tx" signature, because I will solve that in other PR.

Also, I will create another PR to fix the connect (bolt1) and open channel (bolt2) operations with other LN implementations because I found issues related a parsing messages.

Changes

  • Add ChanelUpdate event to force accept peer change the channel id.
  • Allow accept node load your keyset.
  • Allow electrum worker track and untrack transactions (only to "zero conf") [1]
  • Implements accept peer finish_accepted, finish_signed and finish_funded methods.
  • Review propose peer and accept peer lifecycles.

Dependencies

[1] The current rust-electrum-client does not get transaction with "verbose" informations. I will find a way to get the information. Details here

@crisdut crisdut marked this pull request as draft January 13, 2023 21:52
@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2023

Codecov Report

Merging #69 (d5f28d6) into master (35f921e) will decrease coverage by 0.0%.
The diff coverage is 0.0%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##           master    #69     +/-   ##
=======================================
- Coverage     0.1%   0.1%   -0.0%     
=======================================
  Files          41     41             
  Lines        3273   3355     +82     
=======================================
  Hits            3      3             
- Misses       3270   3352     +82     
Impacted Files Coverage Δ
src/bus/ctl.rs 0.0% <0.0%> (ø)
src/channeld/automata/accept.rs 0.0% <0.0%> (ø)
src/channeld/automata/mod.rs 0.0% <0.0%> (ø)
src/channeld/automata/propose.rs 0.0% <0.0%> (ø)
src/channeld/runtime.rs 0.0% <0.0%> (ø)
src/lnpd/runtime.rs 0.0% <0.0%> (ø)
src/routed/runtime.rs 0.0% <0.0%> (ø)
src/watchd/runtime.rs 0.0% <0.0%> (ø)
src/watchd/worker.rs 0.0% <0.0%> (ø)
src/opts.rs 0.0% <0.0%> (ø)
... and 19 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@crisdut crisdut changed the title Fix Open Channel States (Bolt 2) Fix open channel management (Bolt 2) Jan 16, 2023
@dr-orlovsky dr-orlovsky self-requested a review January 17, 2023 11:19
@dr-orlovsky
Copy link
Contributor

@crisdut looks interesting! Can you provide some comments which functionality should it add to the node specifically?

@crisdut
Copy link
Member Author

crisdut commented Jan 18, 2023

@crisdut looks interesting! Can you provide some comments which functionality should it add to the node specifically?

Hi @dr-orlovsky,

Yes, sure.

For now, I'm adding the final steps to create a channel and correctly persist the state channel. After that, I will finish the track transactions worker on watchd daemon.

Also, I started updating the workflows (here) to help us to review the bolts implementations. I will split each workflow into two flows: internal and external. The first flow is how daemons interact with others along the channel events. The other flow is how the lnp node needs to exchange messages with other peers (independently of the node implementation).

Does it make sense to you?

BTW, I saw your comment here, and I was wondering if it's worth continuing to correct the code or is it better to wait for the re-architecture?

@dr-orlovsky
Copy link
Contributor

I will split each workflow into two flows: internal and external. The first flow is how daemons interact with others along the channel events. The other flow is how the lnp node needs to exchange messages with other peers (independently of the node implementation).

Not sure how this can work, since these two workflows are not independent...

BTW, I saw your comment https://github.com/RGB-WG/rgb-node/discussions/238#discussioncomment-4718147, and I was wondering if it's worth continuing to correct the code or is it better to wait for the re-architecture?

With the new architecture the things which would change are not parts of the business logic; it is just that connections will run on the same thread (while today we have a thread per each remote peer connection). Watchd and channels will remain on an independent threads. So not sure whether it worth waiting for the new architecture, I think parts which you are doing shouldn't be affected by that much.

src/channeld/automata/accept.rs Show resolved Hide resolved
src/channeld/automata/accept.rs Outdated Show resolved Hide resolved
src/channeld/automata/accept.rs Outdated Show resolved Hide resolved
src/channeld/automata/accept.rs Outdated Show resolved Hide resolved
@crisdut
Copy link
Member Author

crisdut commented Jan 20, 2023

With the new architecture the things which would change are not parts of the business logic; it is just that connections will run on the same thread (while today we have a thread per each remote peer connection). Watchd and channels will remain on an independent threads. So not sure whether it worth waiting for the new architecture, I think parts which you are doing shouldn't be affected by that much.

OK sure.

This week I have worked on this issue less than I'd liked. I'm finishing testing this first part. Next week, I'll update this branch again. Thanks for review.

@crisdut crisdut force-pushed the fix/open-channel branch 4 times, most recently from 3d0b020 to c14d526 Compare January 26, 2023 04:47
@crisdut crisdut marked this pull request as ready for review January 27, 2023 17:05
@crisdut
Copy link
Member Author

crisdut commented Jan 27, 2023

Hi @dr-orlovsky

I finished the PR, I updated description #69 (comment)

Copy link
Contributor

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

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

I think this is excellent work! Thank you @crisdut!

I see just a single issue which may lead to some notifications from electrum to get lost, which would be nice to fix - and we can merge after.

Also left a couple of nits which are nice-to-have. Otherwise LGTM

src/channeld/automata/accept.rs Show resolved Hide resolved
src/channeld/automata/accept.rs Outdated Show resolved Hide resolved
src/watchd/runtime.rs Show resolved Hide resolved
src/watchd/runtime.rs Outdated Show resolved Hide resolved
src/watchd/runtime.rs Outdated Show resolved Hide resolved
rpc/Cargo.toml Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@dr-orlovsky
Copy link
Contributor

Amplify with FlagVec fixes is release, as well as LNP Core (v0.9). I am planning to release v0.9 of LNP Node soon. Can you pls update the PR such that I can merge it before doing the release?

Copy link
Contributor

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

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

Looks like we need another iteration due to incorrect panics - plus found a simpler way to avoid electrum message loss

src/watchd/runtime.rs Outdated Show resolved Hide resolved
src/watchd/runtime.rs Outdated Show resolved Hide resolved
src/watchd/runtime.rs Outdated Show resolved Hide resolved
src/watchd/runtime.rs Show resolved Hide resolved
src/watchd/runtime.rs Outdated Show resolved Hide resolved
@dr-orlovsky dr-orlovsky added bug Something isn't working enhancement New feature or request labels Feb 6, 2023
@dr-orlovsky dr-orlovsky added this to the v0.9.0 milestone Feb 6, 2023
Copy link
Contributor

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

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

ACK d5f28d6

@dr-orlovsky dr-orlovsky merged commit 6657435 into LNP-WG:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants