-
Notifications
You must be signed in to change notification settings - Fork 382
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
Add PersistClaimInfo and ClaimInfoRequest events #3067
Add PersistClaimInfo and ClaimInfoRequest events #3067
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3067 +/- ##
==========================================
- Coverage 89.75% 89.70% -0.06%
==========================================
Files 122 122
Lines 101791 101810 +19
Branches 101791 101810 +19
==========================================
- Hits 91367 91327 -40
- Misses 7743 7795 +52
- Partials 2681 2688 +7 ☔ View full report in Codecov by Sentry. |
2c9e408
to
a34b67e
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.
Makes sense to me. We'll definitely want some code that uses this so we can check that ClaimMetadata
has the right contents before we land.
a34b67e
to
8a56137
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.
Feel free to squash fixups, but we shouldn't land this as-is without cfg-tags, but honestly IMO we should just land this as a part of a later PR that handles these events.
/// | ||
/// This event is generated when there is a need for [`ClaimInfo`] that was previously stored | ||
/// using [`PersistClaimInfo`] for the specified counterparty commitment transaction. | ||
/// This event can be safely ignored if [`PersistClaimInfo`] event is being ignored. |
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.
This event can never be ignored, cause if it is generated PersistClaimInfo
is being handled.
/// This event can be safely ignored if [`PersistClaimInfo`] event is being ignored. | |
/// This event will never be generated if the [`PersistClaimInfo`] event is being ignored. |
Also, please include at least a bit of detail in the commit messages. |
/// | ||
/// The response to this event should be handled by calling | ||
/// [`ChainMonitor::provide_claim_info`] with the [`ClaimInfo`] that was previously stored and | ||
/// [`ClaimMetadata`] from this event. |
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.
We should probably have some kind of advice for what users should do if they don't find the claim info on disk - I assume they should probably treat it as if they definitely just lost funds (panic or whatever)?
/// [`ClaimMetadata`] from this event. | ||
/// | ||
/// [`ChainMonitor::provide_claim_info`]: crate::chain::chainmonitor::ChainMonitor::provide_claim_info | ||
/// [`PersistClaimInfo`]: Event::PersistClaimInfo |
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: No need to add this reference if in the same module. Then again, we may want to move the new structs to ChainMonitor
?
/// [`ClaimInfoRequest`]: Event::ClaimInfoRequest | ||
PersistClaimInfo { | ||
/// The [`OutPoint`] identifying the channel monitor with which this claim is associated. | ||
monitor_id: transaction::OutPoint, |
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.
Should this be called funding_txo
? Do we already now how this will work in the context of splicing? If this is indeed a monitor_id
, should we use an opaque MonitorId
type that would allow us to change its semantics internally in the future? If not, can we make this a bitcoin::OutPoint
to avoid mixing the two different OutPoint
types across our public API?
/// Additional metadata that must be supplied in the call to [`ChainMonitor::provide_claim_info`]. | ||
/// | ||
/// [`ChainMonitor::provide_claim_info`]: crate::chain::chainmonitor::ChainMonitor::provide_claim_info | ||
claim_metadata: ClaimMetadata, |
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.
ClaimInfo
and ClaimMetadata
are very similar and very generic names. Can we make them a bit more specific, i.e., reflect their purpose a bit better?
/// | ||
/// [`ChainMonitor::provide_claim_info`]: crate::chain::chainmonitor::ChainMonitor::provide_claim_info | ||
/// [`PersistClaimInfo`]: Event::PersistClaimInfo | ||
ClaimInfoRequest { |
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.
The names of other event types usually either reflect that something happened (PaymentClaimed
/PaymentFailed
) or that something needs to be done (DiscardFunding
, ConnectionNeeded
). ClaimInfoRequest
(and to an extend also PersistClaimInfo
) doesn't make it easy to infer whether it's simply informational or if the user needs to take action. Could this be improved?
This needs a rebase now. |
Merging this into #3106 as per feedback. |
Should this PR get closed then? |
Yes i will close this after answering some comments or moving them to new pr. |
Based on #3057
Introduce two new events i.e. PersistClaimInfo and ClaimInfoRequest.
PersistClaimInfo: Indicates that [
ClaimInfo
] should be durably persisted.ClaimInfoRequest: Used to request [
ClaimInfo
] for a specific counterparty commitment transaction.This PR is still in progress as event writing changes are pending and is not in mergeable state but the api and interface can still be reviewed. Mostly ignore docs, they should be legible but need some more work.
As part of #3049