-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] UTXO swap watcher further improvements #1552
Conversation
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.
Thank you for the fixes! I have only one note :)
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.
One last note.
"wait_for_maker_payment_spend_coefficient": wait_for_maker_payment_spend_coefficient, | ||
"refund_start_time_coefficient": refund_start_time_coefficient, | ||
"search_interval": search_interval, | ||
"wait_for_taker_payment_duration": wait_for_taker_payment_duration |
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.
In #1552 (comment) it was requested to create watcher_conf
object and move all these fields there 🙂 Then, we can use SwapWatcherConf
struct that will have #[serde(default = "fn_name")]
for the missing fields case (I would also rename some fields to make them shorter a bit):
fn one_and_half() -> f64 { 1.5 }
fn three_hundred() -> f64 { 300. }
fn sixty() -> f64 { 60. }
#[derive(Deserialize)]
struct SwapWatcherConf {
#[serde(default = "one_and_half")]
wait_for_maker_payment_spend_factor: f64,
#[serde(default = "one_and_half")]
refund_start_time_factor: f64,
#[serde(default = "three_hundred")]
search_interval: f64,
#[serde(default = "sixty")]
wait_for_taker_payment_duration: f64,
}
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.
Only one question :)
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.
Great progress!
Just have one question.
Before this is merged, there's one more point I want to ask. In this PR I added a new parameter to the Now I made it all once in ten seconds with a constant: Is this important? |
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!
@caglaryucekaya That's ok 🙂 |
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.
One more note 🙂
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Default)] |
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.
With derived Default
, we get the following:
let conf = WatcherConf::default();
println!("{:?}", conf);
WatcherConf { wait_taker_payment: 0.0, wait_maker_payment_spend_factor: 0.0, refund_start_factor: 0.0, search_interval: 0.0 }
I suppose it's not what we expect to get here:
https://github.com/KomodoPlatform/atomicDEX-API/blob/dec9c70563aaa84cae8ce8d119643ed6fe0b8067/mm2src/mm2_main/src/lp_swap/swap_watcher.rs#L580
Could you please implement Default
manually instead, using appropriate values?
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 believe this is resolved
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.
Re-approve
Further improvements, validations, bugfixes and test cases for the UTXO swap watchers