Skip to content

Commit

Permalink
fix: concurrency conflict because of Memory Order in Nep6Wallt and SQ…
Browse files Browse the repository at this point in the history
…LiteWallt creation
  • Loading branch information
nan01ab committed Oct 13, 2024
1 parent a326939 commit 6ce4633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Neo/Wallets/NEP6/NEP6Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;

namespace Neo.Wallets.NEP6
Expand Down Expand Up @@ -93,6 +94,7 @@ 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
1 change: 1 addition & 0 deletions src/Plugins/SQLiteWallet/SQLiteWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ private Dictionary<UInt160, SQLiteWalletAccount> LoadAccounts()
account.Contract = contract;
account.Key = new KeyPair(GetPrivateKeyFromNEP2(db_contract.Account.Nep2key, masterKey, ProtocolSettings.AddressVersion, scrypt.N, scrypt.R, scrypt.P));
}
Thread.MemoryBarrier();
return accounts;
}

Expand Down

0 comments on commit 6ce4633

Please sign in to comment.