Use a redirect for update

This commit is contained in:
nicolas.dorier
2019-05-31 00:00:20 +09:00
parent c8c33245b8
commit 8379b07de0
2 changed files with 3 additions and 7 deletions

View File

@@ -91,15 +91,11 @@ namespace BTCPayServer.Controllers
psbt = await UpdatePSBT(derivationSchemeSettings, psbt, network); psbt = await UpdatePSBT(derivationSchemeSettings, psbt, network);
if (psbt == null) if (psbt == null)
{ {
StatusMessage = "Error: You need to update NBXplorer"; ModelState.AddModelError(nameof(vm.PSBT), "You need to update your version of NBXplorer");
return View(vm); return View(vm);
} }
ModelState.Remove(nameof(vm.PSBT));
ModelState.Remove(nameof(vm.UploadedPSBTFile));
vm.PSBT = psbt.ToBase64();
vm.Decoded = psbt.ToString();
StatusMessage = "PSBT updated!"; StatusMessage = "PSBT updated!";
return View(vm); return RedirectToAction(nameof(WalletPSBT), new { walletId = walletId, psbt = psbt.ToBase64(), FileName = vm.FileName });
case "seed": case "seed":
return SignWithSeed(walletId, psbt.ToBase64()); return SignWithSeed(walletId, psbt.ToBase64());
case "broadcast": case "broadcast":

View File

@@ -324,7 +324,7 @@ namespace BTCPayServer.Controllers
case "analyze-psbt": case "analyze-psbt":
var name = var name =
$"Send-{string.Join('_', vm.Outputs.Select(output => $"{output.Amount}->{output.DestinationAddress}{(output.SubtractFeesFromOutput ? "-Fees" : string.Empty)}"))}.psbt"; $"Send-{string.Join('_', vm.Outputs.Select(output => $"{output.Amount}->{output.DestinationAddress}{(output.SubtractFeesFromOutput ? "-Fees" : string.Empty)}"))}.psbt";
return RedirectToAction(nameof(WalletPSBT), new { walletId = walletId, psbt = psbt.PSBT.ToBase64(), FileName= name }); return RedirectToAction(nameof(WalletPSBT), new { walletId = walletId, psbt = psbt.PSBT.ToBase64(), FileName = name });
default: default:
return View(vm); return View(vm);
} }