<p>If the key pool is empty and the wallet is locked it will use an old key instead of generating a new key. When wallet encryption was implemented the block creation code was changed to make sure different coinbase transactions are generated in that case.</p>

CC BY-SA 3.0
2012-01-27T02:16:44.337Z
2012-01-27T02:16:44.337Z
gavinandresen
<p>Say someone wanted to be evil to the main client and set its wallet to contain one key, lock it, and then start mining. After the first block was generated, the client would traditionally create a new key to use for mining and store it in a wallet. However, as it doesn't have the password in memory, it can't encode the key. How would the client respond in this situation? Use an old key for generation, store the key unencrypted, or do something entirely different?</p>

CC BY-SA 3.0
2012-01-25T08:08:59.703Z
Why the close vote?
ripper234
CC BY-SA 3.0
2012-01-25T10:54:45.093Z
Not to mention a downvote. Everyone, please, if you do either, leave a comment, otherwise we can't improve ourselves.
ThePiachu
<wallet><bitcoin-core><bitcoind><encryption><keypool>
What happens when an encrypted wallet runs out of keys?
ThePiachu
# What happens when an encrypted wallet runs out of keys?

(Asked by: username_0 on 2012-01-24)

Say someone wanted to be evil to the main client and set its wallet to contain one key, lock it, and then start mining. After the first block was generated, the client would traditionally create a new key to use for mining and store it in a wallet. However, as it doesn't have the password in memory, it can't encode the key. How would the client respond in this situation? Use an old key for generation, store the key unencrypted, or do something entirely different?

**Tags:** wallet, bitcoin-core, bitcoind, encryption, keypool

> **Comments:**
> **username_1**: Why the close vote?  
> **username_0**: Not to mention a downvote. Everyone, please, if you do either, leave a comment, otherwise we can't improve ourselves.  

---

## 1 answers

### Answer by username_2 on 2012-01-27. Score: 6 | Accepted answer

If the key pool is empty and the wallet is locked it will use an old key instead of generating a new key. When wallet encryption was implemented the block creation code was changed to make sure different coinbase transactions are generated in that case.


---

