bitcoin/bitcoin — pull request #2841 by CodeShark (2013-07-21 04:53:19+00:00)
Title: Added new config option noautofillkeypool.

One of the most annoying things about trying to maintain wallet backups is the fact that every time you unlock a wallet the key pool gets automatically refilled, thus making any existing backups of the wallet obsolete. If you call getnewaddress on a locked wallet, no problem - but call it on an unlocked wallet and your wallet backups are immediately out of date. The user must either keep track of when the backed up keypool is exhausted and remember to make a backup before the new keys are used - or must make a backup after every few transactions to be certain the backed up keypool is never exhausted.

The user now has the choice to disable automatic refilling of the keypool by adding the following line to bitcoin.conf:

noautofillkeypool=1

This effectively disables all automatic key generation, requiring the user to manually run keypoolrefill to replenish the wallet when the key pool runs low. In addition, an optional parameter has been added to keypoolrefill to specify a backup destination so that the keypool can be replenished and the wallet backed up in a single command. This effectively ensures that any wallet backups contain the exact same set of keys - and ensures that if the wallet runs out of backed up keys the user will be prompted to make a new backup. (TODO: Automate backups by, for instance, adding one or more autobackupwallet= to the config file.)

If noautofillkeypool is not set in bitcoin.conf, the app defaults to its old behavior thus ensuring full backwards compatibility.