Create -keypoolmin, and only top up keypool if size falls below that #294

pull jgarzik wants to merge 1 commits into bitcoin:master from jgarzik:keypool-resize changing 2 files +17 −12
  1. jgarzik commented at 6:34 PM on June 3, 2011: contributor

    Avoid creating a new key -every- time you use a reserve key. Instead, create them in bursts.

    Currently, default is to generate 25 keys (filling keypool up to 100), if keypool size falls below 75.

  2. TheBlueMatt commented at 8:37 PM on June 3, 2011: member

    Not sure if I agree with this. Im not sure if it is useful or not. After walletcrypter, creating new keys can be a bit slow (both created, and encrypted). This means generating 25 in direct succession and blocking until then can generate quite a lag. Walletcrypter will try to generate new addresses every chance it gets, as you have no idea when you will get the password again. Even if you ignore walletcrypter, Im not sure if it is a better idea to lock once per 25 uses or for 1/25th the time on each use.

  3. jgarzik commented at 8:59 PM on June 3, 2011: contributor

    If the feature is disliked, you can set keypoolmin==keypool.

    But there is really no reason we need to top up the key pool every single time we remove one key, and that creates the disadvantage that you -must- backup your wallet every single time.

    Normally, pools are depleted and replenished periodically; there does not seem to be a driving reason to constantly top up the keypool, one-at-a-time.

  4. TheBlueMatt commented at 9:05 PM on June 3, 2011: member

    re 1. True... re 2: No, it is worse for backup, if you backup when you have 76 keys left you might lose coins sent to the 77th, whereas if you backup when you have 76 keys now...well you cant. re 3: True, and I think you are right here, however I'd like to see manual control of keypool topup (its in wallet crypter, but I might pull it into a separate commit if I get the chance). I would rather see the ability, though not required, to be able to top up the keypool and not slow down my transactions. I suppose that leads me to the answer to my original question, IMHO it is better to lag one transaction per 25, instead of 1/25th the amount per transaction.

  5. jgarzik commented at 9:14 PM on June 3, 2011: contributor

    The keypool always uses the oldest key first, on purpose. So your lose-coins scenario doesn't make sense. The keypool is by definition full of unused keys.

    With pool low-water refill, old backups remain valid longer.

  6. TheBlueMatt commented at 9:29 PM on June 3, 2011: member

    My point was that after your patch, if you backup when you have 76 keys left, and you use 77, you might lose coins on restore. However, if you backup when you have 77 keys left now...well you cant as the keypool will always have 100 new keys to use. Thus after your patch, by default, you only have some keypool between 75 and 100, not 100 as it used to be, potentially resulting in lost coins if you assume you can do 100 actions between backup, like you used to be able to do.

  7. jgarzik commented at 9:43 PM on June 3, 2011: contributor

    Absent tilting at windmills, the lone codger who does that can adjust -keypoolmin :)

  8. sipa commented at 1:20 AM on June 4, 2011: member

    Well maybe then keypoolmin should default to 100, and fill up to 125.

  9. TheBlueMatt commented at 10:38 PM on June 4, 2011: member

    Thats what I was thinking. Im not sure what a "good" default keypool is. For a merchant, you would need some ridiculously huge amount for keypool to just last a day. For an end-user, 100 keys could very well last a month, maybe longer. Generating keys does take very little time and spend very little disk space.

  10. Create -keypoolmin, and only top up keypool if size falls below that e784b01f9b
  11. jgarzik commented at 4:05 AM on June 7, 2011: contributor

    Updated to 100/125 (and created named constants for those magic numbers)

  12. gavinandresen commented at 3:51 PM on June 24, 2011: contributor

    I agree with Matt-- I don't see the need for this.

  13. jgarzik commented at 11:35 PM on July 1, 2011: contributor

    oh well :)

  14. jgarzik closed this on Jul 1, 2011

  15. jgarzik deleted the branch on Aug 24, 2014
  16. sipa referenced this in commit 9177950c74 on Oct 21, 2015
  17. sipa referenced this in commit f4787d1caf on Oct 21, 2015
  18. sipa referenced this in commit 6557a8cd46 on Oct 26, 2015
  19. sipa referenced this in commit ea06490d14 on Oct 27, 2015
  20. sipa referenced this in commit 003bb87153 on Nov 5, 2015
  21. sipa referenced this in commit bfd83199c3 on Nov 11, 2015
  22. sipa referenced this in commit b437ea7ec9 on Nov 12, 2015
  23. sipa referenced this in commit 1d84107924 on Nov 12, 2015
  24. jtimon referenced this in commit 91ee21c024 on Mar 11, 2016
  25. rebroad referenced this in commit 40ead34fbe on Dec 7, 2016
  26. deadalnix referenced this in commit 9e9051687c on Jan 19, 2017
  27. ptschip referenced this in commit 7ad174f607 on Feb 15, 2017
  28. CodeShark referenced this in commit 9b08552c25 on May 4, 2017
  29. lateminer referenced this in commit 30aa79a8ef on Oct 16, 2019
  30. cryptapus referenced this in commit d309dd406f on May 3, 2021
  31. rajarshimaitra referenced this in commit 1db4e55110 on Aug 5, 2021
  32. 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-20 00:16 UTC

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