mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-27 18:04:26 +01:00
Remove useless code (#6817)
* Remove unused code * Obsolete SigningKey concept
This commit is contained in:
@@ -580,8 +580,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
|
||||
var signingKey = ExtKey.Parse(signingKeyStr, network.NBitcoinNetwork);
|
||||
|
||||
var signingKeySettings = derivationScheme.GetSigningAccountKeySettings(signingKey);
|
||||
RootedKeyPath? rootedKeyPath = signingKeySettings?.GetRootedKeyPath();
|
||||
var signingKeySettings = derivationScheme.GetAccountKeySettingsFromRoot(signingKey);
|
||||
var rootedKeyPath = signingKeySettings?.GetRootedKeyPath();
|
||||
if (rootedKeyPath is null || signingKeySettings is null)
|
||||
{
|
||||
return this.CreateAPIError(503, "not-available",
|
||||
|
||||
@@ -407,13 +407,12 @@ public partial class UIStoresController
|
||||
Network = network,
|
||||
IsHotWallet = derivation.IsHotWallet,
|
||||
Source = derivation.Source,
|
||||
RootFingerprint = derivation.GetSigningAccountKeySettingsOrDefault()?.RootFingerprint.ToString(),
|
||||
RootFingerprint = derivation.GetFirstAccountKeySettings().RootFingerprint.ToString(),
|
||||
DerivationScheme = derivation.AccountDerivation?.ToString(),
|
||||
DerivationSchemeInput = derivation.AccountOriginal,
|
||||
KeyPath = derivation.GetSigningAccountKeySettingsOrDefault()?.AccountKeyPath?.ToString(),
|
||||
KeyPath = derivation.GetFirstAccountKeySettings().AccountKeyPath?.ToString(),
|
||||
UriScheme = network.NBitcoinNetwork.UriScheme,
|
||||
Label = derivation.Label,
|
||||
SelectedSigningKey = derivation.SigningKey?.ToString(),
|
||||
NBXSeedAvailable = derivation.IsHotWallet &&
|
||||
perm.CanCreateHotWallet &&
|
||||
!string.IsNullOrEmpty(await client.GetMetadataAsync<string>(derivation.AccountDerivation,
|
||||
@@ -480,15 +479,6 @@ public partial class UIStoresController
|
||||
derivation.DefaultIncludeNonWitnessUtxo = vm.DefaultIncludeNonWitnessUtxo;
|
||||
}
|
||||
|
||||
var signingKey = string.IsNullOrEmpty(vm.SelectedSigningKey)
|
||||
? null
|
||||
: new BitcoinExtPubKey(vm.SelectedSigningKey, network.NBitcoinNetwork);
|
||||
if (derivation.SigningKey != signingKey && signingKey != null)
|
||||
{
|
||||
needUpdate = true;
|
||||
derivation.SigningKey = signingKey;
|
||||
}
|
||||
|
||||
for (int i = 0; i < derivation.AccountKeySettings.Length; i++)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
if (signingKey == null || signingKeyPath == null)
|
||||
{
|
||||
var signingKeySettings = derivationSchemeSettings.GetSigningAccountKeySettings();
|
||||
var signingKeySettings = derivationSchemeSettings.GetFirstAccountKeySettings();
|
||||
if (signingKey == null)
|
||||
{
|
||||
signingKey = signingKeySettings.AccountKey;
|
||||
|
||||
@@ -997,7 +997,7 @@ namespace BTCPayServer.Controllers
|
||||
Labels = _labelService.CreateTransactionTagModels(info, Request),
|
||||
Link = _transactionLinkProviders.GetTransactionLink(pmi, coin.OutPoint.ToString()),
|
||||
Confirmations = coin.Confirmations,
|
||||
Timestamp = coin.Timestamp
|
||||
Timestamp = coin.Timestamp
|
||||
};
|
||||
}).ToArray();
|
||||
}
|
||||
@@ -1479,13 +1479,12 @@ namespace BTCPayServer.Controllers
|
||||
var settings = GetDerivationSchemeSettings(walletId);
|
||||
if (settings is null)
|
||||
return NotFound();
|
||||
var signingKeySettings = settings.GetSigningAccountKeySettings(extKey);
|
||||
var signingKeySettings = settings.GetAccountKeySettingsFromRoot(extKey);
|
||||
if (signingKeySettings is null)
|
||||
{
|
||||
// Let's try best effort if RootFingerprint isn't configured, but AccountKeyPath is
|
||||
signingKeySettings = settings.AccountKeySettings
|
||||
.Where(a => a.RootFingerprint is null && a.AccountKeyPath is not null)
|
||||
.FirstOrDefault();
|
||||
.FirstOrDefault(a => a.RootFingerprint is null && a.AccountKeyPath is not null);
|
||||
if (signingKeySettings is not null)
|
||||
signingKeySettings.RootFingerprint = extKey.GetPublicKey().GetHDFingerPrint();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user