Skip to content

Commit

Permalink
fix: concurrency conflict because of Memory Order in Nep6Wallet and S…
Browse files Browse the repository at this point in the history
…QLiteWallet creation
  • Loading branch information
nan01ab committed Oct 13, 2024
1 parent 6ce4633 commit 6098d88
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Neo/Wallets/NEP6/NEP6Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public NEP6Wallet(string path, string password, ProtocolSettings settings, strin
accounts = new Dictionary<UInt160, NEP6Account>();
extra = JToken.Null;
}
Thread.MemoryBarrier();
}

/// <summary>
Expand All @@ -85,6 +86,7 @@ public NEP6Wallet(string path, string password, ProtocolSettings settings, JObje
{
this.password = password.ToSecureString();
LoadFromJson(json, out Scrypt, out accounts, out extra);
Thread.MemoryBarrier();
}

private void LoadFromJson(JObject wallet, out ScryptParameters scrypt, out Dictionary<UInt160, NEP6Account> accounts, out JToken extra)
Expand All @@ -94,7 +96,6 @@ private void LoadFromJson(JObject wallet, out ScryptParameters scrypt, out Dicti
scrypt = ScryptParameters.FromJson((JObject)wallet["scrypt"]);
accounts = ((JArray)wallet["accounts"]).Select(p => NEP6Account.FromJson((JObject)p, this)).ToDictionary(p => p.ScriptHash);
extra = wallet["extra"];
Thread.MemoryBarrier();
if (!VerifyPasswordInternal(password.GetClearText()))
throw new InvalidOperationException("Wrong password.");
}
Expand Down

0 comments on commit 6098d88

Please sign in to comment.