[wallet] importprivkey: explicit rescan for known key #12701

pull kallewoof wants to merge 1 commits into bitcoin:master from kallewoof:importprivkey-explicit-rescan changing 1 files +6 −0
  1. kallewoof commented at 0:51 am on March 16, 2018: member

    If you are importing several private keys into a wallet, you don’t want the rescan to trigger every time, so you might pass rescan=false to importprivkey. If you accidentally do this with the last key as well, you end up having to find a bogus private key to import, just to trigger the rescan process.

    This PR triggers a rescan for already known keys, iff the user passes an explicit true to the rescan argument (i.e. if third argument is not null and fRescan is set).

  2. [wallet] importprivkey: explicit rescan for known key b78477821b
  3. fanquake added the label Wallet on Mar 16, 2018
  4. fanquake added the label RPC/REST/ZMQ on Mar 16, 2018
  5. sipa commented at 0:52 am on March 16, 2018: member
    Can we suggest people use importmulti instead?
  6. kallewoof commented at 0:53 am on March 16, 2018: member

    @sipa Yes, sure, but the same situation applies to one key if the user passes rescan=false and then later changes their mind. (And I didn’t realize importmulti existed until after I screwed up.)

    I guess the alternative is to add a rescan RPC command. Felt overkill though, but maybe better?

  7. sipa commented at 0:54 am on March 16, 2018: member
    @kallewoof Yes, but for importmulti you never need to set rescan=false. It’s both smarter and more selective, and will always rescan the relevant part of the chain only once.
  8. kallewoof commented at 0:56 am on March 16, 2018: member

    @sipa That’s cool, I didn’t realize it was that sophisticated. (And I didn’t realize it existed until I started digging into the code.)

    So… we should probably add a note to importprivkey to use importmulti for more than one key. I’ll make a separate PR for that now…

  9. promag commented at 0:58 am on March 16, 2018: member

    NACK.

    I guess the alternative is to add a rescan RPC command. Felt overkill though, but maybe better?

    There is already rescanblockchain.

    If you are importing several private keys into a wallet, you don’t want the rescan to trigger every time, so you might pass rescan=false to importprivkey

    That was the motivation behind importmulti IIRC.

  10. sipa commented at 1:00 am on March 16, 2018: member
    Also, if really necessary, you can already explicitly trigger a rescan using the rescanblockchain RPC. But in general I think we should encourage importmulti over manually letting users control rescanning - they shouldn’t need to care or know about it in an ideal world.
  11. kallewoof commented at 1:01 am on March 16, 2018: member
    I searched the code for RescanFromTime and couldn’t find anything. Didn’t realize we had rescanblockchain already. Closing.
  12. kallewoof closed this on Mar 16, 2018

  13. kallewoof deleted the branch on Mar 16, 2018
  14. MarcoFalke referenced this in commit dab0d6859b on Apr 4, 2018
  15. PastaPastaPasta referenced this in commit bf172665e6 on Jul 17, 2020
  16. PastaPastaPasta referenced this in commit 9cd642b238 on Jul 17, 2020
  17. PastaPastaPasta referenced this in commit d5a5337e65 on Jul 19, 2020
  18. PastaPastaPasta referenced this in commit 86eff46078 on Jul 21, 2020
  19. gades referenced this in commit a1c22a0b59 on Jul 1, 2021
  20. MarcoFalke 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: 2024-10-06 16:12 UTC

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