Skip to content

Commit 8680d3a

Browse files
committed
Move wallet initialization logic from AppInit2 to CWallet::InitLoadWallet
1 parent e86eb71 commit 8680d3a

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/init.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,15 +1438,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
14381438
//// debug print
14391439
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
14401440
LogPrintf("nBestHeight = %d\n", chainActive.Height());
1441-
#ifdef ENABLE_WALLET
1442-
if (pwalletMain) {
1443-
LOCK(pwalletMain->cs_wallet);
1444-
LogPrintf("setKeyPool.size() = %u\n", pwalletMain->GetKeyPoolSize());
1445-
LogPrintf("mapWallet.size() = %u\n", pwalletMain->mapWallet.size());
1446-
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain->mapAddressBook.size());
1447-
}
1448-
#endif
1449-
14501441
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
14511442
StartTorControl(threadGroup, scheduler);
14521443

@@ -1459,9 +1450,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
14591450

14601451
#ifdef ENABLE_WALLET
14611452
if (pwalletMain) {
1462-
// Add wallet transactions that aren't already in a block to mapTransactions
1463-
pwalletMain->ReacceptWalletTransactions();
1464-
14651453
// Run a thread to flush wallet periodically
14661454
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
14671455
}

src/wallet/wallet.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,7 +3411,17 @@ bool CWallet::InitLoadWallet()
34113411
}
34123412
walletInstance->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
34133413

3414+
{
3415+
LOCK(walletInstance->cs_wallet);
3416+
LogPrintf("setKeyPool.size() = %u\n", walletInstance->GetKeyPoolSize());
3417+
LogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
3418+
LogPrintf("mapAddressBook.size() = %u\n", walletInstance->mapAddressBook.size());
3419+
}
3420+
// Add wallet transactions that aren't already in a block to mapTransactions
3421+
walletInstance->ReacceptWalletTransactions();
3422+
34143423
pwalletMain = walletInstance;
3424+
34153425
return true;
34163426
}
34173427

0 commit comments

Comments
 (0)