@@ -47,18 +47,22 @@ void PSBTOperationsDialog::openWithPSBT(PartiallySignedTransaction psbtx)
4747{
4848 m_transaction_data = psbtx;
4949
50- bool complete;
51- size_t n_could_sign;
52- FinalizePSBT (psbtx); // Make sure all existing signatures are fully combined before checking for completeness.
53- TransactionError err = m_wallet_model->wallet ().fillPSBT (SIGHASH_ALL , false /* sign */ , true /* bip32derivs */ , &n_could_sign, m_transaction_data, complete);
54- if (err != TransactionError::OK ) {
55- showStatus (tr (" Failed to load transaction: %1" )
56- .arg (QString::fromStdString (TransactionErrorString (err).translated )), StatusLevel::ERR );
57- return ;
50+ bool complete = FinalizePSBT (psbtx); // Make sure all existing signatures are fully combined before checking for completeness.
51+ if (m_wallet_model) {
52+ size_t n_could_sign;
53+ TransactionError err = m_wallet_model->wallet ().fillPSBT (SIGHASH_ALL , false /* sign */ , true /* bip32derivs */ , &n_could_sign, m_transaction_data, complete);
54+ if (err != TransactionError::OK ) {
55+ showStatus (tr (" Failed to load transaction: %1" )
56+ .arg (QString::fromStdString (TransactionErrorString (err).translated )),
57+ StatusLevel::ERR );
58+ return ;
59+ }
60+ m_ui->signTransactionButton ->setEnabled (!complete && !m_wallet_model->wallet ().privateKeysDisabled () && n_could_sign > 0 );
61+ } else {
62+ m_ui->signTransactionButton ->setEnabled (false );
5863 }
5964
6065 m_ui->broadcastTransactionButton ->setEnabled (complete);
61- m_ui->signTransactionButton ->setEnabled (!complete && !m_wallet_model->wallet ().privateKeysDisabled () && n_could_sign > 0 );
6266
6367 updateTransactionDisplay ();
6468}
@@ -133,7 +137,7 @@ void PSBTOperationsDialog::saveTransaction() {
133137 }
134138 CTxDestination address;
135139 ExtractDestination (out.scriptPubKey , address);
136- QString amount = BitcoinUnits::format (m_wallet_model ->getOptionsModel ()->getDisplayUnit (), out.nValue );
140+ QString amount = BitcoinUnits::format (m_client_model ->getOptionsModel ()->getDisplayUnit (), out.nValue );
137141 QString address_str = QString::fromStdString (EncodeDestination (address));
138142 filename_suggestion.append (address_str + " -" + amount);
139143 first = false ;
@@ -224,6 +228,10 @@ void PSBTOperationsDialog::showStatus(const QString &msg, StatusLevel level) {
224228}
225229
226230size_t PSBTOperationsDialog::couldSignInputs (const PartiallySignedTransaction &psbtx) {
231+ if (!m_wallet_model) {
232+ return 0 ;
233+ }
234+
227235 size_t n_signed;
228236 bool complete;
229237 TransactionError err = m_wallet_model->wallet ().fillPSBT (SIGHASH_ALL , false /* sign */ , false /* bip32derivs */ , &n_signed, m_transaction_data, complete);
@@ -246,7 +254,10 @@ void PSBTOperationsDialog::showTransactionStatus(const PartiallySignedTransactio
246254 case PSBTRole::SIGNER : {
247255 QString need_sig_text = tr (" Transaction still needs signature(s)." );
248256 StatusLevel level = StatusLevel::INFO ;
249- if (m_wallet_model->wallet ().privateKeysDisabled ()) {
257+ if (!m_wallet_model) {
258+ need_sig_text += " " + tr (" (But no wallet is loaded.)" );
259+ level = StatusLevel::WARN ;
260+ } else if (m_wallet_model->wallet ().privateKeysDisabled ()) {
250261 need_sig_text += " " + tr (" (But this wallet cannot sign transactions.)" );
251262 level = StatusLevel::WARN ;
252263 } else if (n_could_sign < 1 ) {
0 commit comments