mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-19 08:34:26 +01:00
fix watch only dashboard
This commit is contained in:
@@ -149,7 +149,8 @@ public class Smartifier
|
|||||||
utxoLabels.TryGetValue(coin.OutPoint, out var labels);
|
utxoLabels.TryGetValue(coin.OutPoint, out var labels);
|
||||||
var unsmartTx = await CachedTransactions[coin.OutPoint.Hash];
|
var unsmartTx = await CachedTransactions[coin.OutPoint.Hash];
|
||||||
var pubKey = DerivationScheme.GetChild(coin.KeyPath).GetExtPubKeys().First().PubKey;
|
var pubKey = DerivationScheme.GetChild(coin.KeyPath).GetExtPubKeys().First().PubKey;
|
||||||
var kp = _accountKeyPath.Derive(coin.KeyPath).KeyPath;
|
//if there is no account key path, it most likely means this is a watch only wallet. Fake the key path
|
||||||
|
var kp = _accountKeyPath?.Derive(coin.KeyPath).KeyPath ?? new KeyPath(0);
|
||||||
|
|
||||||
var hdPubKey = new HdPubKey(pubKey, kp, new SmartLabel(labels.labels ?? new HashSet<string>()),
|
var hdPubKey = new HdPubKey(pubKey, kp, new SmartLabel(labels.labels ?? new HashSet<string>()),
|
||||||
current == 1 ? KeyState.Clean : KeyState.Used);
|
current == 1 ? KeyState.Clean : KeyState.Used);
|
||||||
|
|||||||
@@ -93,26 +93,30 @@ public class WalletProvider : PeriodicRunner,IWalletProvider
|
|||||||
var enabled = store.GetEnabledPaymentIds(_networkProvider).Contains(paymentMethod.PaymentId);
|
var enabled = store.GetEnabledPaymentIds(_networkProvider).Contains(paymentMethod.PaymentId);
|
||||||
var derivationStrategy = paymentMethod.AccountDerivation;
|
var derivationStrategy = paymentMethod.AccountDerivation;
|
||||||
BTCPayKeyChain keychain;
|
BTCPayKeyChain keychain;
|
||||||
|
var accountKeyPath = paymentMethod.AccountKeySettings.FirstOrDefault()?.GetRootedKeyPath();
|
||||||
if (isHotWallet && enabled)
|
if (isHotWallet && enabled)
|
||||||
{
|
{
|
||||||
var masterKey = await explorerClient.GetMetadataAsync<BitcoinExtKey>(derivationStrategy,
|
var masterKey = await explorerClient.GetMetadataAsync<BitcoinExtKey>(derivationStrategy,
|
||||||
WellknownMetadataKeys.MasterHDKey);
|
WellknownMetadataKeys.MasterHDKey);
|
||||||
var accountKey = await explorerClient.GetMetadataAsync<BitcoinExtKey>(derivationStrategy,
|
var accountKey = await explorerClient.GetMetadataAsync<BitcoinExtKey>(derivationStrategy,
|
||||||
WellknownMetadataKeys.AccountHDKey);
|
WellknownMetadataKeys.AccountHDKey);
|
||||||
var accountKeyPath = await explorerClient.GetMetadataAsync<RootedKeyPath>(derivationStrategy,
|
var accountKeyPath2 = await explorerClient.GetMetadataAsync<RootedKeyPath>(derivationStrategy,
|
||||||
WellknownMetadataKeys.AccountKeyPath);
|
WellknownMetadataKeys.AccountKeyPath);
|
||||||
|
accountKeyPath = accountKeyPath2 ?? accountKeyPath;
|
||||||
|
var smartifier = new Smartifier(_serviceProvider.GetRequiredService<WalletRepository>(),
|
||||||
|
explorerClient, derivationStrategy, name, UtxoLocker, accountKeyPath);
|
||||||
if (masterKey is null || accountKey is null || accountKeyPath is null)
|
if (masterKey is null || accountKey is null || accountKeyPath is null)
|
||||||
{
|
{
|
||||||
|
keychain = new BTCPayKeyChain(explorerClient, derivationStrategy, null, null, smartifier);
|
||||||
keychain = new BTCPayKeyChain(explorerClient, derivationStrategy, null, null, null);
|
|
||||||
}else
|
}else
|
||||||
keychain = new BTCPayKeyChain(explorerClient, derivationStrategy, masterKey, accountKey, new Smartifier(_serviceProvider.GetRequiredService<WalletRepository>(),explorerClient, derivationStrategy, name, UtxoLocker, accountKeyPath));
|
keychain = new BTCPayKeyChain(explorerClient, derivationStrategy, masterKey, accountKey, smartifier);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keychain = new BTCPayKeyChain(explorerClient, derivationStrategy, null, null, null);
|
var smartifier = new Smartifier(_serviceProvider.GetRequiredService<WalletRepository>(), explorerClient,
|
||||||
|
derivationStrategy, name, UtxoLocker, accountKeyPath);
|
||||||
|
keychain = new BTCPayKeyChain(explorerClient, derivationStrategy, null, null, smartifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user