Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

XMLRPC: setaccount moves comment to the other, unused label #33

Closed
sgaltsev opened this Issue Apr 26, 2012 · 1 comment

Comments

Projects
None yet
1 participant

This is the bug that has been in client and daemon since very beginning. Intention of setaccount command is essentially to rename existing account. For some reason, from very beginning, it was reallocating old label to some other address. Can we get rid of this?

There is no other means to rename the label using XMLRPC without creating artefacts.

Alternatively, is it possible to introduce another XMLRPC command designed to rename label on account?

Value setaccount(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"setaccount \n"
"Sets the account associated with the given address.");

CBitcoinAddress address(params[0].get_str());
if (!address.IsValid())
    throw JSONRPCError(-5, "Invalid bitcoin address");


string strAccount;
if (params.size() > 1)
    strAccount = AccountFromValue(params[1]);

// Detect when changing the account of an address that is the 'unused current key' of another account:
//if (pwalletMain->mapAddressBook.count(address))
//{
//    string strOldAccount = pwalletMain->mapAddressBook[address];
//    if (address == GetAccountAddress(strOldAccount))
//        GetAccountAddress(strOldAccount, true);
//}

pwalletMain->SetAddressBookName(address, strAccount);

return Value::null;

}

@sgaltsev sgaltsev closed this May 9, 2012

sgaltsev commented May 9, 2012

this issue was open for a wrong branch, reopening in a right one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment