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

feat: use type safe onion packet #358

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

doitian
Copy link
Member

@doitian doitian commented Nov 30, 2024

Use type safe onion pack instead of Vec<u8>, which is error-prone since at some places we store PaymentOnionPacket, and at other places we may store PeeledPaymentOnionPacket.

@doitian doitian requested a review from chenyukang November 30, 2024 08:18
@doitian
Copy link
Member Author

doitian commented Nov 30, 2024

The test case below will fail. @chenyukang can you help to debug? It seems that I have passed wrong parameters when forwarding the onion packet.

I also added channel_outpoint and next_hop to the struct TLC, because the current interface requires a PeeledPaymentOnionPacket to send the packet to the next hop.

cargo test fiber::tests::channel::test_send_payment_with_3_nodes -- --nocapture

@doitian
Copy link
Member Author

doitian commented Nov 30, 2024

The test case below will fail. @chenyukang can you help to debug? It seems that I have passed wrong parameters when forwarding the onion packet.

I also added channel_outpoint and next_hop to the struct TLC, because the current interface requires a PeeledPaymentOnionPacket to send the packet to the next hop.

cargo test fiber::tests::channel::test_send_payment_with_3_nodes -- --nocapture

Found the cause, the amount is not correct when creating outbounding tlc from the pending inbounding tlc.

@doitian doitian force-pushed the feat/type-safe-onion-packet branch from f2c7f74 to 5cb9dc1 Compare November 30, 2024 14:05
Use type safe onion pack instead of `Vec<u8>`, which is error-prone
since at some places we store `PaymentOnionPacket`, and at other places
we may store `PeeledPaymentOnionPacket`.
@doitian doitian force-pushed the feat/type-safe-onion-packet branch from 5cb9dc1 to 66063d6 Compare December 2, 2024 07:59
@doitian doitian marked this pull request as ready for review December 2, 2024 08:23
@quake quake merged commit 1bd5b20 into nervosnetwork:main Dec 2, 2024
16 checks passed
@doitian doitian deleted the feat/type-safe-onion-packet branch December 3, 2024 02:04
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.

2 participants