* Mark old keypool keys as used, * and generate all new keys */
| 3284 | * and generate all new keys |
| 3285 | */ |
| 3286 | bool CWallet::NewKeyPool() |
| 3287 | { |
| 3288 | if (IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { |
| 3289 | return false; |
| 3290 | } |
| 3291 | { |
| 3292 | LOCK(cs_wallet); |
| 3293 | WalletBatch batch(*database); |
| 3294 | |
| 3295 | for (int64_t nIndex : setInternalKeyPool) { |
| 3296 | batch.ErasePool(nIndex); |
| 3297 | } |
| 3298 | setInternalKeyPool.clear(); |
| 3299 | |
| 3300 | for (int64_t nIndex : setExternalKeyPool) { |
| 3301 | batch.ErasePool(nIndex); |
| 3302 | } |
| 3303 | setExternalKeyPool.clear(); |
| 3304 | |
| 3305 | for (int64_t nIndex : set_pre_split_keypool) { |
| 3306 | batch.ErasePool(nIndex); |
| 3307 | } |
| 3308 | set_pre_split_keypool.clear(); |
| 3309 | |
| 3310 | m_pool_key_to_index.clear(); |
| 3311 | |
| 3312 | if (!TopUpKeyPool()) { |
| 3313 | return false; |
| 3314 | } |
| 3315 | WalletLogPrintf("CWallet::NewKeyPool rewrote keypool\n"); |
| 3316 | } |
| 3317 | return true; |
| 3318 | } |
| 3319 | |
| 3320 | size_t CWallet::KeypoolCountExternalKeys() |
| 3321 | { |