lightningd/opening_control.c: Remove 'Try fundchannel_cancel again' error. #3778
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog-Changed:
fundchannel_cancel
will now succeed even when executed while afundchannel_complete
is ongoing; in that case, it will be considered as cancelling the funding after thefundchannel_complete
succeeds.Let me introduce the concept of "Sequential Consistency":
All operations on parallel processes form a single total order agreed upon by all processes.
So for example, suppose we have parallel invocations of
fundchannel_complete
andfundchannel_cancel
:What "Sequential Consistency" means is that the above parallel operations can be serialized as a single total order as:
Or:
In the first case,
fundchannel_complete
succeeds, and thefundchannel_cancel
invocation also succeeds, sending anerror
to the peer to make them forget the chanel.In the second case,
fundchannel_cancel
succeeds, and the succeedingfundchannel_complete
invocation fails, since the funding is already cancelled and there is nothing to complete.Note that in both cases,
fundchannel_cancel
always succeeds.Unfortunately, prior to this commit,
fundchannel_cancel
could fail with aTry fundchannel_cancel again
error if thefundchannel_complete
is ongoing when thefundchannel_cancel
is initiated.This violates Sequential Consistency, as there is no single total order that would have caused
fundchannel_cancel
to fail.This commit is a minimal patch which just reschedules
fundchannel_cancel
to occur after anyfundchannel_complete
that is ongoing.