You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/wallet/scriptpubkeyman.cpp
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -333,7 +333,8 @@ bool LegacyScriptPubKeyMan::TopUpInactiveHDChain(const CKeyID seed_id, int64_t i
333
333
chain.m_next_external_index = std::max(chain.m_next_external_index, index + 1);
334
334
}
335
335
336
-
TopUpChain(chain, 0);
336
+
WalletBatch batch(m_storage.GetDatabase());
337
+
TopUpChain(batch, chain, 0);
337
338
338
339
returntrue;
339
340
}
@@ -1274,19 +1275,22 @@ bool LegacyScriptPubKeyMan::TopUp(unsigned int kpSize)
1274
1275
returnfalse;
1275
1276
}
1276
1277
1277
-
if (!TopUpChain(m_hd_chain, kpSize)) {
1278
+
WalletBatch batch(m_storage.GetDatabase());
1279
+
if (!batch.TxnBegin()) returnfalse;
1280
+
if (!TopUpChain(batch, m_hd_chain, kpSize)) {
1278
1281
returnfalse;
1279
1282
}
1280
1283
for (auto& [chain_id, chain] : m_inactive_hd_chains) {
1281
-
if (!TopUpChain(chain, kpSize)) {
1284
+
if (!TopUpChain(batch, chain, kpSize)) {
1282
1285
returnfalse;
1283
1286
}
1284
1287
}
1288
+
if (!batch.TxnCommit()) throwstd::runtime_error(strprintf("Error during keypool top up. Cannot commit changes for wallet %s", m_storage.GetDisplayName()));
0 commit comments