-
Notifications
You must be signed in to change notification settings - Fork 23
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
chore(dlc_protocol): Track rollovers in dlc protocol table #2125
Conversation
a5fbfb1
to
8e79dac
Compare
4e5e736
to
f3d91d6
Compare
Yes, although we might want to keep it as i think it could be useful to have a link from the |
e30a9f8
to
9dc885d
Compare
9dc885d
to
744a63d
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.
I think this makes sense overall, but I would like to read your responses before approving explicitly.
|
||
let protocol_executor = | ||
dlc_protocol::DlcProtocolExecutor::new(self.pool.clone()); | ||
protocol_executor.finish_dlc_protocol( | ||
protocol_id, | ||
&node_id, | ||
&contract_id, | ||
channel.get_contract_id(), |
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.
🔧 Maybe we could just add a comment (and a named variable) for all these.
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.
Not sure what you mean. Do you want a separate variable for the contract_id
?
@@ -89,6 +90,34 @@ async fn can_open_close_open_close_position() { | |||
.unwrap(); | |||
tracing::info!(%app_off_chain_balance, "Opened second position"); | |||
|
|||
// rolling over before closing the second position reproduces https://github.com/get10101/10101/issues/2126 |
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.
🙃 Probably controversial, but could we add a dedicated test? I suppose the problem would happen with the first position too. It's a bit of an arbitrary spot to do this.
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.
Also, I think the test is no longer reproducing the issue because the issue is already fixed by now. Can you adapt the comment? I was a bit confused with the wording.
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.
I think this is fine after thinking a bit more about this thread: https://github.com/get10101/10101/pull/2125/files#r1511020380.
744a63d
to
1d5388a
Compare
This allows us to track easily in the database what action triggered the dlc protocol.
chore(settle): Disregard additional check if contract is actually closed. This is the responsibility of `rust-dlc`. Removing this check as it adds unnecessary complexity. We can assume that if `rust-dlc` successfully processed the `ChannelMessage::SettleFinalize` that the contract got closed.
Verifies that #2126 is fixed
1d5388a
to
b2b0e3f
Compare
Adds a
dlc_protocol_type
to thedlc_protocols
table, allowing us to show what action triggered the dlc protocol. I opted to adding this enum, as it is helpful in deciding post processing actions, and the renew protocol is used for rollover and opening positions, so it would be ambiguous picking that information from thedlc_messages
.