Only KeyManager CreateNew is newly created
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/WalletNamePageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/WalletNamePageViewModel.cs
@@ -100,8 +100,6 @@ public partial class WalletNamePageViewModel : RoutableViewModel
return walletGenerator.GenerateWallet(walletName, password);
});
- km.IsNewlyCreated = true;
-
Navigate().To(new RecoveryWordsViewModel(km, mnemonic));
IsBusy = false;

MODIFY
WalletWasabi/Blockchain/Keys/KeyManager.cs
WalletWasabi/Blockchain/Keys/KeyManager.cs
@@ -39,7 +39,7 @@ public class KeyManager
private static readonly KeyPath TestNetAccountKeyPath = new("m/84h/1h/0h");
[JsonConstructor]
- public KeyManager(BitcoinEncryptedSecretNoEC encryptedSecret, byte[] chainCode, HDFingerprint? masterFingerprint, ExtPubKey extPubKey, bool? isNewlyCreated, int? minGapLimit, BlockchainState blockchainState, string? filePath = null, KeyPath? accountKeyPath = null)
+ public KeyManager(BitcoinEncryptedSecretNoEC encryptedSecret, byte[] chainCode, HDFingerprint? masterFingerprint, ExtPubKey extPubKey, bool isNewlyCreated, int? minGapLimit, BlockchainState blockchainState, string? filePath = null, KeyPath? accountKeyPath = null)
{
HdPubKeys = new List<HdPubKey>();
HdPubKeyScriptBytes = new List<byte[]>();
@@ -54,7 +54,7 @@ public class KeyManager
MasterFingerprint = masterFingerprint;
ExtPubKey = Guard.NotNull(nameof(extPubKey), extPubKey);
- IsNewlyCreated = isNewlyCreated ?? false;
+ IsNewlyCreated = isNewlyCreated;
SetMinGapLimit(minGapLimit);
BlockchainState = blockchainState;
@@ -205,17 +205,17 @@ public class KeyManager
BlockchainState blockchainState = new(network);
KeyPath keyPath = GetAccountKeyPath(network);
ExtPubKey extPubKey = extKey.Derive(keyPath).Neuter();
- return new KeyManager(encryptedSecret, extKey.ChainCode, masterFingerprint, extPubKey, false, AbsoluteMinGapLimit, blockchainState, filePath, keyPath);
+ return new KeyManager(encryptedSecret, extKey.ChainCode, masterFingerprint, extPubKey, isNewlyCreated: true, AbsoluteMinGapLimit, blockchainState, filePath, keyPath);
}
public static KeyManager CreateNewWatchOnly(ExtPubKey extPubKey, string? filePath = null)
{
- return new KeyManager(null, null, null, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(), filePath);
+ return new KeyManager(null, null, null, extPubKey, false, AbsoluteMinGapLimit, new BlockchainState(), filePath);
}
public static KeyManager CreateNewHardwareWalletWatchOnly(HDFingerprint masterFingerprint, ExtPubKey extPubKey, Network network, string? filePath = null)
{
- return new KeyManager(null, null, masterFingerprint, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(network), filePath);
+ return new KeyManager(null, null, masterFingerprint, extPubKey, isNewlyCreated: false, AbsoluteMinGapLimit, new BlockchainState(network), filePath);
}
public static KeyManager Recover(Mnemonic mnemonic, string password, Network network, KeyPath accountKeyPath, string? filePath = null, int minGapLimit = AbsoluteMinGapLimit)

Only KeyManager CreateNew is newly created