From fabba0e6cc08af2b6ff651c5f16b55ffbee9c45b Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 15 Nov 2013 12:24:34 +0100 Subject: [PATCH] orphan spaces cleanup ;-) --- src/net.cpp | 14 +++++++------- src/script.cpp | 2 +- src/walletdb.cpp | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 954fe5947ca..59982b40662 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -626,7 +626,7 @@ void CNode::copyStats(CNodeStats &stats) X(nSendBytes); X(nRecvBytes); stats.fSyncNode = (this == pnodeSync); - + // It is common for nodes with good ping times to suddenly become lagged, // due to a new block arriving or other large transfer. // 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)) { 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 :) stats.dPingTime = (((double)nPingUsecTime) / 1e6); stats.dPingWait = (((double)nPingUsecWait) / 1e6); - + // Leave string empty if addrLocal invalid (not filled in yet) stats.addrLocal = addrLocal.IsValid() ? addrLocal.ToString() : ""; } @@ -1542,9 +1542,9 @@ void ThreadMessageHandler() CNode* pnodeTrickle = NULL; if (!vNodesCopy.empty()) pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())]; - + bool fSleep = true; - + BOOST_FOREACH(CNode* pnode, vNodesCopy) { if (pnode->fDisconnect) @@ -1557,7 +1557,7 @@ void ThreadMessageHandler() { if (!g_signals.ProcessMessages(pnode)) pnode->CloseSocketDisconnect(); - + if (pnode->nSendSize < SendBufferSize()) { if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete())) @@ -1583,7 +1583,7 @@ void ThreadMessageHandler() BOOST_FOREACH(CNode* pnode, vNodesCopy) pnode->Release(); } - + if (fSleep) MilliSleep(100); } diff --git a/src/script.cpp b/src/script.cpp index dbf391b2ab0..228d432ee3a 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1907,7 +1907,7 @@ void CScript::SetMultisig(int nRequired, const std::vector& keys) 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[24] == OP_CHECKSIG) { memcpy(&hash, &script[3], 20); diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 8317862f7c6..6b3628b184d 100644 --- a/src/walletdb.cpp +++ b/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); } -bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey, - const std::vector& vchCryptedSecret, +bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey, + const std::vector& vchCryptedSecret, const CKeyMetadata &keyMeta) { const bool fEraseUnencryptedKey = true; @@ -429,7 +429,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, CKey key; CPrivKey pkey; uint256 hash = 0; - + if (strType == "key") { wss.nKeys++; @@ -439,7 +439,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, ssValue >> wkey; pkey = wkey.vchPrivKey; } - + // 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 // using EC operations as a checksum. @@ -450,9 +450,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, ssValue >> hash; } catch(...){} - + bool fSkipCheck = false; - + if (hash != 0) { // 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.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); vchKey.insert(vchKey.end(), pkey.begin(), pkey.end()); - + if (Hash(vchKey.begin(), vchKey.end()) != hash) { strErr = "Error reading wallet database: CPubKey/CPrivKey corrupt"; return false; } - + fSkipCheck = true; } - + if (!key.Load(pkey, vchPubKey, fSkipCheck)) { strErr = "Error reading wallet database: CPrivKey corrupt";