We like properties in the library
MODIFY
WalletWasabi/WabiSabi/Client/KeyChain.cs
WalletWasabi/WabiSabi/Client/KeyChain.cs
@@ -8,7 +8,7 @@ namespace WalletWasabi.WabiSabi.Client;
public class KeyChain : BaseKeyChain
{
- private readonly KeyManager _keyManager;
+ private KeyManager KeyManager { get; }
public KeyChain(KeyManager keyManager, Kitchen kitchen) : base(kitchen)
{
@@ -16,17 +16,17 @@ public class KeyChain : BaseKeyChain
{
throw new ArgumentException("A watch-only keymanager cannot be used to initialize a keychain.");
}
- _keyManager = keyManager;
+ KeyManager = keyManager;
}
protected override Key GetMasterKey()
{
- return _keyManager.GetMasterExtKey(Kitchen.SaltSoup()).PrivateKey;
+ return KeyManager.GetMasterExtKey(Kitchen.SaltSoup()).PrivateKey;
}
public override void NotifyScriptState(IEnumerable<Script> scripts, KeyState state)
{
- foreach (var hdPubKey in _keyManager.GetKeys(key => scripts.Any(key.ContainsScript)))
+ foreach (var hdPubKey in KeyManager.GetKeys(key => scripts.Any(key.ContainsScript)))
{
hdPubKey.SetKeyState(state);
}
@@ -35,7 +35,7 @@ public class KeyChain : BaseKeyChain
protected override BitcoinSecret GetBitcoinSecret(Script scriptPubKey)
{
{
- var hdKey = _keyManager.GetSecrets(Kitchen.SaltSoup(), scriptPubKey).Single();
+ var hdKey = KeyManager.GetSecrets(Kitchen.SaltSoup(), scriptPubKey).Single();
if (hdKey is null)
{
throw new InvalidOperationException($"The signing key for '{scriptPubKey}' was not found.");
@@ -44,7 +44,7 @@ public class KeyChain : BaseKeyChain
{
throw new InvalidOperationException("The key cannot generate the utxo scriptpubkey. This could happen if the wallet password is not the correct one.");
}
- var secret = hdKey.PrivateKey.GetBitcoinSecret(_keyManager.GetNetwork());
+ var secret = hdKey.PrivateKey.GetBitcoinSecret(KeyManager.GetNetwork());
return secret;
}
}

We like properties in the library