MCPcopy Create free account
hub / github.com/ElementsProject/elements / NewKeyPool

Method NewKeyPool

src/wallet/scriptpubkeyman.cpp:1235–1267  ·  view source on GitHub ↗

* Mark old keypool keys as used, * and generate all new keys */

Source from the content-addressed store, hash-verified

1233 * and generate all new keys
1234 */
1235bool 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
1269bool LegacyScriptPubKeyMan::TopUp(unsigned int kpSize)
1270{

Callers 2

newkeypoolFunction · 0.80
sethdseedFunction · 0.80

Calls 3

IsWalletFlagSetMethod · 0.80
ErasePoolMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected