Improve error messages for on-chain related greenfield operations (#6393)

* Improve error messages for on-chain related greenfield operations

* Fix test
This commit is contained in:
Nicolas Dorier 2024-11-13 10:11:04 +09:00 committed by GitHub
parent 796d8d4406
commit 894f68f2ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -345,7 +345,7 @@ retry:
var fetcher = new RateFetcher(factory);
Assert.True(RateRules.TryParse("X_X=kraken(X_BTC) * kraken(BTC_X)", out var rule));
foreach (var pair in new[] { "DOGE_USD", "DOGE_CAD", "DASH_CAD", "DASH_USD", "DASH_EUR" })
foreach (var pair in new[] { "DOGE_USD", "DOGE_CAD" })
{
var result = fetcher.FetchRate(CurrencyPair.Parse(pair), rule, null, default).GetAwaiter().GetResult();
Assert.NotNull(result.BidAsk);

View File

@ -379,7 +379,7 @@ namespace BTCPayServer.Controllers.Greenfield
if (network.ReadonlyWallet)
{
return this.CreateAPIError(503, "not-available",
$"{network.CryptoCode} sending services are not currently available");
$"This network only support read-only features");
}
//This API is only meant for hot wallet usage for now. We can expand later when we allow PSBT manipulation.
@ -573,8 +573,11 @@ namespace BTCPayServer.Controllers.Greenfield
WellknownMetadataKeys.MasterHDKey);
if (!derivationScheme.IsHotWallet || signingKeyStr is null)
{
return this.CreateAPIError(503, "not-available",
$"{network.CryptoCode} sending services are not currently available");
var reason = !derivationScheme.IsHotWallet ?
"You cannot send from a cold wallet" :
"NBXplorer doesn't have the seed of the wallet";
return this.CreateAPIError(503, "not-available", reason);
}
var signingKey = ExtKey.Parse(signingKeyStr, network.NBitcoinNetwork);