-
Notifications
You must be signed in to change notification settings - Fork 19
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
Farcasterd: Add 10 retries for Monero auto-funding #686
Farcasterd: Add 10 retries for Monero auto-funding #686
Conversation
e20ac58
to
f618d39
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 guess one of the main reasons auto-funding would fail is because no utxo is available. Do we want to add a small timeout (or did I missed it) between the 10 trials?
I see that Maybe it is impossible to know that and the current code cannot get better. |
@h4sh3d you're correct that this PR does not mitigate the "not enough money" issue, nor "not enough unlocked money". That's also not the issue I'd like this PR to address (unless of course can by printing XMR :P) - the only one I want solved for now is when the monero daemon intermittently doesn't respond. Auto-funding failing because no utxos are available means either
I'm (very slightly) opposed to providing reattempted autofunding in case of |
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.
(sorry for double post - trying out new external github tooling)
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.
tACK, thank you very much for this change!
Over the last 1184 swaps, I've had 24 initial autofunding failures from no connection to daemon
on the maker and 47. On the maker's much more powerful setup, all of its 24 autofunding reattempts worked within one retry. On the parallel takers' less powerful setup (which also has much more congestion due to 40 parallel monero-wallet-rpcs), all but 6 of the initial autofunding failures were handled within one retry, the others within two. So this PR's solution of simply reattempting works incredibly well, and its conservative bound of 10 retries is appropriate imo :)
As mentioned in my last comment, I think the only question is whether we also handle not enough unlocked money
. Once others weigh in on this, I'm more than happy to move ahead with merging.
src/farcasterd/runtime.rs
Outdated
break; | ||
} | ||
Err(err) => { | ||
if err.to_string().contains("not enough money") || retries == 0 { |
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 doesn't catch "not enough unlocked money", which is futile to reattempt prior to a block height increase.
so I'd either
- add a match for this (catchall
not enough
, ornot enough money
||not enough unlocked money
, or negatedno connection to daemon
) or - handle
not enough unlocked money
in a separate conditional which inserts toself.funding_xmr
with the autofund bool = true (to avoid potential double-funding via a manual attempt) and delays handling insufficient unlocked money by reattempting upon a block height increase
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.
resolved in 4b32ea4
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.
(sorry for double post - trying out new external github tooling)
I agree that this patch should only take of retrying in case the RPC is not responding for any reasons and not for asset management (not enough money, unlocked money, etc.) This second case should either be external or at a level above when blockchain pace is known. |
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.
cACK
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.
ACK - thank you for the patches @Lederstrumpf
No description provided.