diff --git a/src/neo/Wallets/NEP6/NEP6Wallet.cs b/src/neo/Wallets/NEP6/NEP6Wallet.cs index 2db4d87e77..423e079dbf 100644 --- a/src/neo/Wallets/NEP6/NEP6Wallet.cs +++ b/src/neo/Wallets/NEP6/NEP6Wallet.cs @@ -302,14 +302,14 @@ public override bool VerifyPassword(string password) } } - public bool ChangePassword(string password_old, string password_new) + public override bool ChangePassword(string oldPassword, string newPassword) { bool succeed = true; lock (accounts) { Parallel.ForEach(accounts.Values, (account, state) => { - if (!account.ChangePasswordPrepare(password_old, password_new)) + if (!account.ChangePasswordPrepare(oldPassword, newPassword)) { state.Stop(); succeed = false; @@ -321,7 +321,7 @@ public bool ChangePassword(string password_old, string password_new) foreach (NEP6Account account in accounts.Values) account.ChangePasswordCommit(); if (password != null) - password = password_new; + password = newPassword; } else { diff --git a/src/neo/Wallets/SQLite/UserWallet.cs b/src/neo/Wallets/SQLite/UserWallet.cs index 7cfbca8034..bea3626d34 100644 --- a/src/neo/Wallets/SQLite/UserWallet.cs +++ b/src/neo/Wallets/SQLite/UserWallet.cs @@ -170,10 +170,10 @@ private void BuildDatabase() } } - public bool ChangePassword(string password_old, string password_new) + public override bool ChangePassword(string oldPassword, string newPassword) { - if (!VerifyPassword(password_old)) return false; - byte[] passwordKey = password_new.ToAesKey(); + if (!VerifyPassword(oldPassword)) return false; + byte[] passwordKey = newPassword.ToAesKey(); try { SaveStoredData("PasswordHash", passwordKey.Concat(salt).ToArray().Sha256()); diff --git a/src/neo/Wallets/Wallet.cs b/src/neo/Wallets/Wallet.cs index 0c8151a257..4831a82c96 100644 --- a/src/neo/Wallets/Wallet.cs +++ b/src/neo/Wallets/Wallet.cs @@ -23,6 +23,7 @@ public abstract class Wallet public abstract string Name { get; } public abstract Version Version { get; } + public abstract bool ChangePassword(string oldPassword, string newPassword); public abstract bool Contains(UInt160 scriptHash); public abstract WalletAccount CreateAccount(byte[] privateKey); public abstract WalletAccount CreateAccount(Contract contract, KeyPair key = null); diff --git a/tests/neo.UnitTests/Wallets/UT_Wallet.cs b/tests/neo.UnitTests/Wallets/UT_Wallet.cs index a210cf581e..15a1cc8844 100644 --- a/tests/neo.UnitTests/Wallets/UT_Wallet.cs +++ b/tests/neo.UnitTests/Wallets/UT_Wallet.cs @@ -21,6 +21,11 @@ internal class MyWallet : Wallet Dictionary accounts = new Dictionary(); + public override bool ChangePassword(string oldPassword, string newPassword) + { + throw new NotImplementedException(); + } + public override bool Contains(UInt160 scriptHash) { return accounts.ContainsKey(scriptHash);