diff options
-rw-r--r-- | doc/assets-attribution.txt | 12 | ||||
-rw-r--r-- | src/clientversion.h | 6 | ||||
-rw-r--r-- | src/init.cpp | 4 | ||||
-rw-r--r-- | src/main.cpp | 76 | ||||
-rw-r--r-- | src/main.h | 23 | ||||
-rw-r--r-- | src/net.cpp | 64 | ||||
-rw-r--r-- | src/net.h | 9 | ||||
-rw-r--r-- | src/protocol.cpp | 7 | ||||
-rw-r--r-- | src/qt/addressbookpage.cpp | 8 | ||||
-rw-r--r-- | src/qt/bitcoinstrings.cpp | 2 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 10 | ||||
-rw-r--r-- | src/qt/clientmodel.h | 2 | ||||
-rw-r--r-- | src/qt/locale/bitcoin_en.ts | 225 | ||||
-rw-r--r-- | src/rpcnet.cpp | 4 | ||||
-rw-r--r-- | src/wallet.cpp | 6 | ||||
-rw-r--r-- | src/wallet.h | 2 | ||||
-rw-r--r-- | src/walletdb.cpp | 2 |
17 files changed, 207 insertions, 255 deletions
diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt index 1a72775a7e..efd5c65a29 100644 --- a/doc/assets-attribution.txt +++ b/doc/assets-attribution.txt @@ -1,8 +1,8 @@ Icon: src/qt/res/icons/clock*.png, src/qt/res/icons/tx*.png, - src/qt/res/src/clock_green.svg, src/qt/res/src/clock1.svg - src/qt/res/src/clock2.svg, src/qt/res/src/clock3.svg - src/qt/res/src/clock4.svg, src/qt/res/src/clock5.svg - src/qt/res/src/inout.svg, src/qt/res/src/questionmark.svg + src/qt/res/src/clock_green.svg, src/qt/res/src/clock1.svg, + src/qt/res/src/clock2.svg, src/qt/res/src/clock3.svg, + src/qt/res/src/clock4.svg, src/qt/res/src/clock5.svg, + src/qt/res/src/inout.svg, src/qt/res/src/questionmark.svg Designer: Wladimir van der Laan License: MIT @@ -38,7 +38,7 @@ Designer: http://www.everaldo.com Icon Pack: Crystal SVG License: LGPL -Icon: scripts/img/reload.xcf (modified),src/qt/res/movies/update_spinner.mng +Icon: scripts/img/reload.xcf (modified), src/qt/res/movies/update_spinner.mng Icon Pack: Kids Designer: Everaldo (Everaldo Coelho) License: GNU/GPL @@ -59,4 +59,4 @@ Icon: src/qt/res/icons/bitcoin.icns, src/qt/res/src/bitcoin.svg, src/qt/res/src/bitcoin_testnet.png, docs/bitcoin_logo_doxygen.png, src/qt/res/icons/toolbar.png, src/qt/res/icons/toolbar_testnet.png Designer: Jonas Schnelli (based on the original bitcoin logo from Bitboy) -License: MIT
\ No newline at end of file +License: MIT diff --git a/src/clientversion.h b/src/clientversion.h index 44cda07b81..bc2e9c882a 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -8,11 +8,11 @@ // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 8 -#define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 0 +#define CLIENT_VERSION_REVISION 1 +#define CLIENT_VERSION_BUILD 99 // Set to true for release, false for prerelease or test build -#define CLIENT_VERSION_IS_RELEASE true +#define CLIENT_VERSION_IS_RELEASE false // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! diff --git a/src/init.cpp b/src/init.cpp index 66272e8421..70a9233386 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -334,7 +334,7 @@ std::string HelpMessage() " -rpcport=<port> " + _("Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)") + "\n" + " -rpcallowip=<ip> " + _("Allow JSON-RPC connections from specified IP address") + "\n" + " -rpcconnect=<ip> " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" + - " -rpcthreads=<n> " + _("Use this many threads to service RPC calls (default: 4)") + "\n" + + " -rpcthreads=<n> " + _("Set the number of threads to service RPC calls (default: 4)") + "\n" + " -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" + " -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" + " -alertnotify=<cmd> " + _("Execute command when a relevant alert is received (%s in cmd is replaced by message)") + "\n" + @@ -347,7 +347,7 @@ std::string HelpMessage() " -txindex " + _("Maintain a full transaction index (default: 0)") + "\n" + " -loadblock=<file> " + _("Imports blocks from external blk000??.dat file") + "\n" + " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + "\n" + - " -par=N " + _("Set the number of script verification threads (1-16, 0=auto, default: 0)") + "\n" + + " -par=<n> " + _("Set the number of script verification threads (1-16, 0=auto, default: 0)") + "\n" + "\n" + _("Block creation options:") + "\n" + " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n" + diff --git a/src/main.cpp b/src/main.cpp index 7f408c4d1b..8284d54c7c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -297,7 +297,7 @@ bool AddOrphanTx(const CDataStream& vMsg) // at most 500 megabytes of orphans: if (pvMsg->size() > 5000) { - printf("ignoring large orphan tx (size: %"PRIszu", hash: %s)\n", pvMsg->size(), hash.ToString().substr(0,10).c_str()); + printf("ignoring large orphan tx (size: %"PRIszu", hash: %s)\n", pvMsg->size(), hash.ToString().c_str()); delete pvMsg; return false; } @@ -306,7 +306,7 @@ bool AddOrphanTx(const CDataStream& vMsg) BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(make_pair(hash, pvMsg)); - printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().substr(0,10).c_str(), + printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(), mapOrphanTransactions.size()); return true; } @@ -770,7 +770,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH)) { - return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str()); + return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().c_str()); } } @@ -792,7 +792,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn SyncWithWallets(hash, tx, NULL, true); printf("CTxMemPool::accept() : accepted %s (poolsz %"PRIszu")\n", - hash.ToString().substr(0,10).c_str(), + hash.ToString().c_str(), mapTx.size()); return true; } @@ -1198,11 +1198,11 @@ void static InvalidChainFound(CBlockIndex* pindexNew) uiInterface.NotifyBlocksChanged(); } printf("InvalidChainFound: invalid block=%s height=%d work=%s date=%s\n", - BlockHashStr(pindexNew->GetBlockHash()).c_str(), pindexNew->nHeight, + pindexNew->GetBlockHash().ToString().c_str(), pindexNew->nHeight, pindexNew->bnChainWork.ToString().c_str(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexNew->GetBlockTime()).c_str()); printf("InvalidChainFound: current best=%s height=%d work=%s date=%s\n", - BlockHashStr(hashBestChain).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), + hashBestChain.ToString().c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6) printf("InvalidChainFound: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n"); @@ -1366,7 +1366,7 @@ bool CTransaction::HaveInputs(CCoinsViewCache &inputs) const bool CScriptCheck::operator()() const { const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags, nHashType)) - return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString().substr(0,10).c_str()); + return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString().c_str()); return true; } @@ -1385,7 +1385,7 @@ bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs, // This doesn't trigger the DoS code on purpose; if it did, it would make it easier // for an attacker to attempt to split the network. if (!HaveInputs(inputs)) - return state.Invalid(error("CheckInputs() : %s inputs unavailable", GetHash().ToString().substr(0,10).c_str())); + return state.Invalid(error("CheckInputs() : %s inputs unavailable", GetHash().ToString().c_str())); // While checking, GetBestBlock() refers to the parent block. // This is also true for mempool checks. @@ -1411,12 +1411,12 @@ bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs, } if (nValueIn < GetValueOut()) - return state.DoS(100, error("CheckInputs() : %s value in < value out", GetHash().ToString().substr(0,10).c_str())); + return state.DoS(100, error("CheckInputs() : %s value in < value out", GetHash().ToString().c_str())); // Tally transaction fees int64 nTxFee = nValueIn - GetValueOut(); if (nTxFee < 0) - return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", GetHash().ToString().substr(0,10).c_str())); + return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", GetHash().ToString().c_str())); nFees += nTxFee; if (!MoneyRange(nFees)) return state.DoS(100, error("CheckInputs() : nFees out of range")); @@ -1750,8 +1750,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) reverse(vConnect.begin(), vConnect.end()); if (vDisconnect.size() > 0) { - printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..%s\n", vDisconnect.size(), BlockHashStr(pfork->GetBlockHash()).c_str(), BlockHashStr(pindexBest->GetBlockHash()).c_str()); - printf("REORGANIZE: Connect %"PRIszu" blocks; %s..%s\n", vConnect.size(), BlockHashStr(pfork->GetBlockHash()).c_str(), BlockHashStr(pindexNew->GetBlockHash()).c_str()); + printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); + printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); } // Disconnect shorter branch @@ -1762,7 +1762,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) return state.Abort(_("Failed to read block")); int64 nStart = GetTimeMicros(); if (!block.DisconnectBlock(state, pindex, view)) - return error("SetBestBlock() : DisconnectBlock %s failed", BlockHashStr(pindex->GetBlockHash()).c_str()); + return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); if (fBenchmark) printf("- Disconnect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); @@ -1786,7 +1786,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) InvalidChainFound(pindexNew); InvalidBlockFound(pindex); } - return error("SetBestBlock() : ConnectBlock %s failed", BlockHashStr(pindex->GetBlockHash()).c_str()); + return error("SetBestBlock() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); } if (fBenchmark) printf("- Connect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); @@ -1862,7 +1862,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) nTimeBestReceived = GetTime(); nTransactionsUpdated++; printf("SetBestChain: new best=%s height=%d work=%s tx=%lu date=%s progress=%f\n", - BlockHashStr(hashBestChain).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), (unsigned long)pindexNew->nChainTx, + hashBestChain.ToString().c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), (unsigned long)pindexNew->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str(), Checkpoints::GuessVerificationProgress(pindexBest)); @@ -1901,7 +1901,7 @@ bool CBlock::AddToBlockIndex(CValidationState &state, const CDiskBlockPos &pos) // Check for duplicate uint256 hash = GetHash(); if (mapBlockIndex.count(hash)) - return state.Invalid(error("AddToBlockIndex() : %s already exists", BlockHashStr(hash).c_str())); + return state.Invalid(error("AddToBlockIndex() : %s already exists", hash.ToString().c_str())); // Construct new block index object CBlockIndex* pindexNew = new CBlockIndex(*this); @@ -2222,9 +2222,9 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl // Check for duplicate uint256 hash = pblock->GetHash(); if (mapBlockIndex.count(hash)) - return state.Invalid(error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, BlockHashStr(hash).c_str())); + return state.Invalid(error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString().c_str())); if (mapOrphanBlocks.count(hash)) - return state.Invalid(error("ProcessBlock() : already have block (orphan) %s", BlockHashStr(hash).c_str())); + return state.Invalid(error("ProcessBlock() : already have block (orphan) %s", hash.ToString().c_str())); // Preliminary checks if (!pblock->CheckBlock(state)) @@ -2253,7 +2253,7 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl // If we don't already have its previous block, shunt it off to holding area until we get it if (pblock->hashPrevBlock != 0 && !mapBlockIndex.count(pblock->hashPrevBlock)) { - printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", BlockHashStr(pblock->hashPrevBlock).c_str()); + printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", pblock->hashPrevBlock.ToString().c_str()); // Accept orphans as long as there is a node to request its parents from if (pfrom) { @@ -2589,7 +2589,7 @@ bool static LoadBlockIndexDB() pindex = pindexPrev; } printf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s\n", - BlockHashStr(hashBestChain).c_str(), nBestHeight, + hashBestChain.ToString().c_str(), nBestHeight, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); return true; @@ -3235,18 +3235,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) } } - // Ask the first connected node for block updates - static int nAskedForBlocks = 0; - if (!pfrom->fClient && !pfrom->fOneShot && !fImporting && !fReindex && - (pfrom->nStartingHeight > (nBestHeight - 144)) && - (pfrom->nVersion < NOBLKS_VERSION_START || - pfrom->nVersion >= NOBLKS_VERSION_END) && - (nAskedForBlocks < 1 || vNodes.size() <= 1)) - { - nAskedForBlocks++; - pfrom->PushGetBlocks(pindexBest, uint256(0)); - } - // Relay alerts { LOCK(cs_mapAlerts); @@ -3426,12 +3414,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (pindex) pindex = pindex->pnext; int nLimit = 500; - printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), BlockHashStr(hashStop).c_str(), nLimit); + printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().c_str(), nLimit); for (; pindex; pindex = pindex->pnext) { if (pindex->GetBlockHash() == hashStop) { - printf(" getblocks stopping at %d %s\n", pindex->nHeight, BlockHashStr(pindex->GetBlockHash()).c_str()); + printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); break; } pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); @@ -3439,7 +3427,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { // When this block is requested, we'll send an inv that'll make them // getblocks the next batch of inventory. - printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, BlockHashStr(pindex->GetBlockHash()).c_str()); + printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); pfrom->hashContinue = pindex->GetBlockHash(); break; } @@ -3473,7 +3461,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) // we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end vector<CBlock> vHeaders; int nLimit = 2000; - printf("getheaders %d to %s\n", (pindex ? pindex->nHeight : -1), BlockHashStr(hashStop).c_str()); + printf("getheaders %d to %s\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().c_str()); for (; pindex; pindex = pindex->pnext) { vHeaders.push_back(pindex->GetBlockHeader()); @@ -3522,7 +3510,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (tx.AcceptToMemoryPool(stateDummy, true, true, &fMissingInputs2)) { - printf(" accepted orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str()); + printf(" accepted orphan tx %s\n", inv.hash.ToString().c_str()); RelayTransaction(tx, inv.hash, vMsg); mapAlreadyAskedFor.erase(inv); vWorkQueue.push_back(inv.hash); @@ -3532,7 +3520,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { // invalid or too-little-fee orphan vEraseQueue.push_back(inv.hash); - printf(" removed orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str()); + printf(" removed orphan tx %s\n", inv.hash.ToString().c_str()); } } } @@ -3560,7 +3548,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) CBlock block; vRecv >> block; - printf("received block %s\n", BlockHashStr(block.GetHash()).c_str()); + printf("received block %s\n", block.GetHash().ToString().c_str()); // block.print(); CInv inv(MSG_BLOCK, block.GetHash()); @@ -3855,6 +3843,12 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pto->PushMessage("ping"); } + // Start block sync + if (pto->fStartSync && !fImporting && !fReindex) { + pto->fStartSync = false; + pto->PushGetBlocks(pindexBest, uint256(0)); + } + // Resend wallet transactions that haven't gotten in a block yet // Except during reindex, importing and IBD, when old wallet // transactions become unconfirmed and spams other nodes. @@ -4107,9 +4101,9 @@ public: void print() const { printf("COrphan(hash=%s, dPriority=%.1f, dFeePerKb=%.1f)\n", - ptx->GetHash().ToString().substr(0,10).c_str(), dPriority, dFeePerKb); + ptx->GetHash().ToString().c_str(), dPriority, dFeePerKb); BOOST_FOREACH(uint256 hash, setDependsOn) - printf(" setDependsOn %s\n", hash.ToString().substr(0,10).c_str()); + printf(" setDependsOn %s\n", hash.ToString().c_str()); } }; diff --git a/src/main.h b/src/main.h index 303588306d..9a3664a437 100644 --- a/src/main.h +++ b/src/main.h @@ -195,11 +195,6 @@ bool AbortNode(const std::string &msg); -static inline std::string BlockHashStr(const uint256& hash) -{ - return hash.ToString(); -} - bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut); struct CDiskBlockPos @@ -301,7 +296,7 @@ public: std::string ToString() const { - return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10).c_str(), n); + return strprintf("COutPoint(%s, %u)", hash.ToString().c_str(), n); } void print() const @@ -635,7 +630,7 @@ public: { std::string str; str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n", - GetHash().ToString().substr(0,10).c_str(), + GetHash().ToString().c_str(), nVersion, vin.size(), vout.size(), @@ -1472,10 +1467,10 @@ public: void print() const { printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n", - BlockHashStr(GetHash()).c_str(), + GetHash().ToString().c_str(), nVersion, - BlockHashStr(hashPrevBlock).c_str(), - hashMerkleRoot.ToString().substr(0,10).c_str(), + hashPrevBlock.ToString().c_str(), + hashMerkleRoot.ToString().c_str(), nTime, nBits, nNonce, vtx.size()); for (unsigned int i = 0; i < vtx.size(); i++) @@ -1485,7 +1480,7 @@ public: } printf(" vMerkleTree: "); for (unsigned int i = 0; i < vMerkleTree.size(); i++) - printf("%s ", vMerkleTree[i].ToString().substr(0,10).c_str()); + printf("%s ", vMerkleTree[i].ToString().c_str()); printf("\n"); } @@ -1785,8 +1780,8 @@ public: { return strprintf("CBlockIndex(pprev=%p, pnext=%p, nHeight=%d, merkle=%s, hashBlock=%s)", pprev, pnext, nHeight, - hashMerkleRoot.ToString().substr(0,10).c_str(), - BlockHashStr(GetBlockHash()).c_str()); + hashMerkleRoot.ToString().c_str(), + GetBlockHash().ToString().c_str()); } void print() const @@ -1867,7 +1862,7 @@ public: str += CBlockIndex::ToString(); str += strprintf("\n hashBlock=%s, hashPrev=%s)", GetBlockHash().ToString().c_str(), - BlockHashStr(hashPrev).c_str()); + hashPrev.ToString().c_str()); return str; } diff --git a/src/net.cpp b/src/net.cpp index 069f8b5cf6..755312682b 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -44,6 +44,7 @@ static map<CNetAddr, LocalServiceInfo> mapLocalHost; static bool vfReachable[NET_MAX] = {}; static bool vfLimited[NET_MAX] = {}; static CNode* pnodeLocalHost = NULL; +static CNode* pnodeSync = NULL; uint64 nLocalHostNonce = 0; static std::vector<SOCKET> vhListenSocket; CAddrMan addrman; @@ -515,12 +516,16 @@ void CNode::CloseSocketDisconnect() printf("disconnecting node %s\n", addrName.c_str()); closesocket(hSocket); hSocket = INVALID_SOCKET; - - // in case this fails, we'll empty the recv buffer when the CNode is deleted - TRY_LOCK(cs_vRecvMsg, lockRecv); - if (lockRecv) - vRecvMsg.clear(); } + + // in case this fails, we'll empty the recv buffer when the CNode is deleted + TRY_LOCK(cs_vRecvMsg, lockRecv); + if (lockRecv) + vRecvMsg.clear(); + + // if this was the sync node, we'll need a new one + if (this == pnodeSync) + pnodeSync = NULL; } void CNode::Cleanup() @@ -607,6 +612,9 @@ void CNode::copyStats(CNodeStats &stats) X(fInbound); X(nStartingHeight); X(nMisbehavior); + X(nSendBytes); + X(nRecvBytes); + stats.fSyncNode = (this == pnodeSync); } #undef X @@ -701,6 +709,7 @@ void SocketSendData(CNode *pnode) int nBytes = send(pnode->hSocket, &data[pnode->nSendOffset], data.size() - pnode->nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT); if (nBytes > 0) { pnode->nLastSend = GetTime(); + pnode->nSendBytes += nBytes; pnode->nSendOffset += nBytes; if (pnode->nSendOffset == data.size()) { pnode->nSendOffset = 0; @@ -963,6 +972,7 @@ void ThreadSocketHandler() if (!pnode->ReceiveMsgBytes(pchBuf, nBytes)) pnode->CloseSocketDisconnect(); pnode->nLastRecv = GetTime(); + pnode->nRecvBytes += nBytes; } else if (nBytes == 0) { @@ -1538,24 +1548,64 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu } +// for now, use a very simple selection metric: the node from which we received +// most recently +double static NodeSyncScore(const CNode *pnode) { + return -pnode->nLastRecv; +} +void static StartSync(const vector<CNode*> &vNodes) { + CNode *pnodeNewSync = NULL; + double dBestScore = 0; + // fImporting and fReindex are accessed out of cs_main here, but only + // as an optimization - they are checked again in SendMessages. + if (fImporting || fReindex) + return; - + // Iterate over all nodes + BOOST_FOREACH(CNode* pnode, vNodes) { + // check preconditions for allowing a sync + if (!pnode->fClient && !pnode->fOneShot && + !pnode->fDisconnect && pnode->fSuccessfullyConnected && + (pnode->nStartingHeight > (nBestHeight - 144)) && + (pnode->nVersion < NOBLKS_VERSION_START || pnode->nVersion >= NOBLKS_VERSION_END)) { + // if ok, compare node's score with the best so far + double dScore = NodeSyncScore(pnode); + if (pnodeNewSync == NULL || dScore > dBestScore) { + pnodeNewSync = pnode; + dBestScore = dScore; + } + } + } + // if a new sync candidate was found, start sync! + if (pnodeNewSync) { + pnodeNewSync->fStartSync = true; + pnodeSync = pnodeNewSync; + } +} void ThreadMessageHandler() { SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); while (true) { + bool fHaveSyncNode = false; + vector<CNode*> vNodesCopy; { LOCK(cs_vNodes); vNodesCopy = vNodes; - BOOST_FOREACH(CNode* pnode, vNodesCopy) + BOOST_FOREACH(CNode* pnode, vNodesCopy) { pnode->AddRef(); + if (pnode == pnodeSync) + fHaveSyncNode = true; + } } + if (!fHaveSyncNode) + StartSync(vNodesCopy); + // Poll the connected nodes for messages CNode* pnodeTrickle = NULL; if (!vNodesCopy.empty()) @@ -101,6 +101,9 @@ public: bool fInbound; int nStartingHeight; int nMisbehavior; + uint64 nSendBytes; + uint64 nRecvBytes; + bool fSyncNode; }; @@ -155,12 +158,14 @@ public: CDataStream ssSend; size_t nSendSize; // total size of all vSendMsg entries size_t nSendOffset; // offset inside the first vSendMsg already sent + uint64 nSendBytes; std::deque<CSerializeData> vSendMsg; CCriticalSection cs_vSend; std::deque<CInv> vRecvGetData; std::deque<CNetMessage> vRecvMsg; CCriticalSection cs_vRecvMsg; + uint64 nRecvBytes; int nRecvVersion; int64 nLastSend; @@ -200,6 +205,7 @@ public: CBlockIndex* pindexLastGetBlocksBegin; uint256 hashLastGetBlocksEnd; int nStartingHeight; + bool fStartSync; // flood relay std::vector<CAddress> vAddrToSend; @@ -220,6 +226,8 @@ public: nRecvVersion = MIN_PROTO_VERSION; nLastSend = 0; nLastRecv = 0; + nSendBytes = 0; + nRecvBytes = 0; nLastSendEmpty = GetTime(); nTimeConnected = GetTime(); addr = addrIn; @@ -239,6 +247,7 @@ public: pindexLastGetBlocksBegin = 0; hashLastGetBlocksEnd = 0; nStartingHeight = -1; + fStartSync = false; fGetAddr = false; nMisbehavior = 0; fRelayTxes = false; diff --git a/src/protocol.cpp b/src/protocol.cpp index 7b42f5270b..88bbe49afd 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -142,12 +142,7 @@ const char* CInv::GetCommand() const std::string CInv::ToString() const { - if (type == MSG_BLOCK) - return strprintf("%s %s", GetCommand(), BlockHashStr(hash).c_str()); - if (type == MSG_TX) - return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,10).c_str()); - - return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,20).c_str()); + return strprintf("%s %s", GetCommand(), hash.ToString().c_str()); } void CInv::print() const diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index cc3d27d01d..23c69fef21 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -28,9 +28,11 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : ui->setupUi(this); #ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac - ui->newAddressButton->setIcon(QIcon()); - ui->copyToClipboard->setIcon(QIcon()); - ui->deleteButton->setIcon(QIcon()); + ui->newAddress->setIcon(QIcon()); + ui->copyAddress->setIcon(QIcon()); + ui->deleteAddress->setIcon(QIcon()); + ui->verifyMessage->setIcon(QIcon()); + ui->signMessage->setIcon(QIcon()); #endif #ifndef USE_QRCODE diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index 2c500f4fe1..4f3bb10642 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -119,7 +119,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Transaction creation failed!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"), -QT_TRANSLATE_NOOP("bitcoin-core", "Error: could not start node"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: system error: "), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block info"), @@ -177,6 +176,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: 250000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"), QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: bitcoin.conf)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"), diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 863176aa1b..c17c602b50 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -17,7 +17,9 @@ static const int64 nClientStartupTime = GetTime(); ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : QObject(parent), optionsModel(optionsModel), - cachedNumBlocks(0), cachedNumBlocksOfPeers(0), numBlocksAtStartup(-1), pollTimer(0) + cachedNumBlocks(0), cachedNumBlocksOfPeers(0), + cachedReindexing(0), cachedImporting(0), + numBlocksAtStartup(-1), pollTimer(0) { pollTimer = new QTimer(this); pollTimer->setInterval(MODEL_UPDATE_DELAY); @@ -70,10 +72,14 @@ void ClientModel::updateTimer() int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); - if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) + // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state + if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers || + cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; + cachedReindexing = fReindex; + cachedImporting = fImporting; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 3ba34b2786..904bff1886 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -60,6 +60,8 @@ private: int cachedNumBlocks; int cachedNumBlocksOfPeers; + bool cachedReindexing; + bool cachedImporting; int numBlocksAtStartup; diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index c74b11d3d6..105a5c6ab2 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -48,7 +48,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Address Book</translation> </message> <message> - <location line="+22"/> + <location line="+19"/> <source>Double-click to edit address or label</source> <translation>Double-click to edit address or label</translation> </message> @@ -68,12 +68,12 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>&New Address</translation> </message> <message> - <location line="-46"/> + <location filename="../addressbookpage.cpp" line="+59"/> <source>These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</translation> </message> <message> - <location line="+60"/> + <location filename="../forms/addressbookpage.ui" line="+14"/> <source>&Copy Address</source> <translation>&Copy Address</translation> </message> @@ -113,7 +113,12 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>&Delete</translation> </message> <message> - <location filename="../addressbookpage.cpp" line="+66"/> + <location filename="../addressbookpage.cpp" line="-5"/> + <source>These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> + <translation>These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</translation> + </message> + <message> + <location line="+13"/> <source>Copy &Label</source> <translation>Copy &Label</translation> </message> @@ -128,7 +133,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Send &Coins</translation> </message> <message> - <location line="+263"/> + <location line="+260"/> <source>Export Address Book Data</source> <translation>Export Address Book Data</translation> </message> @@ -310,7 +315,7 @@ This product includes software developed by the OpenSSL Project for use in the O <context> <name>BitcoinGUI</name> <message> - <location filename="../bitcoingui.cpp" line="+231"/> + <location filename="../bitcoingui.cpp" line="+233"/> <source>Sign &message...</source> <translation>Sign &message...</translation> </message> @@ -320,7 +325,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Synchronizing with network...</translation> </message> <message> - <location line="-367"/> + <location line="-368"/> <source>&Overview</source> <translation>&Overview</translation> </message> @@ -380,7 +385,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>&Options...</translation> </message> <message> - <location line="+5"/> + <location line="+6"/> <source>&Encrypt Wallet...</source> <translation>&Encrypt Wallet...</translation> </message> @@ -410,7 +415,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>&Export...</translation> </message> <message> - <location line="-65"/> + <location line="-66"/> <source>Send coins to a Bitcoin address</source> <translation>Send coins to a Bitcoin address</translation> </message> @@ -420,7 +425,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Modify configuration options for Bitcoin</translation> </message> <message> - <location line="+17"/> + <location line="+18"/> <source>Export the data in the current tab to a file</source> <translation>Export the data in the current tab to a file</translation> </message> @@ -450,13 +455,13 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>&Verify message...</translation> </message> <message> - <location line="-162"/> - <location line="+540"/> + <location line="-163"/> + <location line="+541"/> <source>Bitcoin</source> <translation>Bitcoin</translation> </message> <message> - <location line="-540"/> + <location line="-541"/> <source>Wallet</source> <translation>Wallet</translation> </message> @@ -491,7 +496,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Show or hide the main Window</translation> </message> <message> - <location line="+2"/> + <location line="+3"/> <source>Encrypt the private keys that belong to your wallet</source> <translation>Encrypt the private keys that belong to your wallet</translation> </message> @@ -679,7 +684,7 @@ Address: %4 <translation>Wallet is <b>encrypted</b> and currently <b>locked</b></translation> </message> <message> - <location filename="../bitcoin.cpp" line="+108"/> + <location filename="../bitcoin.cpp" line="+104"/> <source>A fatal error occurred. Bitcoin can no longer continue safely and will quit.</source> <translation>A fatal error occurred. Bitcoin can no longer continue safely and will quit.</translation> </message> @@ -687,7 +692,7 @@ Address: %4 <context> <name>ClientModel</name> <message> - <location filename="../clientmodel.cpp" line="+96"/> + <location filename="../clientmodel.cpp" line="+98"/> <source>Network Alert</source> <translation>Network Alert</translation> </message> @@ -763,7 +768,7 @@ Address: %4 <context> <name>GUIUtil::HelpMessageBox</name> <message> - <location filename="../guiutil.cpp" line="+422"/> + <location filename="../guiutil.cpp" line="+424"/> <location line="+12"/> <source>Bitcoin-Qt</source> <translation>Bitcoin-Qt</translation> @@ -1157,7 +1162,7 @@ Address: %4 <location line="+53"/> <location line="+23"/> <location line="+23"/> - <location filename="../rpcconsole.cpp" line="+344"/> + <location filename="../rpcconsole.cpp" line="+339"/> <source>N/A</source> <translation>N/A</translation> </message> @@ -2146,117 +2151,7 @@ Address: %4 <context> <name>WalletView</name> <message> - <location filename="../walletview.cpp" line="+95"/> - <source>&Overview</source> - <translation>&Overview</translation> - </message> - <message> - <location line="+1"/> - <source>Show general overview of wallet</source> - <translation>Show general overview of wallet</translation> - </message> - <message> - <location line="+6"/> - <source>&Send coins</source> - <translation>&Send coins</translation> - </message> - <message> - <location line="+1"/> - <source>Send coins to a Bitcoin address</source> - <translation>Send coins to a Bitcoin address</translation> - </message> - <message> - <location line="+6"/> - <source>&Receive coins</source> - <translation>&Receive coins</translation> - </message> - <message> - <location line="+1"/> - <source>Show the list of addresses for receiving payments</source> - <translation>Show the list of addresses for receiving payments</translation> - </message> - <message> - <location line="+6"/> - <source>&Transactions</source> - <translation>&Transactions</translation> - </message> - <message> - <location line="+1"/> - <source>Browse transaction history</source> - <translation>Browse transaction history</translation> - </message> - <message> - <location line="+6"/> - <source>&Address Book</source> - <translation>&Address Book</translation> - </message> - <message> - <location line="+1"/> - <source>Edit the list of stored addresses and labels</source> - <translation>Edit the list of stored addresses and labels</translation> - </message> - <message> - <location line="+12"/> - <source>&Encrypt Wallet...</source> - <translation>&Encrypt Wallet...</translation> - </message> - <message> - <location line="+1"/> - <source>Encrypt the private keys that belong to your wallet</source> - <translation>Encrypt the private keys that belong to your wallet</translation> - </message> - <message> - <location line="+2"/> - <source>&Backup Wallet...</source> - <translation>&Backup Wallet...</translation> - </message> - <message> - <location line="+1"/> - <source>Backup wallet to another location</source> - <translation>Backup wallet to another location</translation> - </message> - <message> - <location line="+1"/> - <source>&Change Passphrase...</source> - <translation>&Change Passphrase...</translation> - </message> - <message> - <location line="+1"/> - <source>Change the passphrase used for wallet encryption</source> - <translation>Change the passphrase used for wallet encryption</translation> - </message> - <message> - <location line="+1"/> - <source>Sign &message...</source> - <translation>Sign &message...</translation> - </message> - <message> - <location line="+1"/> - <source>Sign messages with your Bitcoin addresses to prove you own them</source> - <translation>Sign messages with your Bitcoin addresses to prove you own them</translation> - </message> - <message> - <location line="+1"/> - <source>&Verify message...</source> - <translation>&Verify message...</translation> - </message> - <message> - <location line="+1"/> - <source>Verify messages to ensure they were signed with specified Bitcoin addresses</source> - <translation>Verify messages to ensure they were signed with specified Bitcoin addresses</translation> - </message> - <message> - <location line="+2"/> - <source>&Export...</source> - <translation>&Export...</translation> - </message> - <message> - <location line="+1"/> - <source>Export the data in the current tab to a file</source> - <translation>Export the data in the current tab to a file</translation> - </message> - <message> - <location line="+180"/> + <location filename="../walletview.cpp" line="+247"/> <source>Backup Wallet</source> <translation>Backup Wallet</translation> </message> @@ -2299,7 +2194,7 @@ Address: %4 <translation>Usage:</translation> </message> <message> - <location line="-24"/> + <location line="-25"/> <source>Send command to -server or bitcoind</source> <translation>Send command to -server or bitcoind</translation> </message> @@ -2319,7 +2214,7 @@ Address: %4 <translation>Options:</translation> </message> <message> - <location line="+22"/> + <location line="+23"/> <source>Specify configuration file (default: bitcoin.conf)</source> <translation>Specify configuration file (default: bitcoin.conf)</translation> </message> @@ -2329,12 +2224,12 @@ Address: %4 <translation>Specify pid file (default: bitcoind.pid)</translation> </message> <message> - <location line="-47"/> + <location line="-48"/> <source>Generate coins</source> <translation>Generate coins</translation> </message> <message> - <location line="-28"/> + <location line="-27"/> <source>Don't generate coins</source> <translation>Don't generate coins</translation> </message> @@ -2344,7 +2239,7 @@ Address: %4 <translation>Specify data directory</translation> </message> <message> - <location line="-7"/> + <location line="-8"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Set database cache size in megabytes (default: 25)</translation> </message> @@ -2359,7 +2254,7 @@ Address: %4 <translation>Maintain at most <n> connections to peers (default: 125)</translation> </message> <message> - <location line="-49"/> + <location line="-48"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Connect to a node to retrieve peer addresses, and disconnect</translation> </message> @@ -2394,12 +2289,12 @@ Address: %4 <translation>Accept command line and JSON-RPC commands</translation> </message> <message> - <location line="+77"/> + <location line="+76"/> <source>Run in the background as a daemon and accept commands</source> <translation>Run in the background as a daemon and accept commands</translation> </message> <message> - <location line="+32"/> + <location line="+33"/> <source>Use the test network</source> <translation>Use the test network</translation> </message> @@ -2579,7 +2474,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Error: Wallet locked, unable to create transaction!</translation> </message> <message> - <location line="+2"/> + <location line="+1"/> <source>Error: system error: </source> <translation>Error: system error: </translation> </message> @@ -2659,7 +2554,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Rebuild block chain index from current blk000??.dat files</translation> </message> <message> - <location line="+37"/> + <location line="+16"/> + <source>Set the number of threads to service RPC calls (default: 4)</source> + <translation>Set the number of threads to service RPC calls (default: 4)</translation> + </message> + <message> + <location line="+22"/> <source>Verifying blocks...</source> <translation>Verifying blocks...</translation> </message> @@ -2669,7 +2569,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Verifying wallet...</translation> </message> <message> - <location line="-61"/> + <location line="-62"/> <source>Imports blocks from external blk000??.dat file</source> <translation>Imports blocks from external blk000??.dat file</translation> </message> @@ -2754,7 +2654,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Set minimum block size in bytes (default: 0)</translation> </message> <message> - <location line="+1"/> + <location line="+2"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Shrink debug.log file on client startup (default: 1 when no -debug)</translation> </message> @@ -2809,22 +2709,22 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>wallet.dat corrupt, salvage failed</translation> </message> <message> - <location line="-45"/> + <location line="-46"/> <source>Password for JSON-RPC connections</source> <translation>Password for JSON-RPC connections</translation> </message> <message> - <location line="-68"/> + <location line="-67"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Allow JSON-RPC connections from specified IP address</translation> </message> <message> - <location line="+77"/> + <location line="+76"/> <source>Send commands to node running on <ip> (default: 127.0.0.1)</source> <translation>Send commands to node running on <ip> (default: 127.0.0.1)</translation> </message> <message> - <location line="-120"/> + <location line="-119"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Execute command when the best block changes (%s in cmd is replaced by block hash)</translation> </message> @@ -2834,7 +2734,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Upgrade wallet to latest format</translation> </message> <message> - <location line="-16"/> + <location line="-17"/> <source>Set key pool size to <n> (default: 100)</source> <translation>Set key pool size to <n> (default: 100)</translation> </message> @@ -2844,12 +2744,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Rescan the block chain for missing wallet transactions</translation> </message> <message> - <location line="+30"/> + <location line="+31"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Use OpenSSL (https) for JSON-RPC connections</translation> </message> <message> - <location line="-21"/> + <location line="-22"/> <source>Server certificate file (default: server.cert)</source> <translation>Server certificate file (default: server.cert)</translation> </message> @@ -2859,7 +2759,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Server private key (default: server.pem)</translation> </message> <message> - <location line="-154"/> + <location line="-153"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation> </message> @@ -2884,12 +2784,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Allow DNS lookups for -addnode, -seednode and -connect</translation> </message> <message> - <location line="+57"/> + <location line="+56"/> <source>Loading addresses...</source> <translation>Loading addresses...</translation> </message> <message> - <location line="-35"/> + <location line="-34"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Error loading wallet.dat: Wallet corrupted</translation> </message> @@ -2909,12 +2809,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Error loading wallet.dat</translation> </message> <message> - <location line="+30"/> + <location line="+29"/> <source>Invalid -proxy address: '%s'</source> <translation>Invalid -proxy address: '%s'</translation> </message> <message> - <location line="+48"/> + <location line="+49"/> <source>Unknown network specified in -onlynet: '%s'</source> <translation>Unknown network specified in -onlynet: '%s'</translation> </message> @@ -2934,17 +2834,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Cannot resolve -externalip address: '%s'</translation> </message> <message> - <location line="+45"/> + <location line="+44"/> <source>Invalid amount for -paytxfee=<amount>: '%s'</source> <translation>Invalid amount for -paytxfee=<amount>: '%s'</translation> </message> <message> - <location line="-24"/> - <source>Error: could not start node</source> - <translation>Error: could not start node</translation> - </message> - <message> - <location line="+25"/> + <location line="+1"/> <source>Invalid amount</source> <translation>Invalid amount</translation> </message> @@ -2959,7 +2854,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Loading block index...</translation> </message> <message> - <location line="-59"/> + <location line="-58"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Add a node to connect to and attempt to keep the connection open</translation> </message> @@ -2969,7 +2864,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Unable to bind to %s on this computer. Bitcoin is probably already running.</translation> </message> <message> - <location line="+68"/> + <location line="+67"/> <source>Fee per KB to add to transactions you send</source> <translation>Fee per KB to add to transactions you send</translation> </message> @@ -2979,7 +2874,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Loading wallet...</translation> </message> <message> - <location line="-54"/> + <location line="-53"/> <source>Cannot downgrade wallet</source> <translation>Cannot downgrade wallet</translation> </message> @@ -2994,12 +2889,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Cannot write default address</translation> </message> <message> - <location line="+64"/> + <location line="+63"/> <source>Rescanning...</source> <translation>Rescanning...</translation> </message> <message> - <location line="-56"/> + <location line="-55"/> <source>Done loading</source> <translation>Done loading</translation> </message> diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index e37b3009dd..644c2675ae 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -51,12 +51,16 @@ Value getpeerinfo(const Array& params, bool fHelp) obj.push_back(Pair("services", strprintf("%08"PRI64x, stats.nServices))); obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend)); obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv)); + obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes)); + obj.push_back(Pair("bytesrecv", (boost::int64_t)stats.nRecvBytes)); obj.push_back(Pair("conntime", (boost::int64_t)stats.nTimeConnected)); obj.push_back(Pair("version", stats.nVersion)); obj.push_back(Pair("subver", stats.strSubVer)); obj.push_back(Pair("inbound", stats.fInbound)); obj.push_back(Pair("startingheight", stats.nStartingHeight)); obj.push_back(Pair("banscore", stats.nMisbehavior)); + if (stats.fSyncNode) + obj.push_back(Pair("syncnode", true)); ret.push_back(obj); } diff --git a/src/wallet.cpp b/src/wallet.cpp index 2cc2e60f80..c7eb4f74e8 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -420,7 +420,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) } else printf("AddToWallet() : found %s in block %s not in index\n", - wtxIn.GetHash().ToString().substr(0,10).c_str(), + wtxIn.GetHash().ToString().c_str(), wtxIn.hashBlock.ToString().c_str()); } } @@ -449,7 +449,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) } //// debug print - printf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString().substr(0,10).c_str(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); + printf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString().c_str(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); // Write to disk if (fInsertedNew || fUpdated) @@ -845,7 +845,7 @@ void CWalletTx::RelayWalletTransaction() { if (GetDepthInMainChain() == 0) { uint256 hash = GetHash(); - printf("Relaying wtx %s\n", hash.ToString().substr(0,10).c_str()); + printf("Relaying wtx %s\n", hash.ToString().c_str()); RelayTransaction((CTransaction)*this, hash); } } diff --git a/src/wallet.h b/src/wallet.h index e750bfd89e..2e007557b0 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -704,7 +704,7 @@ public: std::string ToString() const { - return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString().substr(0,10).c_str(), i, nDepth, FormatMoney(tx->vout[i].nValue).c_str()); + return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString().c_str(), i, nDepth, FormatMoney(tx->vout[i].nValue).c_str()); } void print() const diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 841553ea6a..81a21443a1 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -240,7 +240,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, //printf(" %12"PRI64d" %s %s %s\n", // wtx.vout[0].nValue, // DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()).c_str(), - // wtx.hashBlock.ToString().substr(0,20).c_str(), + // wtx.hashBlock.ToString().c_str(), // wtx.mapValue["message"].c_str()); } else if (strType == "acentry") |