-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
rpc+contractcourt: merge the contractResolver state into the pendingchannels RPC response #1875
Conversation
6a98580
to
3d99ff9
Compare
I'd like to pick this back up, with the exclusion of the commit to detect spends in the nursery. Since then, we've created the Sweeper which itself will handle this notification case. It still stands that as is, the API is blind to these HTLCs that haven't yet timed out causing much user confusion and an inability to properly track all funds throughout the timeout cycle. Even after the new sweeper changes have been merged, we'll still need this for the lifetime that the current nursery exists (and the resolvers will still report directly back to the API). |
69a35fc
to
288652f
Compare
Some observations on the current reporting situation:
Is this the desired behaviour? Ideally I think you'd want to see:
Implementation implications:
|
Yes we atm we only record the fully settled amount, as depending on a number of parameters (if it's batched, the fee rate, etc) we may actually sweep less than the total amount settled at closing time.
We report the CSV outputs, and HTLC outputs as they transition from stage 1 to stage 2. We also report the total limbo balance, and the amount of coins recovered at that given instance.
Yep, it's part of the base report. Only once all the outputs that were created by a channel have been resolved do we no longer report on it.
Agree this would be a good addition in order to ensure users have access to this data without doing any manual block chain crawling. I think it's out of the scope for this PR though, which should be focused on fixing the egregious blind spots.
All this but chain fees and the non delay output are already reported. Agree it would be nice to also show the confirmation status of the non-delay output as well. I don't think this would expand the scope of this PR too significantly, as arguably it's a blind spot in the current report and confirmations can take some time on mainnet.
Yeah we also have this issue where we want to account for the full amount recovered when we need to claim HTLCs on chain. I think this can be deferred from this PR and either picked up in #2075, or a sort of "fee report" message that can be requested from the sweeper (new PR all together).
We can still write the close summary as soon as we detect a channel close, but then update the fields as we go.
Yeah so we'd basically progressively move over this state from the nursery over to the main channel arb. |
I think the first step would be to ensure we report (via the resolver) the state of the HTLCs that haven't yet timed out. Once they timeout, they get handed off to the nursery and can be reported externally as part of the regular nursery report. Next would be to report the state of the non-delay output while it hasn't yet been fully swept. After that we'd start to store within the channel arb's log the finalized state of all resolved contracts. The final step would then be moving all accounting from the |
fd9d073
to
dfadff1
Compare
cdc1e98
to
baf480f
Compare
baf480f
to
d0382b1
Compare
@Roasbeef It is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I like the little fix ups and refactoring along the way. No major comments, mostly style related nits. Happy to have this hole patched before we continue to overhaul the resolvers to communicate directly with the sweeper.
49ca500
to
d17a996
Compare
@Roasbeef PTAL |
d17a996
to
3a29cb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good!
err := r.nurseryPopulateForceCloseResp( | ||
&chanPoint, currentHeight, forceClose, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = r.arbitratorPopulateForceCloseResp( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment above applies to this statement as well
3a29cb2
to
c0b19f4
Compare
ptal @halseth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎿
One last comments, then g2g from my PoV.
contractcourt/channel_arbitrator.go
Outdated
// new resolver. | ||
c.activeResolversLock.Lock() | ||
for i, r := range c.activeResolvers { | ||
if r == currentContract { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparing pointers makes me nervous at times, instead this can use the ResolverKey()
method directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes valid point. Fixed and replace operation extracted to method.
Previously the arbitrator wasn't advanced to the final stage after the last contract resolved. Also channel arbitrator now does not ignore a log error anymore unresolved contracts cannot be retrieved.
c0b19f4
to
8f778e0
Compare
In this commit we fix a reporting gap that previously existed for htlcs that were still contested.
This commit closes a reporting gap for htlc outputs on the remote commitment tx. Those are waited out by nursery, but were not reported before.
8f778e0
to
ca619bf
Compare
ptal @Roasbeef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🔱
#1227