diff --git a/neo-cli/CLI/MainService.Wallet.cs b/neo-cli/CLI/MainService.Wallet.cs
index 0eb2115a9..df68bf808 100644
--- a/neo-cli/CLI/MainService.Wallet.cs
+++ b/neo-cli/CLI/MainService.Wallet.cs
@@ -483,6 +483,25 @@ private void OnChangePasswordCommand()
return;
}
+ if (CurrentWallet is NEP6Wallet wallet)
+ {
+ string backupFile = wallet.Path + ".bak";
+ if (!File.Exists(wallet.Path) || File.Exists(backupFile))
+ {
+ Console.WriteLine("Wallet backup fail");
+ return;
+ }
+ try
+ {
+ File.Copy(wallet.Path, backupFile);
+ }
+ catch (IOException)
+ {
+ Console.WriteLine("Wallet backup fail");
+ return;
+ }
+ }
+
bool succeed = CurrentWallet.ChangePassword(oldPassword, newPassword);
if (succeed)
{
diff --git a/neo-cli/neo-cli.csproj b/neo-cli/neo-cli.csproj
index ae36d6481..b9bb0f8c6 100644
--- a/neo-cli/neo-cli.csproj
+++ b/neo-cli/neo-cli.csproj
@@ -28,7 +28,7 @@
-
+