Browse Source

orphan spaces cleanup ;-)

0.10
Philip Kaufmann 11 years ago
parent
commit
fabba0e6cc
  1. 14
      src/net.cpp
  2. 2
      src/script.cpp
  3. 18
      src/walletdb.cpp

14
src/net.cpp

@ -626,7 +626,7 @@ void CNode::copyStats(CNodeStats &stats)
X(nSendBytes); X(nSendBytes);
X(nRecvBytes); X(nRecvBytes);
stats.fSyncNode = (this == pnodeSync); stats.fSyncNode = (this == pnodeSync);
// It is common for nodes with good ping times to suddenly become lagged, // It is common for nodes with good ping times to suddenly become lagged,
// due to a new block arriving or other large transfer. // due to a new block arriving or other large transfer.
// Merely reporting pingtime might fool the caller into thinking the node was still responsive, // Merely reporting pingtime might fool the caller into thinking the node was still responsive,
@ -637,11 +637,11 @@ void CNode::copyStats(CNodeStats &stats)
if ((0 != nPingNonceSent) && (0 != nPingUsecStart)) { if ((0 != nPingNonceSent) && (0 != nPingUsecStart)) {
nPingUsecWait = GetTimeMicros() - nPingUsecStart; nPingUsecWait = GetTimeMicros() - nPingUsecStart;
} }
// Raw ping time is in microseconds, but show it to user as whole seconds (Bitcoin users should be well used to small numbers with many decimal places by now :) // Raw ping time is in microseconds, but show it to user as whole seconds (Bitcoin users should be well used to small numbers with many decimal places by now :)
stats.dPingTime = (((double)nPingUsecTime) / 1e6); stats.dPingTime = (((double)nPingUsecTime) / 1e6);
stats.dPingWait = (((double)nPingUsecWait) / 1e6); stats.dPingWait = (((double)nPingUsecWait) / 1e6);
// Leave string empty if addrLocal invalid (not filled in yet) // Leave string empty if addrLocal invalid (not filled in yet)
stats.addrLocal = addrLocal.IsValid() ? addrLocal.ToString() : ""; stats.addrLocal = addrLocal.IsValid() ? addrLocal.ToString() : "";
} }
@ -1542,9 +1542,9 @@ void ThreadMessageHandler()
CNode* pnodeTrickle = NULL; CNode* pnodeTrickle = NULL;
if (!vNodesCopy.empty()) if (!vNodesCopy.empty())
pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())]; pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())];
bool fSleep = true; bool fSleep = true;
BOOST_FOREACH(CNode* pnode, vNodesCopy) BOOST_FOREACH(CNode* pnode, vNodesCopy)
{ {
if (pnode->fDisconnect) if (pnode->fDisconnect)
@ -1557,7 +1557,7 @@ void ThreadMessageHandler()
{ {
if (!g_signals.ProcessMessages(pnode)) if (!g_signals.ProcessMessages(pnode))
pnode->CloseSocketDisconnect(); pnode->CloseSocketDisconnect();
if (pnode->nSendSize < SendBufferSize()) if (pnode->nSendSize < SendBufferSize())
{ {
if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete())) if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete()))
@ -1583,7 +1583,7 @@ void ThreadMessageHandler()
BOOST_FOREACH(CNode* pnode, vNodesCopy) BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release(); pnode->Release();
} }
if (fSleep) if (fSleep)
MilliSleep(100); MilliSleep(100);
} }

2
src/script.cpp

@ -1907,7 +1907,7 @@ void CScript::SetMultisig(int nRequired, const std::vector<CPubKey>& keys)
bool CScriptCompressor::IsToKeyID(CKeyID &hash) const bool CScriptCompressor::IsToKeyID(CKeyID &hash) const
{ {
if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160 if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160
&& script[2] == 20 && script[23] == OP_EQUALVERIFY && script[2] == 20 && script[23] == OP_EQUALVERIFY
&& script[24] == OP_CHECKSIG) { && script[24] == OP_CHECKSIG) {
memcpy(&hash, &script[3], 20); memcpy(&hash, &script[3], 20);

18
src/walletdb.cpp

@ -82,8 +82,8 @@ bool CWalletDB::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, c
return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false);
} }
bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey, bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret, const std::vector<unsigned char>& vchCryptedSecret,
const CKeyMetadata &keyMeta) const CKeyMetadata &keyMeta)
{ {
const bool fEraseUnencryptedKey = true; const bool fEraseUnencryptedKey = true;
@ -429,7 +429,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
CKey key; CKey key;
CPrivKey pkey; CPrivKey pkey;
uint256 hash = 0; uint256 hash = 0;
if (strType == "key") if (strType == "key")
{ {
wss.nKeys++; wss.nKeys++;
@ -439,7 +439,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
ssValue >> wkey; ssValue >> wkey;
pkey = wkey.vchPrivKey; pkey = wkey.vchPrivKey;
} }
// Old wallets store keys as "key" [pubkey] => [privkey] // Old wallets store keys as "key" [pubkey] => [privkey]
// ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key // ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key
// using EC operations as a checksum. // using EC operations as a checksum.
@ -450,9 +450,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
ssValue >> hash; ssValue >> hash;
} }
catch(...){} catch(...){}
bool fSkipCheck = false; bool fSkipCheck = false;
if (hash != 0) if (hash != 0)
{ {
// hash pubkey/privkey to accelerate wallet load // hash pubkey/privkey to accelerate wallet load
@ -460,16 +460,16 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
vchKey.reserve(vchPubKey.size() + pkey.size()); vchKey.reserve(vchPubKey.size() + pkey.size());
vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
vchKey.insert(vchKey.end(), pkey.begin(), pkey.end()); vchKey.insert(vchKey.end(), pkey.begin(), pkey.end());
if (Hash(vchKey.begin(), vchKey.end()) != hash) if (Hash(vchKey.begin(), vchKey.end()) != hash)
{ {
strErr = "Error reading wallet database: CPubKey/CPrivKey corrupt"; strErr = "Error reading wallet database: CPubKey/CPrivKey corrupt";
return false; return false;
} }
fSkipCheck = true; fSkipCheck = true;
} }
if (!key.Load(pkey, vchPubKey, fSkipCheck)) if (!key.Load(pkey, vchPubKey, fSkipCheck))
{ {
strErr = "Error reading wallet database: CPrivKey corrupt"; strErr = "Error reading wallet database: CPrivKey corrupt";

Loading…
Cancel
Save