Fix TryGetHeight. Turns out the default literal won't be 0, but null. Strange.
MODIFY
WalletWasabi/Stores/HashChain.cs
WalletWasabi/Stores/HashChain.cs
@@ -151,9 +151,11 @@ namespace WalletWasabi.Stores
lock (Lock)
{
Height = Chain.FirstOrDefault(x => x.Value == hash).Key;
+
// Default int will be 0. We don't know if this refers to the 0th hash or it just means the hash wasn't found.
// So let's check if the height contains or not.
- if (Height == default && Chain[default] != hash)
+ // If the given height is 0, then check if the chain has a key with 0. If it doesn't have, then return false. If it hash, check if the hash is the same or not.
+ if (Height == 0 && (!Chain.ContainsKey(0) || Chain[0] != hash))
{
return false;
}

Fix TryGetHeight. Turns out the default literal won't be 0, but null. Strange.