mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
Rewrite the CanUseHotWallet, check if the derivationscheme is actually a hotwallet, before retrieving the seed
This commit is contained in:
@@ -388,7 +388,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
var signingKeyStr = await explorerClient
|
||||
.GetMetadataAsync<string>(derivationScheme.AccountDerivation,
|
||||
WellknownMetadataKeys.MasterHDKey);
|
||||
if (signingKeyStr is null)
|
||||
if (!derivationScheme.IsHotWallet || signingKeyStr is null)
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
$"{cryptoCode} sending services are not currently available");
|
||||
@@ -403,7 +403,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
var accountKey = signingKey.Derive(rootedKeyPath.KeyPath);
|
||||
|
||||
var changed = psbt.PSBT.PSBTChanged(() => psbt.PSBT.SignAll(derivationScheme.AccountDerivation, accountKey,
|
||||
rootedKeyPath, new SigningOptions() {EnforceLowR = !(signingContext?.EnforceLowR is false)}));
|
||||
rootedKeyPath, new SigningOptions() {EnforceLowR = signingContext?.EnforceLowR is bool v ? v : psbt.Suggestions.ShouldEnforceLowR }));
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
@@ -465,17 +465,6 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
return await _authorizationService.CanUseHotWallet(_cssThemeManager.Policies, User);
|
||||
}
|
||||
|
||||
private async Task<ExtKey> GetWallet(DerivationSchemeSettings derivationScheme)
|
||||
{
|
||||
if (!derivationScheme.IsHotWallet)
|
||||
return null;
|
||||
|
||||
var result = await _explorerClientProvider.GetExplorerClient(derivationScheme.Network.CryptoCode)
|
||||
.GetMetadataAsync<string>(derivationScheme.AccountDerivation,
|
||||
WellknownMetadataKeys.MasterHDKey);
|
||||
return string.IsNullOrEmpty(result) ? null : ExtKey.Parse(result, derivationScheme.Network.NBitcoinNetwork);
|
||||
}
|
||||
|
||||
private bool IsInvalidWalletRequest(string cryptoCode, out BTCPayNetwork network,
|
||||
out DerivationSchemeSettings derivationScheme, out IActionResult actionResult)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user