utxonursery: handle remote spends [DO NOT REVIEW]#1890
Closed
joostjager wants to merge 11 commits into
Closed
Conversation
5497605 to
37780ed
Compare
To provide more diagnostic information when unit tests panic.
Previously IncubateOutputs was a sequence of independent actions. The construct to incubate all outputs of a commit tx in one single call was not used anymore. This commit splits IncubateOutput into logical functions.
Merged
Contributor
Author
|
All code in this pr is either merged or superseded by the sweeper development. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR will probably be abandoned, as we are on track to eventually remove nursery (#2000)
In this PR, utxonursery is made aware of the possibility that the remote party can spent outputs with the payment hash pre-image.
Currently, outgoing htlcs are sometimes handed off from resolvers to nursery when they are still contested. This can happen when:
Possible consequences of a remote spend after hand-off are:
pendingchannelsrpc call.This PR addresses issue 1 and part of issue 2. When a remote spend is detected, nursery moves the output into a seperate
spndbucket and removes it from the height index. It will not be included anymore in the subsequent sweep tx, unless the sweep tx was already constructed (*). When outputs are moved to the spnd bucket, they will be reported as "stage 0" in the htlc maturity report and also not count towards limbo balance anymore.(*) This problem is to be solved in a follow-up PR. Possible fix could be to reconstruct the sweep tx when the height index is changed.
For issue 3, the ground work is laid by detecting the remote spend. One possible way to build this out is to extract the pre-image and signal it to the pre-image cache.
Now that nursery has a broader view on the status of the outputs that it is managing, the road is opened to broadcasting relevant output events (in particular the final states graduated and remote spend) to the contract resolvers. This will remove the duplication of tracking code that is present in the resolvers.