Add CashAddr Address Format
Ported from Bitcoin Unlimited, Bitcoin ABC
This commit is contained in:
@@ -15,8 +15,8 @@
|
||||
#include "sendcoinsentry.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
#include "base58.h"
|
||||
#include "coincontrol.h"
|
||||
#include "dstencode.h"
|
||||
#include "main.h" // mempool and minRelayTxFee
|
||||
#include "ui_interface.h"
|
||||
#include "txmempool.h"
|
||||
@@ -746,26 +746,43 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
||||
CoinControlDialog::coinControl->destChange = CNoDestination();
|
||||
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
|
||||
|
||||
CBitcoinAddress addr = CBitcoinAddress(text.toStdString());
|
||||
const CTxDestination dest = DecodeDestination(text.toStdString());
|
||||
|
||||
if (text.isEmpty()) // Nothing entered
|
||||
{
|
||||
ui->labelCoinControlChangeLabel->setText("");
|
||||
}
|
||||
else if (!addr.IsValid()) // Invalid address
|
||||
else if (!IsValidDestination(dest))
|
||||
{
|
||||
// Invalid address
|
||||
ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address"));
|
||||
}
|
||||
else // Valid address
|
||||
else
|
||||
{
|
||||
CKeyID keyid;
|
||||
addr.GetKeyID(keyid);
|
||||
if (!model->havePrivKey(keyid)) // Unknown change address
|
||||
// Valid address
|
||||
if (!model->IsSpendable(dest))
|
||||
{
|
||||
ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
|
||||
|
||||
// confirmation dialog
|
||||
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm custom change address"),
|
||||
tr("The address you selected for change is not part of "
|
||||
"this wallet. Any or all funds in your wallet may be "
|
||||
"sent to this address. Are you sure?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if (btnRetVal == QMessageBox::Yes)
|
||||
CoinControlDialog::coinControl->destChange = dest;
|
||||
else
|
||||
{
|
||||
ui->lineEditCoinControlChange->setText("");
|
||||
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
|
||||
ui->labelCoinControlChangeLabel->setText("");
|
||||
}
|
||||
}
|
||||
else // Known change address
|
||||
else
|
||||
{
|
||||
// Known change address
|
||||
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
|
||||
|
||||
// Query label
|
||||
@@ -775,7 +792,7 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
||||
else
|
||||
ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
|
||||
|
||||
CoinControlDialog::coinControl->destChange = addr.Get();
|
||||
CoinControlDialog::coinControl->destChange = dest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user