funding: fix flake in itest caused by persistent fee param changes#7648
funding: fix flake in itest caused by persistent fee param changes#7648guggero merged 15 commits intolightningnetwork:masterfrom
Conversation
25e7f1e to
ea942f1
Compare
|
Looks like I broke something in a different itest. Will take a look on Monday. |
ea942f1 to
080f6f2
Compare
Looks to have been flakes, looks better after a rebase. |
yyforyongyu
left a comment
There was a problem hiding this comment.
Looks to have been flakes, looks better after a rebase
Confirm they are flakes. Need to seriously fix it now as it seems to be the only one🧐 will check it later this week.
080f6f2 to
908c33f
Compare
908c33f to
703b972
Compare
|
@yyforyongyu there's still a bug in the unit test that I need to fix, so not ready for full review. But could you please quickly check if this new approach is more in line with what you had in mind? |
yyforyongyu
left a comment
There was a problem hiding this comment.
But could you please quickly check if this new approach is more in line with what you had in mind?
Yes I like it! Thanks🙏
703b972 to
d66212f
Compare
|
@yyforyongyu I found the unit test flake, was just a timing issue. So this PR is now ready for full review. |
yyforyongyu
left a comment
There was a problem hiding this comment.
Nice refactor🙏 And love how the build looks✅✅✅
Meanwhile I think we should save the policy to disk in handleFundingSigned for funder's side and handleFundingCreated in fundee's side, and only do them there in case anything goes wrong in the previous steps of the funding flow.
Also we should delete the saved policy when funding flow failed.
I don't think these are introduced in this PR tho, but need to be fixed nevertheless.
|
A second thought is we can go with this one and create a new PR to fix issues around saving and deleting policies. Btw I think this one needs to be in |
|
tagged for 0.17.0 |
|
@ellemouton: review reminder |
yyforyongyu
left a comment
There was a problem hiding this comment.
Can we rebase to run the test again? I think the current failure might be fixed by #7518
Since the actual wallet backends might be different between the wallet DB and the actual channel state DB, we pass in the correct struct to the funding manager.
This will allow us to also set the TimeLockDelta and HTLC settings when creating the channel. We leave the actual implementation of the RPC and CLI changes to another PR, this is just to make things more consistent.
fc8cd75 to
bc27da0
Compare
|
Rebased. Wasn't able to reproduce the Neutrino flake on my machine. Let's see how it looks now. |
Because we now send the correct initial forwarding policy to Brontide, the correct initial values are inserted into the link and we no longer need to update the link in a later step.
bc27da0 to
ca4c16e
Compare
This commit moves the deletion of the initial forwarding policy to the end of `stateStep` to make sure the router has persisted it to disk before the deletion.
ca4c16e to
605062a
Compare
This commit is a pure code move. We add a new method `handleChannelReadyReceived` to handle the channel's state change after the remote's channel ready message is received.
There is a race condition, - goroutine_1: performing `stateStep` under `channelReadySent`. Once `receivedChannelReady` returns true, it will mark the channel state as `addedToRouterGraph`, which will delete the initial forwarding policy for private channels. - goroutine_2: performing `handleChannelReady`, which processes the remote's channelReady message. It will ask brontide to `AddNewChannel` in the end. - goroutine_3: performing `handleNewActiveChannel` in brontide, which will query the initial forwarding policy and fail to find it because it's already deleted in goroutine_1. To fix it, we require `receivedChannelReady` to also check that the channel's barrier signal in the map `handleChannelReadyBarriers` doesn't exist, as this signal is removed once `handleChannelReady` finishes adding the channel in brontide.
605062a to
61ea29a
Compare
61ea29a to
6820b08
Compare
guggero
left a comment
There was a problem hiding this comment.
I can't approve my own PR, but I'm leaving an explicit "LGTM 🎉" here since @yyforyongyu added some commits to it (thank you very much and great find with the barrier!).
|
@ellemouton this is ready for a final review, thanks! |
ellemouton
left a comment
There was a problem hiding this comment.
Very nice fix 🔥 LGTM!
| return "markedOpen" | ||
| case channelReadySent: | ||
| return "channelReady" | ||
| return "channelReadySent" |
| @@ -3070,14 +3070,27 @@ func (f *Manager) receivedChannelReady(node *btcec.PublicKey, | |||
| return false, err | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
really helpful commit message - thanks! 🙏
Partially reverts changes of #7597, in order to fix an itest flake.