MCPcopy Create free account
hub / github.com/ElementsProject/elements / signTransaction

Method signTransaction

src/qt/psbtoperationsdialog.cpp:76–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void 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
107void PSBTOperationsDialog::broadcastTransaction()
108{

Callers

nothing calls this directly

Calls 6

TransactionErrorStringFunction · 0.85
requestUnlockMethod · 0.80
fillPSBTMethod · 0.80
walletMethod · 0.45
isValidMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected