mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Improve error handling for export psbt
This commit is contained in:
@@ -244,8 +244,21 @@ namespace BTCPayServer.Controllers
|
|||||||
{
|
{
|
||||||
var storeData = (await Repository.FindStore(walletId.StoreId, GetUserId()));
|
var storeData = (await Repository.FindStore(walletId.StoreId, GetUserId()));
|
||||||
var derivationScheme = GetPaymentMethod(walletId, storeData);
|
var derivationScheme = GetPaymentMethod(walletId, storeData);
|
||||||
var psbt = await CreatePSBT(network, derivationScheme, sendModel, cancellation);
|
try
|
||||||
return File(psbt.PSBT.ToBytes(), "application/octet-stream", $"Send-{vm.Amount.Value}-{network.CryptoCode}-to-{destination[0].ToString()}.psbt");
|
{
|
||||||
|
var psbt = await CreatePSBT(network, derivationScheme, sendModel, cancellation);
|
||||||
|
return File(psbt.PSBT.ToBytes(), "application/octet-stream", $"Send-{vm.Amount.Value}-{network.CryptoCode}-to-{destination[0].ToString()}.psbt");
|
||||||
|
}
|
||||||
|
catch (NBXplorerException ex)
|
||||||
|
{
|
||||||
|
ModelState.AddModelError(nameof(vm.Amount), ex.Error.Message);
|
||||||
|
return View(vm);
|
||||||
|
}
|
||||||
|
catch (NotSupportedException)
|
||||||
|
{
|
||||||
|
ModelState.AddModelError(nameof(vm.Destination), "You need to update your version of NBXplorer");
|
||||||
|
return View(vm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +296,6 @@ namespace BTCPayServer.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (derivationSettings.AccountKeyPath != null && derivationSettings.AccountKeyPath.Indexes.Length != 0)
|
if (derivationSettings.AccountKeyPath != null && derivationSettings.AccountKeyPath.Indexes.Length != 0)
|
||||||
{
|
{
|
||||||
// NBX only know the path relative to the account xpub.
|
// NBX only know the path relative to the account xpub.
|
||||||
|
|||||||
Reference in New Issue
Block a user