mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
This commit is contained in:
@@ -117,16 +117,14 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
|
||||
/* Clear old signature to ensure users don't get confused on error with an old signature displayed */
|
||||
ui->signatureOut_SM->clear();
|
||||
|
||||
CBitcoinAddress addr(ui->addressIn_SM->text().toStdString());
|
||||
if (!addr.IsValid())
|
||||
{
|
||||
CTxDestination destination = DecodeDestination(ui->addressIn_SM->text().toStdString());
|
||||
if (!IsValidDestination(destination)) {
|
||||
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_SM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
|
||||
return;
|
||||
}
|
||||
CKeyID keyID;
|
||||
if (!addr.GetKeyID(keyID))
|
||||
{
|
||||
const CKeyID* keyID = boost::get<CKeyID>(&destination);
|
||||
if (!keyID) {
|
||||
ui->addressIn_SM->setValid(false);
|
||||
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_SM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
|
||||
@@ -142,7 +140,7 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
|
||||
}
|
||||
|
||||
CKey key;
|
||||
if (!model->getPrivKey(keyID, key))
|
||||
if (!model->getPrivKey(*keyID, key))
|
||||
{
|
||||
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));
|
||||
@@ -197,16 +195,13 @@ void SignVerifyMessageDialog::on_addressBookButton_VM_clicked()
|
||||
|
||||
void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
|
||||
{
|
||||
CBitcoinAddress addr(ui->addressIn_VM->text().toStdString());
|
||||
if (!addr.IsValid())
|
||||
{
|
||||
CTxDestination destination = DecodeDestination(ui->addressIn_VM->text().toStdString());
|
||||
if (!IsValidDestination(destination)) {
|
||||
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_VM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
|
||||
return;
|
||||
}
|
||||
CKeyID keyID;
|
||||
if (!addr.GetKeyID(keyID))
|
||||
{
|
||||
if (!boost::get<CKeyID>(&destination)) {
|
||||
ui->addressIn_VM->setValid(false);
|
||||
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_VM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
|
||||
@@ -237,8 +232,7 @@ void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(CBitcoinAddress(pubkey.GetID()) == addr))
|
||||
{
|
||||
if (!(CTxDestination(pubkey.GetID()) == destination)) {
|
||||
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>"));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user