mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
CWallet::TopUpKeyPool() takes optional pool size argument
Also, GetKeyPoolSize() now returns an accurate type, unsigned int.
This commit is contained in:
parent
481d899794
commit
13dd2d090e
3 changed files with 10 additions and 5 deletions
|
@ -81,7 +81,7 @@ Value getinfo(const Array& params, bool fHelp)
|
||||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||||
obj.push_back(Pair("testnet", TestNet()));
|
obj.push_back(Pair("testnet", TestNet()));
|
||||||
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
|
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
|
||||||
obj.push_back(Pair("keypoolsize", pwalletMain->GetKeyPoolSize()));
|
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||||
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
|
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
|
||||||
if (pwalletMain->IsCrypted())
|
if (pwalletMain->IsCrypted())
|
||||||
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
|
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ bool CWallet::NewKeyPool()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::TopUpKeyPool()
|
bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
|
@ -1564,7 +1564,12 @@ bool CWallet::TopUpKeyPool()
|
||||||
CWalletDB walletdb(strWalletFile);
|
CWalletDB walletdb(strWalletFile);
|
||||||
|
|
||||||
// Top up key pool
|
// Top up key pool
|
||||||
unsigned int nTargetSize = max(GetArg("-keypool", 100), 0LL);
|
unsigned int nTargetSize;
|
||||||
|
if (kpSize > 0)
|
||||||
|
nTargetSize = kpSize;
|
||||||
|
else
|
||||||
|
nTargetSize = max(GetArg("-keypool", 100), 0LL);
|
||||||
|
|
||||||
while (setKeyPool.size() < (nTargetSize + 1))
|
while (setKeyPool.size() < (nTargetSize + 1))
|
||||||
{
|
{
|
||||||
int64 nEnd = 1;
|
int64 nEnd = 1;
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
|
std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
|
||||||
|
|
||||||
bool NewKeyPool();
|
bool NewKeyPool();
|
||||||
bool TopUpKeyPool();
|
bool TopUpKeyPool(unsigned int kpSize = 0);
|
||||||
int64 AddReserveKey(const CKeyPool& keypool);
|
int64 AddReserveKey(const CKeyPool& keypool);
|
||||||
void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
|
void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
|
||||||
void KeepKey(int64 nIndex);
|
void KeepKey(int64 nIndex);
|
||||||
|
@ -292,7 +292,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetKeyPoolSize()
|
unsigned int GetKeyPoolSize()
|
||||||
{
|
{
|
||||||
return setKeyPool.size();
|
return setKeyPool.size();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue