Merge pull request #3735 from laanwj/2014_02_remove_PRIx64_completely
Remove PRIx64 usage completely
This commit is contained in:
commit
e3e65d29b7
14 changed files with 39 additions and 47 deletions
|
@ -51,8 +51,8 @@ std::string CUnsignedAlert::ToString() const
|
||||||
return strprintf(
|
return strprintf(
|
||||||
"CAlert(\n"
|
"CAlert(\n"
|
||||||
" nVersion = %d\n"
|
" nVersion = %d\n"
|
||||||
" nRelayUntil = %"PRId64"\n"
|
" nRelayUntil = %d\n"
|
||||||
" nExpiration = %"PRId64"\n"
|
" nExpiration = %d\n"
|
||||||
" nID = %d\n"
|
" nID = %d\n"
|
||||||
" nCancel = %d\n"
|
" nCancel = %d\n"
|
||||||
" setCancel = %s\n"
|
" setCancel = %s\n"
|
||||||
|
|
|
@ -64,7 +64,7 @@ uint256 CTxOut::GetHash() const
|
||||||
|
|
||||||
std::string CTxOut::ToString() const
|
std::string CTxOut::ToString() const
|
||||||
{
|
{
|
||||||
return strprintf("CTxOut(nValue=%"PRId64".%08"PRId64", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30));
|
return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTxOut::print() const
|
void CTxOut::print() const
|
||||||
|
|
|
@ -463,7 +463,7 @@ void CDBEnv::Flush(bool fShutdown)
|
||||||
else
|
else
|
||||||
mi++;
|
mi++;
|
||||||
}
|
}
|
||||||
LogPrint("db", "DBFlush(%s)%s ended %15"PRId64"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
|
LogPrint("db", "DBFlush(%s)%s ended %15dms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
|
||||||
if (fShutdown)
|
if (fShutdown)
|
||||||
{
|
{
|
||||||
char** listp;
|
char** listp;
|
||||||
|
|
10
src/init.cpp
10
src/init.cpp
|
@ -599,7 +599,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||||
{
|
{
|
||||||
// try moving the database env out of the way
|
// try moving the database env out of the way
|
||||||
boost::filesystem::path pathDatabase = GetDataDir() / "database";
|
boost::filesystem::path pathDatabase = GetDataDir() / "database";
|
||||||
boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%"PRId64".bak", GetTime());
|
boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%d.bak", GetTime());
|
||||||
try {
|
try {
|
||||||
boost::filesystem::rename(pathDatabase, pathDatabaseBak);
|
boost::filesystem::rename(pathDatabase, pathDatabaseBak);
|
||||||
LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string());
|
LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string());
|
||||||
|
@ -874,7 +874,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||||
LogPrintf("Shutdown requested. Exiting.\n");
|
LogPrintf("Shutdown requested. Exiting.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LogPrintf(" block index %15"PRId64"ms\n", GetTimeMillis() - nStart);
|
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
|
||||||
|
|
||||||
if (GetBoolArg("-printblockindex", false) || GetBoolArg("-printblocktree", false))
|
if (GetBoolArg("-printblockindex", false) || GetBoolArg("-printblocktree", false))
|
||||||
{
|
{
|
||||||
|
@ -985,7 +985,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrintf("%s", strErrors.str());
|
LogPrintf("%s", strErrors.str());
|
||||||
LogPrintf(" wallet %15"PRId64"ms\n", GetTimeMillis() - nStart);
|
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart);
|
||||||
|
|
||||||
RegisterWallet(pwalletMain);
|
RegisterWallet(pwalletMain);
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||||
LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height() - pindexRescan->nHeight, pindexRescan->nHeight);
|
LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height() - pindexRescan->nHeight, pindexRescan->nHeight);
|
||||||
nStart = GetTimeMillis();
|
nStart = GetTimeMillis();
|
||||||
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
|
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
|
||||||
LogPrintf(" rescan %15"PRId64"ms\n", GetTimeMillis() - nStart);
|
LogPrintf(" rescan %15dms\n", GetTimeMillis() - nStart);
|
||||||
pwalletMain->SetBestChain(chainActive.GetLocator());
|
pwalletMain->SetBestChain(chainActive.GetLocator());
|
||||||
nWalletDBUpdated++;
|
nWalletDBUpdated++;
|
||||||
}
|
}
|
||||||
|
@ -1042,7 +1042,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||||
LogPrintf("Invalid or missing peers.dat; recreating\n");
|
LogPrintf("Invalid or missing peers.dat; recreating\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrintf("Loaded %i addresses from peers.dat %"PRId64"ms\n",
|
LogPrintf("Loaded %i addresses from peers.dat %dms\n",
|
||||||
addrman.size(), GetTimeMillis() - nStart);
|
addrman.size(), GetTimeMillis() - nStart);
|
||||||
|
|
||||||
// ********************************************************* Step 11: start node
|
// ********************************************************* Step 11: start node
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -822,7 +822,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||||
// Don't accept it if it can't get into a block
|
// Don't accept it if it can't get into a block
|
||||||
int64_t txMinFee = GetMinFee(tx, nSize, true, GMF_RELAY);
|
int64_t txMinFee = GetMinFee(tx, nSize, true, GMF_RELAY);
|
||||||
if (fLimitFree && nFees < txMinFee)
|
if (fLimitFree && nFees < txMinFee)
|
||||||
return state.DoS(0, error("AcceptToMemoryPool : not enough fees %s, %"PRId64" < %"PRId64,
|
return state.DoS(0, error("AcceptToMemoryPool : not enough fees %s, %d < %d",
|
||||||
hash.ToString(), nFees, txMinFee),
|
hash.ToString(), nFees, txMinFee),
|
||||||
REJECT_INSUFFICIENTFEE, "insufficient fee");
|
REJECT_INSUFFICIENTFEE, "insufficient fee");
|
||||||
|
|
||||||
|
@ -851,7 +851,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 10000)
|
if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 10000)
|
||||||
return error("AcceptToMemoryPool: : insane fees %s, %"PRId64" > %"PRId64,
|
return error("AcceptToMemoryPool: : insane fees %s, %d > %d",
|
||||||
hash.ToString(),
|
hash.ToString(),
|
||||||
nFees, CTransaction::nMinRelayTxFee * 10000);
|
nFees, CTransaction::nMinRelayTxFee * 10000);
|
||||||
|
|
||||||
|
@ -1168,7 +1168,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||||
|
|
||||||
// Limit adjustment step
|
// Limit adjustment step
|
||||||
int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
|
int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
|
||||||
LogPrintf(" nActualTimespan = %"PRId64" before bounds\n", nActualTimespan);
|
LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);
|
||||||
if (nActualTimespan < nTargetTimespan/4)
|
if (nActualTimespan < nTargetTimespan/4)
|
||||||
nActualTimespan = nTargetTimespan/4;
|
nActualTimespan = nTargetTimespan/4;
|
||||||
if (nActualTimespan > nTargetTimespan*4)
|
if (nActualTimespan > nTargetTimespan*4)
|
||||||
|
@ -1185,7 +1185,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||||
|
|
||||||
/// debug print
|
/// debug print
|
||||||
LogPrintf("GetNextWorkRequired RETARGET\n");
|
LogPrintf("GetNextWorkRequired RETARGET\n");
|
||||||
LogPrintf("nTargetTimespan = %"PRId64" nActualTimespan = %"PRId64"\n", nTargetTimespan, nActualTimespan);
|
LogPrintf("nTargetTimespan = %d nActualTimespan = %d\n", nTargetTimespan, nActualTimespan);
|
||||||
LogPrintf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString());
|
LogPrintf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString());
|
||||||
LogPrintf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString());
|
LogPrintf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString());
|
||||||
|
|
||||||
|
@ -1737,7 +1737,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
|
||||||
|
|
||||||
if (block.vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
|
if (block.vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
|
||||||
return state.DoS(100,
|
return state.DoS(100,
|
||||||
error("ConnectBlock() : coinbase pays too much (actual=%"PRId64" vs limit=%"PRId64")",
|
error("ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)",
|
||||||
block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees)),
|
block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees)),
|
||||||
REJECT_INVALID, "bad-cb-amount");
|
REJECT_INVALID, "bad-cb-amount");
|
||||||
|
|
||||||
|
@ -3014,7 +3014,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
|
||||||
AbortNode(_("Error: system error: ") + e.what());
|
AbortNode(_("Error: system error: ") + e.what());
|
||||||
}
|
}
|
||||||
if (nLoaded > 0)
|
if (nLoaded > 0)
|
||||||
LogPrintf("Loaded %i blocks from external file in %"PRId64"ms\n", nLoaded, GetTimeMillis() - nStart);
|
LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, GetTimeMillis() - nStart);
|
||||||
return nLoaded > 0;
|
return nLoaded > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3804,7 +3804,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sProblem.empty())) {
|
if (!(sProblem.empty())) {
|
||||||
LogPrint("net", "pong %s %s: %s, %"PRIx64" expected, %"PRIx64" received, %"PRIszu" bytes\n",
|
LogPrint("net", "pong %s %s: %s, %x expected, %x received, %"PRIszu" bytes\n",
|
||||||
pfrom->addr.ToString(),
|
pfrom->addr.ToString(),
|
||||||
pfrom->cleanSubVer,
|
pfrom->cleanSubVer,
|
||||||
sProblem,
|
sProblem,
|
||||||
|
|
|
@ -319,7 +319,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||||
|
|
||||||
nLastBlockTx = nBlockTx;
|
nLastBlockTx = nBlockTx;
|
||||||
nLastBlockSize = nBlockSize;
|
nLastBlockSize = nBlockSize;
|
||||||
LogPrintf("CreateNewBlock(): total size %"PRIu64"\n", nBlockSize);
|
LogPrintf("CreateNewBlock(): total size %u\n", nBlockSize);
|
||||||
|
|
||||||
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
|
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
|
||||||
pblocktemplate->vTxFees[0] = -nFees;
|
pblocktemplate->vTxFees[0] = -nFees;
|
||||||
|
|
|
@ -1243,7 +1243,7 @@ void DumpAddresses()
|
||||||
CAddrDB adb;
|
CAddrDB adb;
|
||||||
adb.Write(addrman);
|
adb.Write(addrman);
|
||||||
|
|
||||||
LogPrint("net", "Flushed %d addresses to peers.dat %"PRId64"ms\n",
|
LogPrint("net", "Flushed %d addresses to peers.dat %dms\n",
|
||||||
addrman.size(), GetTimeMillis() - nStart);
|
addrman.size(), GetTimeMillis() - nStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -423,7 +423,7 @@ public:
|
||||||
nRequestTime = it->second;
|
nRequestTime = it->second;
|
||||||
else
|
else
|
||||||
nRequestTime = 0;
|
nRequestTime = 0;
|
||||||
LogPrint("net", "askfor %s %"PRId64" (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str());
|
LogPrint("net", "askfor %s %d (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str());
|
||||||
|
|
||||||
// Make sure not to reuse time indexes to keep things in the same order
|
// Make sure not to reuse time indexes to keep things in the same order
|
||||||
int64_t nNow = (GetTime() - 1) * 1000000;
|
int64_t nNow = (GetTime() - 1) * 1000000;
|
||||||
|
|
|
@ -119,7 +119,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
|
||||||
obj.push_back(Pair("addr", stats.addrName));
|
obj.push_back(Pair("addr", stats.addrName));
|
||||||
if (!(stats.addrLocal.empty()))
|
if (!(stats.addrLocal.empty()))
|
||||||
obj.push_back(Pair("addrlocal", stats.addrLocal));
|
obj.push_back(Pair("addrlocal", stats.addrLocal));
|
||||||
obj.push_back(Pair("services", strprintf("%08"PRIx64, stats.nServices)));
|
obj.push_back(Pair("services", strprintf("%08x", stats.nServices)));
|
||||||
obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend));
|
obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend));
|
||||||
obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv));
|
obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv));
|
||||||
obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes));
|
obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes));
|
||||||
|
|
|
@ -311,9 +311,9 @@ BOOST_AUTO_TEST_CASE(strprintf_numbers)
|
||||||
{
|
{
|
||||||
int64_t s64t = -9223372036854775807LL; /* signed 64 bit test value */
|
int64_t s64t = -9223372036854775807LL; /* signed 64 bit test value */
|
||||||
uint64_t u64t = 18446744073709551615ULL; /* unsigned 64 bit test value */
|
uint64_t u64t = 18446744073709551615ULL; /* unsigned 64 bit test value */
|
||||||
BOOST_CHECK(strprintf("%s %"PRId64" %s", B, s64t, E) == B" -9223372036854775807 "E);
|
BOOST_CHECK(strprintf("%s %d %s", B, s64t, E) == B" -9223372036854775807 "E);
|
||||||
BOOST_CHECK(strprintf("%s %"PRIu64" %s", B, u64t, E) == B" 18446744073709551615 "E);
|
BOOST_CHECK(strprintf("%s %u %s", B, u64t, E) == B" 18446744073709551615 "E);
|
||||||
BOOST_CHECK(strprintf("%s %"PRIx64" %s", B, u64t, E) == B" ffffffffffffffff "E);
|
BOOST_CHECK(strprintf("%s %x %s", B, u64t, E) == B" ffffffffffffffff "E);
|
||||||
|
|
||||||
size_t st = 12345678; /* unsigned size_t test value */
|
size_t st = 12345678; /* unsigned size_t test value */
|
||||||
ssize_t sst = -12345678; /* signed size_t test value */
|
ssize_t sst = -12345678; /* signed size_t test value */
|
||||||
|
|
|
@ -330,7 +330,7 @@ string FormatMoney(int64_t n, bool fPlus)
|
||||||
int64_t n_abs = (n > 0 ? n : -n);
|
int64_t n_abs = (n > 0 ? n : -n);
|
||||||
int64_t quotient = n_abs/COIN;
|
int64_t quotient = n_abs/COIN;
|
||||||
int64_t remainder = n_abs%COIN;
|
int64_t remainder = n_abs%COIN;
|
||||||
string str = strprintf("%"PRId64".%08"PRId64, quotient, remainder);
|
string str = strprintf("%d.%08d", quotient, remainder);
|
||||||
|
|
||||||
// Right-trim excess zeros before the decimal point:
|
// Right-trim excess zeros before the decimal point:
|
||||||
int nTrim = 0;
|
int nTrim = 0;
|
||||||
|
@ -1278,7 +1278,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nTime)
|
||||||
// Add data
|
// Add data
|
||||||
static CMedianFilter<int64_t> vTimeOffsets(200,0);
|
static CMedianFilter<int64_t> vTimeOffsets(200,0);
|
||||||
vTimeOffsets.input(nOffsetSample);
|
vTimeOffsets.input(nOffsetSample);
|
||||||
LogPrintf("Added time data, samples %d, offset %+"PRId64" (%+"PRId64" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
|
LogPrintf("Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
|
||||||
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
|
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
|
||||||
{
|
{
|
||||||
int64_t nMedian = vTimeOffsets.median();
|
int64_t nMedian = vTimeOffsets.median();
|
||||||
|
@ -1313,10 +1313,10 @@ void AddTimeData(const CNetAddr& ip, int64_t nTime)
|
||||||
}
|
}
|
||||||
if (fDebug) {
|
if (fDebug) {
|
||||||
BOOST_FOREACH(int64_t n, vSorted)
|
BOOST_FOREACH(int64_t n, vSorted)
|
||||||
LogPrintf("%+"PRId64" ", n);
|
LogPrintf("%+d ", n);
|
||||||
LogPrintf("| ");
|
LogPrintf("| ");
|
||||||
}
|
}
|
||||||
LogPrintf("nTimeOffset = %+"PRId64" (%+"PRId64" minutes)\n", nTimeOffset, nTimeOffset/60);
|
LogPrintf("nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/util.h
16
src/util.h
|
@ -44,15 +44,10 @@ static const int64_t CENT = 1000000;
|
||||||
#define UEND(a) ((unsigned char*)&((&(a))[1]))
|
#define UEND(a) ((unsigned char*)&((&(a))[1]))
|
||||||
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
|
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
|
||||||
|
|
||||||
/* Format characters for (s)size_t, ptrdiff_t, uint64_t.
|
/* Format characters for (s)size_t, ptrdiff_t.
|
||||||
*
|
*
|
||||||
* As the tinyformat-based formatting system is type-safe, no special format
|
* Define these as empty as the tinyformat-based formatting system is
|
||||||
* characters are really needed to specify sizes. Tinyformat can support
|
* type-safe, no special format characters are needed to specify sizes.
|
||||||
* (ignores) the C99 prefixes such as "ll" but chokes on MSVC's inttypes
|
|
||||||
* defines prefixes such as "I64X". So don't include inttypes.h and define our
|
|
||||||
* own for compatibility.
|
|
||||||
* If you get a warning here about a redefine of PRI?64, make sure that
|
|
||||||
* inttypes.h is not included.
|
|
||||||
*/
|
*/
|
||||||
#define PRIszx "x"
|
#define PRIszx "x"
|
||||||
#define PRIszu "u"
|
#define PRIszu "u"
|
||||||
|
@ -60,9 +55,6 @@ static const int64_t CENT = 1000000;
|
||||||
#define PRIpdx "x"
|
#define PRIpdx "x"
|
||||||
#define PRIpdu "u"
|
#define PRIpdu "u"
|
||||||
#define PRIpdd "d"
|
#define PRIpdd "d"
|
||||||
#define PRIx64 "x"
|
|
||||||
#define PRIu64 "u"
|
|
||||||
#define PRId64 "d"
|
|
||||||
|
|
||||||
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
|
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
|
||||||
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
|
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
|
||||||
|
@ -234,7 +226,7 @@ void runCommand(std::string strCommand);
|
||||||
|
|
||||||
inline std::string i64tostr(int64_t n)
|
inline std::string i64tostr(int64_t n)
|
||||||
{
|
{
|
||||||
return strprintf("%"PRId64, n);
|
return strprintf("%d", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string itostr(int n)
|
inline std::string itostr(int n)
|
||||||
|
|
|
@ -1698,7 +1698,7 @@ bool CWallet::NewKeyPool()
|
||||||
walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey()));
|
walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey()));
|
||||||
setKeyPool.insert(nIndex);
|
setKeyPool.insert(nIndex);
|
||||||
}
|
}
|
||||||
LogPrintf("CWallet::NewKeyPool wrote %"PRId64" new keys\n", nKeys);
|
LogPrintf("CWallet::NewKeyPool wrote %d new keys\n", nKeys);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1728,7 +1728,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
||||||
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
|
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
|
||||||
throw runtime_error("TopUpKeyPool() : writing generated key failed");
|
throw runtime_error("TopUpKeyPool() : writing generated key failed");
|
||||||
setKeyPool.insert(nEnd);
|
setKeyPool.insert(nEnd);
|
||||||
LogPrintf("keypool added key %"PRId64", size=%"PRIszu"\n", nEnd, setKeyPool.size());
|
LogPrintf("keypool added key %d, size=%"PRIszu"\n", nEnd, setKeyPool.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1757,7 +1757,7 @@ void CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool)
|
||||||
if (!HaveKey(keypool.vchPubKey.GetID()))
|
if (!HaveKey(keypool.vchPubKey.GetID()))
|
||||||
throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool");
|
throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool");
|
||||||
assert(keypool.vchPubKey.IsValid());
|
assert(keypool.vchPubKey.IsValid());
|
||||||
LogPrintf("keypool reserve %"PRId64"\n", nIndex);
|
LogPrintf("keypool reserve %d\n", nIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1784,7 +1784,7 @@ void CWallet::KeepKey(int64_t nIndex)
|
||||||
CWalletDB walletdb(strWalletFile);
|
CWalletDB walletdb(strWalletFile);
|
||||||
walletdb.ErasePool(nIndex);
|
walletdb.ErasePool(nIndex);
|
||||||
}
|
}
|
||||||
LogPrintf("keypool keep %"PRId64"\n", nIndex);
|
LogPrintf("keypool keep %d\n", nIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::ReturnKey(int64_t nIndex)
|
void CWallet::ReturnKey(int64_t nIndex)
|
||||||
|
@ -1794,7 +1794,7 @@ void CWallet::ReturnKey(int64_t nIndex)
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
setKeyPool.insert(nIndex);
|
setKeyPool.insert(nIndex);
|
||||||
}
|
}
|
||||||
LogPrintf("keypool return %"PRId64"\n", nIndex);
|
LogPrintf("keypool return %d\n", nIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::GetKeyFromPool(CPubKey& result)
|
bool CWallet::GetKeyFromPool(CPubKey& result)
|
||||||
|
|
|
@ -383,7 +383,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||||
pwallet->AddToWallet(wtx, true);
|
pwallet->AddToWallet(wtx, true);
|
||||||
//// debug print
|
//// debug print
|
||||||
//LogPrintf("LoadWallet %s\n", wtx.GetHash().ToString());
|
//LogPrintf("LoadWallet %s\n", wtx.GetHash().ToString());
|
||||||
//LogPrintf(" %12"PRId64" %s %s %s\n",
|
//LogPrintf(" %12d %s %s %s\n",
|
||||||
// wtx.vout[0].nValue,
|
// wtx.vout[0].nValue,
|
||||||
// DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()),
|
// DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()),
|
||||||
// wtx.hashBlock.ToString(),
|
// wtx.hashBlock.ToString(),
|
||||||
|
@ -816,7 +816,7 @@ void ThreadFlushWalletDB(const string& strFile)
|
||||||
bitdb.CheckpointLSN(strFile);
|
bitdb.CheckpointLSN(strFile);
|
||||||
|
|
||||||
bitdb.mapFileUseCount.erase(mi++);
|
bitdb.mapFileUseCount.erase(mi++);
|
||||||
LogPrint("db", "Flushed wallet.dat %"PRId64"ms\n", GetTimeMillis() - nStart);
|
LogPrint("db", "Flushed wallet.dat %dms\n", GetTimeMillis() - nStart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
|
||||||
// Set -rescan so any missing transactions will be
|
// Set -rescan so any missing transactions will be
|
||||||
// found.
|
// found.
|
||||||
int64_t now = GetTime();
|
int64_t now = GetTime();
|
||||||
std::string newFilename = strprintf("wallet.%"PRId64".bak", now);
|
std::string newFilename = strprintf("wallet.%d.bak", now);
|
||||||
|
|
||||||
int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL,
|
int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL,
|
||||||
newFilename.c_str(), DB_AUTO_COMMIT);
|
newFilename.c_str(), DB_AUTO_COMMIT);
|
||||||
|
|
Loading…
Reference in a new issue