Changeset View
Changeset View
Standalone View
Standalone View
src/qt/addresstablemodel.cpp
Show First 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | |||||
void AddressTableModel::updateEntry(const QString &address, | void AddressTableModel::updateEntry(const QString &address, | ||||
const QString &label, bool isMine, | const QString &label, bool isMine, | ||||
const QString &purpose, int status) { | const QString &purpose, int status) { | ||||
// Update address book model from Bitcoin core | // Update address book model from Bitcoin core | ||||
priv->updateEntry(address, label, isMine, purpose, status); | priv->updateEntry(address, label, isMine, purpose, status); | ||||
} | } | ||||
QString AddressTableModel::addRow(const QString &type, const QString &label, | QString AddressTableModel::addRow(const QString &type, const QString &label, | ||||
const QString &address) { | const QString &address, | ||||
const OutputType address_type) { | |||||
std::string strLabel = label.toStdString(); | std::string strLabel = label.toStdString(); | ||||
std::string strAddress = address.toStdString(); | std::string strAddress = address.toStdString(); | ||||
editStatus = OK; | editStatus = OK; | ||||
if (type == Send) { | if (type == Send) { | ||||
if (!walletModel->validateAddress(address)) { | if (!walletModel->validateAddress(address)) { | ||||
editStatus = INVALID_ADDRESS; | editStatus = INVALID_ADDRESS; | ||||
Show All 17 Lines | if (type == Send) { | ||||
return QString(); | return QString(); | ||||
} | } | ||||
if (!walletModel->wallet().getKeyFromPool(false /* internal */, | if (!walletModel->wallet().getKeyFromPool(false /* internal */, | ||||
newKey)) { | newKey)) { | ||||
editStatus = KEY_GENERATION_FAILURE; | editStatus = KEY_GENERATION_FAILURE; | ||||
return QString(); | return QString(); | ||||
} | } | ||||
} | } | ||||
walletModel->wallet().learnRelatedScripts(newKey, g_address_type); | walletModel->wallet().learnRelatedScripts(newKey, address_type); | ||||
strAddress = | strAddress = EncodeCashAddr(GetDestinationForKey(newKey, address_type), | ||||
EncodeCashAddr(GetDestinationForKey(newKey, g_address_type), | |||||
walletModel->getChainParams()); | walletModel->getChainParams()); | ||||
} else { | } else { | ||||
return QString(); | return QString(); | ||||
} | } | ||||
// Add entry | // Add entry | ||||
walletModel->wallet().setAddressBook( | walletModel->wallet().setAddressBook( | ||||
DecodeDestination(strAddress, walletModel->getChainParams()), strLabel, | DecodeDestination(strAddress, walletModel->getChainParams()), strLabel, | ||||
(type == Send ? "send" : "receive")); | (type == Send ? "send" : "receive")); | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |