-
Notifications
You must be signed in to change notification settings - Fork 492
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
Ensure Height is at least SegWit activation #12192
Ensure Height is at least SegWit activation #12192
Conversation
WalletWasabi/Wallets/Wallet.cs
Outdated
var startingSegwitHeight = new Height(SmartHeader.GetStartingHeader(Network, IndexType.SegwitTaproot).Height); | ||
if (startingSegwitHeight > bestKeyManagerHeight) | ||
{ | ||
KeyManager.SetBestHeights(startingSegwitHeight, startingSegwitHeight); |
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 method is always called with: "X, X" parameters (the same value for both parameters). It would be probably better to have just one parameter and set both heights in that method to the same value.
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. I can do it in another PR after this one is merged
WalletWasabi/Wallets/Wallet.cs
Outdated
@@ -471,6 +473,14 @@ private async Task LoadWalletStateAsync(CancellationToken cancel) | |||
|
|||
Height bestKeyManagerHeight = KeyManager.GetBestTurboSyncHeight(); | |||
|
|||
// Make sure best height is at least height of segwit activation. | |||
var startingSegwitHeight = new Height(SmartHeader.GetStartingHeader(Network, IndexType.SegwitTaproot).Height); | |||
if (startingSegwitHeight > bestKeyManagerHeight) |
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 for this PR but maybe we should implement comparison with uint
types as well.
rant: Not for this PR as well, but we should IMO try to convert LGTM |
Agreed, it's always a struggle of conversions between these when writing synchronization code. I opened an issue about it: #12194 |
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 - just one puzzler to solve.
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
Fixes a bug revealed by #12185.