Remove useless code (#6817)

* Remove unused code

* Obsolete SigningKey concept
This commit is contained in:
Nicolas Dorier
2025-06-30 19:28:01 +09:00
committed by GitHub
parent efc570a4f7
commit 9b64e90394
13 changed files with 65 additions and 101 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -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;

View File

@@ -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();
}