use SetAddressBook.

This commit is contained in:
Christopher Jeffrey 2014-11-03 13:35:35 -08:00
parent d4f8277d75
commit 17e2a8ff8e
1 changed files with 8 additions and 6 deletions

View File

@ -4562,10 +4562,10 @@ NAN_METHOD(WalletChangeLabel) {
// LOCK2(cs_main, pwalletMain->cs_wallet); // LOCK2(cs_main, pwalletMain->cs_wallet);
CWalletDB walletdb(pwalletMain->strWalletFile); // CWalletDB walletdb(pwalletMain->strWalletFile);
CAccount account; // CAccount account;
walletdb.ReadAccount(accountName, account); // walletdb.ReadAccount(accountName, account);
// setaccount/changelabel logic (bcoin): // setaccount/changelabel logic (bcoin):
// If address is mine - set account label // If address is mine - set account label
@ -4617,9 +4617,11 @@ NAN_METHOD(WalletChangeLabel) {
const CBitcoinAddress& address = item.first; const CBitcoinAddress& address = item.first;
const string& strName = item.second.name; const string& strName = item.second.name;
if (strName == accountName) { if (strName == accountName) {
walletdb.WriteName(address.ToString(), accountName); // walletdb.WriteName(address.ToString(), accountName);
walletdb.WritePurpose(address.ToString(), std::string("receive")); // walletdb.WritePurpose(address.ToString(), std::string("receive"));
// pwalletMain->SetAddressBook(address, accountName, std::string("receive")); CKeyID keyID;
address.GetKeyID(keyID);
pwalletMain->SetAddressBook(keyID, accountName, "receive");
} }
} }