mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-18 02:51:06 +00:00
Merge #8445: Move CWallet::setKeyPool to private section of CWallet.
8680d3a Move wallet initialization logic from AppInit2 to CWallet::InitLoadWallet (Patrick Strateman) e86eb71 Move CWallet::setKeyPool to private section of CWallet (Patrick Strateman)
This commit is contained in:
commit
f9167003d9
@ -1494,12 +1494,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
//// debug print
|
//// debug print
|
||||||
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
|
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
|
||||||
LogPrintf("nBestHeight = %d\n", chainActive.Height());
|
LogPrintf("nBestHeight = %d\n", chainActive.Height());
|
||||||
#ifdef ENABLE_WALLET
|
|
||||||
LogPrintf("setKeyPool.size() = %u\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
|
|
||||||
LogPrintf("mapWallet.size() = %u\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
|
|
||||||
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
|
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
|
||||||
StartTorControl(threadGroup, scheduler);
|
StartTorControl(threadGroup, scheduler);
|
||||||
|
|
||||||
@ -1512,9 +1506,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (pwalletMain) {
|
if (pwalletMain) {
|
||||||
// Add wallet transactions that aren't already in a block to mapTransactions
|
|
||||||
pwalletMain->ReacceptWalletTransactions();
|
|
||||||
|
|
||||||
// Run a thread to flush wallet periodically
|
// Run a thread to flush wallet periodically
|
||||||
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
|
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
|
||||||
}
|
}
|
||||||
|
@ -3416,7 +3416,17 @@ bool CWallet::InitLoadWallet()
|
|||||||
}
|
}
|
||||||
walletInstance->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
|
walletInstance->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
|
||||||
|
|
||||||
|
{
|
||||||
|
LOCK(walletInstance->cs_wallet);
|
||||||
|
LogPrintf("setKeyPool.size() = %u\n", walletInstance->GetKeyPoolSize());
|
||||||
|
LogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
|
||||||
|
LogPrintf("mapAddressBook.size() = %u\n", walletInstance->mapAddressBook.size());
|
||||||
|
}
|
||||||
|
// Add wallet transactions that aren't already in a block to mapTransactions
|
||||||
|
walletInstance->ReacceptWalletTransactions();
|
||||||
|
|
||||||
pwalletMain = walletInstance;
|
pwalletMain = walletInstance;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,6 +582,8 @@ private:
|
|||||||
CHDChain hdChain;
|
CHDChain hdChain;
|
||||||
|
|
||||||
bool fFileBacked;
|
bool fFileBacked;
|
||||||
|
|
||||||
|
std::set<int64_t> setKeyPool;
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
* Main wallet lock.
|
* Main wallet lock.
|
||||||
@ -594,7 +596,18 @@ public:
|
|||||||
|
|
||||||
std::string strWalletFile;
|
std::string strWalletFile;
|
||||||
|
|
||||||
std::set<int64_t> setKeyPool;
|
void LoadKeyPool(int nIndex, const CKeyPool &keypool)
|
||||||
|
{
|
||||||
|
setKeyPool.insert(nIndex);
|
||||||
|
|
||||||
|
// If no metadata exists yet, create a default with the pool key's
|
||||||
|
// creation time. Note that this may be overwritten by actually
|
||||||
|
// stored metadata for that key later, which is fine.
|
||||||
|
CKeyID keyid = keypool.vchPubKey.GetID();
|
||||||
|
if (mapKeyMetadata.count(keyid) == 0)
|
||||||
|
mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
|
||||||
|
}
|
||||||
|
|
||||||
std::map<CKeyID, CKeyMetadata> mapKeyMetadata;
|
std::map<CKeyID, CKeyMetadata> mapKeyMetadata;
|
||||||
|
|
||||||
typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
|
typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
|
||||||
|
@ -556,14 +556,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
ssKey >> nIndex;
|
ssKey >> nIndex;
|
||||||
CKeyPool keypool;
|
CKeyPool keypool;
|
||||||
ssValue >> keypool;
|
ssValue >> keypool;
|
||||||
pwallet->setKeyPool.insert(nIndex);
|
|
||||||
|
|
||||||
// If no metadata exists yet, create a default with the pool key's
|
pwallet->LoadKeyPool(nIndex, keypool);
|
||||||
// creation time. Note that this may be overwritten by actually
|
|
||||||
// stored metadata for that key later, which is fine.
|
|
||||||
CKeyID keyid = keypool.vchPubKey.GetID();
|
|
||||||
if (pwallet->mapKeyMetadata.count(keyid) == 0)
|
|
||||||
pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
|
|
||||||
}
|
}
|
||||||
else if (strType == "version")
|
else if (strType == "version")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user