* Mark old keypool keys as used, * and generate all new keys */
| 1233 | * and generate all new keys |
| 1234 | */ |
| 1235 | bool LegacyScriptPubKeyMan::NewKeyPool() |
| 1236 | { |
| 1237 | if (m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { |
| 1238 | return false; |
| 1239 | } |
| 1240 | { |
| 1241 | LOCK(cs_KeyStore); |
| 1242 | WalletBatch batch(m_storage.GetDatabase()); |
| 1243 | |
| 1244 | for (const int64_t nIndex : setInternalKeyPool) { |
| 1245 | batch.ErasePool(nIndex); |
| 1246 | } |
| 1247 | setInternalKeyPool.clear(); |
| 1248 | |
| 1249 | for (const int64_t nIndex : setExternalKeyPool) { |
| 1250 | batch.ErasePool(nIndex); |
| 1251 | } |
| 1252 | setExternalKeyPool.clear(); |
| 1253 | |
| 1254 | for (const int64_t nIndex : set_pre_split_keypool) { |
| 1255 | batch.ErasePool(nIndex); |
| 1256 | } |
| 1257 | set_pre_split_keypool.clear(); |
| 1258 | |
| 1259 | m_pool_key_to_index.clear(); |
| 1260 | |
| 1261 | if (!TopUp()) { |
| 1262 | return false; |
| 1263 | } |
| 1264 | WalletLogPrintf("LegacyScriptPubKeyMan::NewKeyPool rewrote keypool\n"); |
| 1265 | } |
| 1266 | return true; |
| 1267 | } |
| 1268 | |
| 1269 | bool LegacyScriptPubKeyMan::TopUp(unsigned int kpSize) |
| 1270 | { |
no test coverage detected