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
Apply time preference check for all lower TimeFrames #12356
Apply time preference check for all lower TimeFrames #12356
Conversation
{ | ||
if (FeeRateMedianTimeFrame == default) | ||
{ | ||
return true; | ||
} | ||
|
||
if (RoundStatusUpdater.CoinJoinFeeRateMedians.TryGetValue(FeeRateMedianTimeFrame, out var medianFeeRate)) | ||
if (RoundStatusUpdater.CoinJoinFeeRateMedians.ContainsKey(FeeRateMedianTimeFrame)) |
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 check is more or less useless now but I didn't want to change the behaviour.
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! You can make it static and add a test - that's fine.
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.
CI is failing.
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 - tests need to be fixed.
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, test is 👌
Sorry if irrelevant but I don't see PR that is merging this to the release branch. Can you verify if it is merged, if not then create a PR for that. |
Problem found by @Kruwed
tl;dr: When you are willing to wait for several days for the best moment of the month, you are also willing to wait few extra hours for the best moment of the day
Currently,
IsRoundEconomic
only takes into consideration theMedianFeeRate
related to the exactTimeFrame
selected in user's Coinjoin settings,But in cases where a
FeeRateMedian
for a shortTimeFrame
is lower than theFeeRateMedian
for a longerTimeFrame
, and the user has the longerTimeFrame
in its settings,IsRoundEconomic
will allow coinjoin.Example:
Median past day, 24 sat/vbyte
Median past week, 27 sat/vbyte
Median past month, 35 sat/vbyte
The user has
Weekly
selected, the current coinjoin round's fee rate is 26 sat/vbCurrently,
IsRoundEconomic
will returntrue
, while it would be better to wait for the current round fee rate to also go below the daily median.I know that this problem is a bit tricky to understand, I had to wrap my head around it for quite some time.
What this PR is doing is to check for the current
FeeRateMedian
of all lower or equalTimeFrame
of what the user has in settings. That way,IsRoundEconomic
will also return false until all the current round's fee rate goes below theMedianFeeRate
for all lowerTimeFrame
.I wanted to write a test but I didn't manage to do it without changing the method to
static
or struggling to instantiateCoinJoinClient
, if anyone has a suggestion on how to do it I would gladly write the test.