conctractcourt: check sweep sanity + reliable publication#1936
Merged
Roasbeef merged 4 commits intoOct 25, 2018
Conversation
Contributor
|
Looking at this PR again, I realize it partially overlaps with #1978, at least the sanity checking. |
Member
|
Needs rebase! |
Roasbeef
reviewed
Oct 19, 2018
Member
There was a problem hiding this comment.
IMO the control flow is easier to follow if we retain the publishing of the tx in this case, and also the ones that need a tx published.
55d4bf2 to
f9cec4a
Compare
halseth
approved these changes
Oct 24, 2018
| // With the sweep transaction constructed, we'll now Checkpoint | ||
| // our state. | ||
| if err := c.Checkpoint(c); err != nil { | ||
| log.Errorf("unable to Checkpoint: %v", err) |
Contributor
There was a problem hiding this comment.
Print resolvertype+channelpoint?
Member
There was a problem hiding this comment.
We'll print the chan point in the char arb.
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.
This PR modifies the signing and sweeping of commit to-remote sweeps and htlc success sweeps, such that we validate the generated transaction's sanity before publication. It also ensures that the resolvers checkpoint the transaction before publishing. This ensures that we will watch for the same txid after a restart in case a crash happens between publication and checkpointing. If such a crash happens, both will attempt to publish the sweep transaction again in order to ensure the transaction propagates.
In addition, we return an error if checkpointing fails from a number of places within the contract resovlers, and also ignore errors that can arise from duplicate publications of the same htlc success transaction.
Note: would like to add some unit tests exercising this behavior, though this brings the resolvers in line with the intended behavior of other subsystems performing similar functions.