Use network with hardware wallets for KeyPath and ExtPubKey
MODIFY
WalletWasabi/Blockchain/Keys/BlockchainState.cs
WalletWasabi/Blockchain/Keys/BlockchainState.cs
@@ -15,6 +15,12 @@ namespace WalletWasabi.Blockchain.Keys
Height = height;
}
+ public BlockchainState(Network network)
+ {
+ Network = network;
+ Height = 0;
+ }
+
public BlockchainState()
{
Network = Network.Main;

MODIFY
WalletWasabi/Blockchain/Keys/KeyManager.cs
WalletWasabi/Blockchain/Keys/KeyManager.cs
@@ -88,6 +88,18 @@ namespace WalletWasabi.Blockchain.Keys
ToFile();
}
+ public static KeyPath GetCorrectAccountKeyPath(Network network)
+ {
+ if (network == Network.TestNet)
+ {
+ return TestNetAccountKeyPath;
+ }
+ else
+ {
+ return DefaultAccountKeyPath;
+ }
+ }
+
public WpkhDescriptors GetOutputDescriptors(string password, Network network)
{
if (!MasterFingerprint.HasValue)
@@ -194,9 +206,9 @@ namespace WalletWasabi.Blockchain.Keys
return new KeyManager(null, null, null, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(), filePath);
}
- public static KeyManager CreateNewHardwareWalletWatchOnly(HDFingerprint masterFingerprint, ExtPubKey extPubKey, string? filePath = null)
+ public static KeyManager CreateNewHardwareWalletWatchOnly(HDFingerprint masterFingerprint, ExtPubKey extPubKey, Network network, string? filePath = null)
{
- return new KeyManager(null, null, masterFingerprint, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(), filePath);
+ return new KeyManager(null, null, masterFingerprint, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(network), filePath);
}
public static KeyManager Recover(Mnemonic mnemonic, string password, string? filePath = null, KeyPath? accountKeyPath = null, int minGapLimit = AbsoluteMinGapLimit)

MODIFY
WalletWasabi/Helpers/HardwareWalletOperationHelpers.cs
WalletWasabi/Helpers/HardwareWalletOperationHelpers.cs
@@ -28,10 +28,10 @@ namespace WalletWasabi.Helpers
var extPubKey = await client.GetXpubAsync(
device.Model,
device.Path,
- KeyManager.DefaultAccountKeyPath,
+ KeyManager.GetCorrectAccountKeyPath(network),
genCts.Token).ConfigureAwait(false);
- return KeyManager.CreateNewHardwareWalletWatchOnly(fingerPrint, extPubKey, walletFilePath);
+ return KeyManager.CreateNewHardwareWalletWatchOnly(fingerPrint, extPubKey, network, walletFilePath);
}
public static async Task InitHardwareWalletAsync(HwiEnumerateEntry device, Network network, CancellationToken cancelToken)

MODIFY
WalletWasabi/Helpers/ImportWalletHelper.cs
WalletWasabi/Helpers/ImportWalletHelper.cs
@@ -85,7 +85,7 @@ namespace WalletWasabi.Helpers
ExtPubKey extPubKey = NBitcoinHelpers.BetterParseExtPubKey(xpubString);
- return KeyManager.CreateNewHardwareWalletWatchOnly(mfp, extPubKey, walletFullPath);
+ return KeyManager.CreateNewHardwareWalletWatchOnly(mfp, extPubKey, manager.Network, walletFullPath);
}
}
}

Use network with hardware wallets for KeyPath and ExtPubKey