| 74 | } |
| 75 | |
| 76 | void PSBTOperationsDialog::signTransaction() |
| 77 | { |
| 78 | bool complete; |
| 79 | size_t n_signed; |
| 80 | |
| 81 | WalletModel::UnlockContext ctx(m_wallet_model->requestUnlock()); |
| 82 | |
| 83 | TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, true /* sign */, true /* bip32derivs */, &n_signed, m_transaction_data, complete); |
| 84 | |
| 85 | if (err != TransactionError::OK) { |
| 86 | showStatus(tr("Failed to sign transaction: %1") |
| 87 | .arg(QString::fromStdString(TransactionErrorString(err).translated)), StatusLevel::ERR); |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | updateTransactionDisplay(); |
| 92 | |
| 93 | if (!complete && !ctx.isValid()) { |
| 94 | showStatus(tr("Cannot sign inputs while wallet is locked."), StatusLevel::WARN); |
| 95 | } else if (!complete && n_signed < 1) { |
| 96 | showStatus(tr("Could not sign any more inputs."), StatusLevel::WARN); |
| 97 | } else if (!complete) { |
| 98 | showStatus(tr("Signed %1 inputs, but more signatures are still required.").arg(n_signed), |
| 99 | StatusLevel::INFO); |
| 100 | } else { |
| 101 | showStatus(tr("Signed transaction successfully. Transaction is ready to broadcast."), |
| 102 | StatusLevel::INFO); |
| 103 | m_ui->broadcastTransactionButton->setEnabled(true); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | void PSBTOperationsDialog::broadcastTransaction() |
| 108 | { |
nothing calls this directly
no test coverage detected