Selenium tests for Multisig on server (#6487)

* Adding MultisigTests

* Adding fetching of receive address and creating pending transaction

* Completing multisig test flow

* Reverting Selenium ChromeDriver version

* Adding generation of PSBTs

* Removing unnecessary lines

* PSBT test signing now working with multisig dervation scheme

* Updating SignTestPSBT test

* Reducing number of iterations for test funding, to speed up tests

* Bugfixing PSBT problem

* Ensuring that PSBT signing also works for pending transactions

* Ensuring we don't collect count duplicate signatures for same PSBTs

* Resolving bug in PendingTransactionService where Combine was modifying object

* Fixing bug where pending transaction was not broadcased if there was ReturnUrl

* Finally finishing Multisig Selenium test flow with signing PSBTs, broadcasting and cancelling them

* Small nit, waiting loaded element

* Nit: Use AssetElementNotFound

* Fix warning

* Remove code dups

---------

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
rockstardev
2025-02-25 00:39:57 -05:00
committed by GitHub
parent 9d5baabc2c
commit 8b5c5895f0
8 changed files with 296 additions and 47 deletions

View File

@@ -239,6 +239,7 @@ namespace BTCPayServer.Controllers
vm.NBXSeedAvailable = await CanUseHotWallet() && derivationSchemeSettings.IsHotWallet;
vm.BackUrl ??= HttpContext.Request.GetTypedHeaders().Referer?.AbsolutePath;
vm.SigningContext.PSBT = vm.PSBT;
var psbt = await vm.GetPSBT(network.NBitcoinNetwork, ModelState);
if (vm.InvalidPSBT)
{
@@ -259,6 +260,18 @@ namespace BTCPayServer.Controllers
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)
{
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
await FetchTransactionDetails(walletId, derivationSchemeSettings, vm, network);
return View("WalletPSBTDecoded", vm);
@@ -603,16 +616,18 @@ namespace BTCPayServer.Controllers
{
TempData[WellKnownTempData.SuccessMessage] = StringLocalizer["Transaction broadcasted successfully ({0})", transaction.GetHash()].Value;
}
if (!string.IsNullOrEmpty(vm.ReturnUrl))
{
return LocalRedirect(vm.ReturnUrl);
}
if (vm.SigningContext.PendingTransactionId is not null)
{
await _pendingTransactionService.Broadcasted(walletId.CryptoCode, walletId.StoreId,
vm.SigningContext.PendingTransactionId);
}
if (!string.IsNullOrEmpty(vm.ReturnUrl))
{
return LocalRedirect(vm.ReturnUrl);
}
return RedirectToAction(nameof(WalletTransactions), new { walletId = walletId.ToString() });
}
case "analyze-psbt":