Fix: PSBT Signing Option in MultiSig Server redirected incorrectly (fix #6668) (#6690)

This commit is contained in:
Nicolas Dorier
2025-04-23 14:40:28 +09:00
committed by GitHub
parent 391279fced
commit b96491a804
4 changed files with 23 additions and 15 deletions

View File

@@ -161,7 +161,7 @@ public class MultisigTests : UnitTestBase
await s.Page.ClickAsync("#PSBTOptionsImportHeader");
await s.Page.FillAsync("#ImportedPSBT", signedPsbt);
await s.Page.ClickAsync("#Decode");
await s.Page.ClickAsync("#Collect");
}
private GenerateWalletResponse generateWalletResp(string tpriv, string keypath, string derivation, BTCPayNetwork network)

View File

@@ -172,22 +172,16 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(WalletTransactions), new { walletId = walletId.ToString() });
case "sign":
return await WalletSign(walletId, vm);
case "decode":
ModelState.Remove(nameof(vm.PSBT));
ModelState.Remove(nameof(vm.FileName));
ModelState.Remove(nameof(vm.UploadedPSBTFile));
// for pending transactions we collect signature from PSBT and redirect if everything is good
if (vm.SigningContext.PendingTransactionId is not null)
{
case "collect" when vm.SigningContext.PendingTransactionId is not null:
return await RedirectToWalletPSBTReady(walletId,
new WalletPSBTReadyViewModel
{
SigningContext = vm.SigningContext, ReturnUrl = vm.ReturnUrl, BackUrl = vm.BackUrl
});
}
// for regular transactions we decode PSBT and show the details
case "decode":
ModelState.Remove(nameof(vm.PSBT));
ModelState.Remove(nameof(vm.FileName));
ModelState.Remove(nameof(vm.UploadedPSBTFile));
await FetchTransactionDetails(walletId, derivationSchemeSettings, vm, network);
return View("WalletPSBTDecoded", vm);

View File

@@ -92,7 +92,14 @@
<input asp-for="UploadedPSBTFile" type="file" class="form-control">
</div>
<div class="d-flex">
@if (this.Model.SigningContext.PendingTransactionId is not null)
{
<button type="submit" name="command" value="collect" class="btn btn-primary mt-2" id="Collect" text-translate="true">Collect signatures</button>
}
else
{
<button type="submit" name="command" value="decode" class="btn btn-primary mt-2" id="Decode" text-translate="true">Decode PSBT</button>
}
<button type="button" id="scanqrcode" class="btn btn-secondary only-for-js ms-3 mt-2" data-bs-toggle="modal" data-bs-target="#scanModal" text-translate="true">Scan wallet QR with camera</button>
</div>
</form>

View File

@@ -213,7 +213,14 @@ else
<input asp-for="UploadedPSBTFile" type="file" class="form-control">
</div>
<div class="d-flex flex-column flex-sm-row flex-wrap align-items-sm-center">
@if (this.Model.SigningContext.PendingTransactionId is not null)
{
<button type="submit" name="command" value="collect" class="btn btn-primary mb-3 mb-sm-0 me-sm-2" id="Collect" text-translate="true">Collect signatures</button>
}
else
{
<button type="submit" name="command" value="decode" class="btn btn-primary mb-3 mb-sm-0 me-sm-2" id="Decode" text-translate="true">Decode PSBT</button>
}
<button type="button" id="scanqrcode" class="btn btn-primary only-for-js" data-bs-toggle="modal" data-bs-target="#scanModal" text-translate="true">Scan wallet QR with camera</button>
</div>
</form>