VerifyProofDialog: add verify Tx Secret Key

This commit is contained in:
tobtoht
2023-01-24 18:49:30 +01:00
parent 80a8c82bd2
commit a81148fb52
7 changed files with 115 additions and 4 deletions
+26
View File
@@ -47,6 +47,11 @@ VerifyProofDialog::VerifyProofDialog(Wallet *wallet, QWidget *parent)
ui->input_inMessage->clear();
ui->input_InProof->clear();
break;
case 3:
ui->line_keyTxID->clear();
ui->line_keyTxKey->clear();
ui->line_keyAddress->clear();
break;
}
});
@@ -67,6 +72,9 @@ void VerifyProofDialog::checkProof() {
case 2:
this->checkInProof();
break;
case 3:
this->checkTxKey();
break;
}
}
@@ -91,6 +99,24 @@ void VerifyProofDialog::checkInProof() {
this->checkTxProof(ui->lineEdit_inTxID->text(), ui->lineEdit_inAddress->text(), ui->input_inMessage->toPlainText(), ui->input_InProof->toPlainText());
}
void VerifyProofDialog::checkTxKey() {
ui->btn_verifyFormattedProof->setEnabled(false);
ui->btn_verify->setEnabled(false);
TxKeyResult res = m_wallet->checkTxKey(ui->line_keyTxID->text(), ui->line_keyTxKey->text(), ui->line_keyAddress->text());
if (!res.succes) {
this->proofStatus(false, QString("Error: %1").arg(res.errorString));
return;
}
if (!res.good) {
this->proofStatus(false, QString("Tx secret key does not decode any outputs for this transaction."));
return;
}
this->proofStatus(true, QString("Proof is valid.\n\nThis address received %1 XMR, with %2 confirmations").arg(res.amount, QString::number(res.confirmations)));
}
void VerifyProofDialog::checkFormattedProof() {
QRegularExpression proof("-----BEGIN (?<type>\\w+)-----\\n"
"Network: (?<coin>\\w+) (?<network>\\w+)\\n"