RPC/REST/ZMQ, Wallet: Set label with importprivkey only requested #13365

pull yuntai wants to merge 1 commits into bitcoin:master from yuntai:master changing 1 files +2 −1
  1. yuntai commented at 12:07 PM on June 1, 2018: none

    refs #13087

  2. Set label with importprivkey only requested. #13087 ce5431eaa8
  3. MarcoFalke added the label Wallet on Jun 1, 2018
  4. MarcoFalke added the label RPC/REST/ZMQ on Jun 1, 2018
  5. yuntai renamed this:
    RPC/REST/ZMQ: Set label with importprivkey only requested. #13087
    RPC/REST/ZMQ: Set label with importprivkey only requested
    on Jun 1, 2018
  6. yuntai renamed this:
    RPC/REST/ZMQ: Set label with importprivkey only requested
    RPC/REST/ZMQ, Wallet: Set label with importprivkey only requested
    on Jun 1, 2018
  7. promag commented at 11:07 PM on June 1, 2018: member

    I don't think this is the correct fix. What if the caller wants an empty string?

  8. in src/wallet/wallet.cpp:3265 in ce5431eaa8
    3261 | @@ -3262,7 +3262,8 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& s
    3262 |          LOCK(cs_wallet); // mapAddressBook
    3263 |          std::map<CTxDestination, CAddressBookData>::iterator mi = mapAddressBook.find(address);
    3264 |          fUpdated = mi != mapAddressBook.end();
    3265 | -        mapAddressBook[address].name = strName;
    3266 | +        if (!strName.empty()) /* update name only if requested */
    


    sipa commented at 11:20 PM on June 1, 2018:

    This is incorrect. If mapAddressBook doesn't already have an entry for address, an empty has to be created, or the resulting address will be considered change.


    promag commented at 11:28 PM on June 1, 2018:

    Right, funny travis is green.


    yuntai commented at 6:40 AM on June 2, 2018:

    It's green because there is no test case where strPurpose.isEmpty().

    As far as #13087 concerned, I could think of:

    • disallow adding key when it's already in the wallet (so as to allow the user to recreate wallet and import the address again to change label) 'importaddress' already disallow adding an existing address.

    • extend existing rpc commands (import*key) to allow the user update label/purpose (possibly with an additional flag?). not sure how to allow the user to specify an explicit empty label.

    • adding new rpc command for updating label/purpose (and remove)

  9. yuntai commented at 1:28 AM on June 4, 2018: none

    being addressed in #13381

  10. yuntai closed this on Jun 4, 2018

  11. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me