| 458 | } |
| 459 | |
| 460 | bool SendCoinsDialog::signWithExternalSigner(PartiallySignedTransaction& psbtx, CMutableTransaction& mtx, bool& complete) { |
| 461 | TransactionError err; |
| 462 | try { |
| 463 | err = model->wallet().fillPSBT(SIGHASH_ALL, /*sign=*/true, /*bip32derivs=*/true, /*n_signed=*/nullptr, psbtx, complete); |
| 464 | } catch (const std::runtime_error& e) { |
| 465 | QMessageBox::critical(nullptr, tr("Sign failed"), e.what()); |
| 466 | return false; |
| 467 | } |
| 468 | if (err == TransactionError::EXTERNAL_SIGNER_NOT_FOUND) { |
| 469 | //: "External signer" means using devices such as hardware wallets. |
| 470 | QMessageBox::critical(nullptr, tr("External signer not found"), "External signer not found"); |
| 471 | return false; |
| 472 | } |
| 473 | if (err == TransactionError::EXTERNAL_SIGNER_FAILED) { |
| 474 | //: "External signer" means using devices such as hardware wallets. |
| 475 | QMessageBox::critical(nullptr, tr("External signer failure"), "External signer failure"); |
| 476 | return false; |
| 477 | } |
| 478 | if (err != TransactionError::OK) { |
| 479 | tfm::format(std::cerr, "Failed to sign PSBT"); |
| 480 | processSendCoinsReturn(WalletModel::TransactionCreationFailed); |
| 481 | return false; |
| 482 | } |
| 483 | // fillPSBT does not always properly finalize |
| 484 | complete = FinalizeAndExtractPSBT(psbtx, mtx); |
| 485 | return true; |
| 486 | } |
| 487 | |
| 488 | void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked) |
| 489 | { |
nothing calls this directly
no test coverage detected