2
2
#include " guiutil.h"
3
3
#include " walletmodel.h"
4
4
5
+ #include < key_io.h>
5
6
#include " wallet/wallet.h"
6
- #include " base58.h"
7
7
#include " util.h"
8
8
9
9
#include < QFont>
@@ -62,12 +62,12 @@ class AddressTablePriv
62
62
LOCK (wallet->cs_wallet );
63
63
for (auto const &item : wallet->mapAddressBook )
64
64
{
65
- const CBitcoinAddress & address = item.first ;
65
+ const std::string & address = EncodeDestination ( item.first ) ;
66
66
const std::string& strName = item.second ;
67
- isminetype fMine = IsMine (*wallet, address. Get () );
67
+ isminetype fMine = IsMine (*wallet, item. first );
68
68
cachedAddressTable.append (AddressTableEntry ((fMine != ISMINE_NO) ? AddressTableEntry::Receiving : AddressTableEntry::Sending,
69
69
QString::fromStdString (strName),
70
- QString::fromStdString (address. ToString () )));
70
+ QString::fromStdString (address)));
71
71
}
72
72
}
73
73
// std::lower_bound() and std::upper_bound() require our cachedAddressTable list to be sorted in asc order
@@ -222,7 +222,7 @@ bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value,
222
222
auto address_count = [this ](const QVariant &value) {
223
223
LOCK (wallet->cs_wallet );
224
224
225
- return wallet->mapAddressBook .count (CBitcoinAddress (value.toString ().toStdString ()). Get ( ));
225
+ return wallet->mapAddressBook .count (DecodeDestination (value.toString ().toStdString ()));
226
226
};
227
227
228
228
if (role == Qt::EditRole)
@@ -236,11 +236,11 @@ bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value,
236
236
editStatus = NO_CHANGES;
237
237
return false ;
238
238
}
239
- wallet->SetAddressBookName (CBitcoinAddress (rec->address .toStdString ()). Get ( ), value.toString ().toStdString ());
239
+ wallet->SetAddressBookName (DecodeDestination (rec->address .toStdString ()), value.toString ().toStdString ());
240
240
break ;
241
241
case Address:
242
242
// Do nothing, if old address == new address
243
- if (CBitcoinAddress (rec->address .toStdString ()) == CBitcoinAddress (value.toString ().toStdString ()))
243
+ if (DecodeDestination (rec->address .toStdString ()) == DecodeDestination (value.toString ().toStdString ()))
244
244
{
245
245
editStatus = NO_CHANGES;
246
246
return false ;
@@ -264,9 +264,9 @@ bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value,
264
264
{
265
265
LOCK (wallet->cs_wallet );
266
266
// Remove old entry
267
- wallet->DelAddressBookName (CBitcoinAddress (rec->address .toStdString ()). Get ( ));
267
+ wallet->DelAddressBookName (DecodeDestination (rec->address .toStdString ()));
268
268
// Add new entry with new address
269
- wallet->SetAddressBookName (CBitcoinAddress (value.toString ().toStdString ()). Get ( ), rec->label .toStdString ());
269
+ wallet->SetAddressBookName (DecodeDestination (value.toString ().toStdString ()), rec->label .toStdString ());
270
270
}
271
271
}
272
272
break ;
@@ -342,7 +342,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
342
342
// Check for duplicate addresses
343
343
{
344
344
LOCK (wallet->cs_wallet );
345
- if (wallet->mapAddressBook .count (CBitcoinAddress (strAddress). Get ( )))
345
+ if (wallet->mapAddressBook .count (DecodeDestination (strAddress)))
346
346
{
347
347
editStatus = DUPLICATE_ADDRESS;
348
348
return QString ();
@@ -365,7 +365,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
365
365
editStatus = KEY_GENERATION_FAILURE;
366
366
return QString ();
367
367
}
368
- strAddress = CBitcoinAddress (newKey.GetID ()). ToString ( );
368
+ strAddress = EncodeDestination (newKey.GetID ());
369
369
}
370
370
else
371
371
{
@@ -375,7 +375,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
375
375
// Add entry
376
376
{
377
377
LOCK (wallet->cs_wallet );
378
- wallet->SetAddressBookName (CBitcoinAddress (strAddress). Get ( ), strLabel);
378
+ wallet->SetAddressBookName (DecodeDestination (strAddress), strLabel);
379
379
}
380
380
return QString::fromStdString (strAddress);
381
381
}
@@ -392,7 +392,7 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent
392
392
}
393
393
{
394
394
LOCK (wallet->cs_wallet );
395
- wallet->DelAddressBookName (CBitcoinAddress (rec->address .toStdString ()). Get ( ));
395
+ wallet->DelAddressBookName (DecodeDestination (rec->address .toStdString ()));
396
396
}
397
397
return true ;
398
398
}
@@ -403,8 +403,7 @@ QString AddressTableModel::labelForAddress(const QString &address) const
403
403
{
404
404
{
405
405
LOCK (wallet->cs_wallet );
406
- CBitcoinAddress address_parsed (address.toStdString ());
407
- std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook .find (address_parsed.Get ());
406
+ std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook .find (DecodeDestination (address.toStdString ()));
408
407
if (mi != wallet->mapAddressBook .end ())
409
408
{
410
409
return QString::fromStdString (mi->second );
0 commit comments