diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 6 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/qt/bitcoinstrings.cpp | 10 | ||||
-rw-r--r-- | src/qt/locale/bitcoin_en.ts | 74 | ||||
-rw-r--r-- | src/rpcblockchain.cpp | 70 | ||||
-rw-r--r-- | src/rpcserver.cpp | 1 | ||||
-rw-r--r-- | src/rpcserver.h | 1 | ||||
-rw-r--r-- | src/timedata.cpp | 2 |
9 files changed, 117 insertions, 55 deletions
diff --git a/src/init.cpp b/src/init.cpp index b84c233b99..0b621f3734 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -280,7 +280,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n"; strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + " " + _("(default: wallet.dat)") + "\n"; strUsage += " -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; - strUsage += " -zapwallettxes=<mode> " + _("Delete all wallet transactions and only recover those part of the blockchain through -rescan on startup") + "\n"; + strUsage += " -zapwallettxes=<mode> " + _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") + "\n"; strUsage += " " + _("(default: 1, 1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)") + "\n"; #endif @@ -1087,10 +1087,10 @@ bool AppInit2(boost::thread_group& threadGroup) InitWarning(msg); } else if (nLoadWalletRet == DB_TOO_NEW) - strErrors << _("Error loading wallet.dat: Wallet requires newer version of Bitcoin") << "\n"; + strErrors << _("Error loading wallet.dat: Wallet requires newer version of Bitcoin Core") << "\n"; else if (nLoadWalletRet == DB_NEED_REWRITE) { - strErrors << _("Wallet needed to be rewritten: restart Bitcoin to complete") << "\n"; + strErrors << _("Wallet needed to be rewritten: restart Bitcoin Core to complete") << "\n"; LogPrintf("%s", strErrors.str()); return InitError(strErrors.str()); } diff --git a/src/main.cpp b/src/main.cpp index 353cde0bd7..cf9318fedf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -444,7 +444,7 @@ CBlockIndex *CChain::FindFork(const CBlockLocator &locator) const { return Genesis(); } -CBlockIndex *CChain::FindFork(CBlockIndex *pindex) const { +const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const { if (pindex->nHeight > Height()) pindex = pindex->GetAncestor(Height()); while (pindex && !Contains(pindex)) @@ -2067,8 +2067,8 @@ static CBlockIndex* FindMostWorkChain() { static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork) { AssertLockHeld(cs_main); bool fInvalidFound = false; - CBlockIndex *pindexOldTip = chainActive.Tip(); - CBlockIndex *pindexFork = chainActive.FindFork(pindexMostWork); + const CBlockIndex *pindexOldTip = chainActive.Tip(); + const CBlockIndex *pindexFork = chainActive.FindFork(pindexMostWork); // Disconnect active blocks which are no longer in the best chain. while (chainActive.Tip() && chainActive.Tip() != pindexFork) { diff --git a/src/main.h b/src/main.h index 48ec86f6a8..a27020459a 100644 --- a/src/main.h +++ b/src/main.h @@ -1068,7 +1068,7 @@ public: CBlockIndex *FindFork(const CBlockLocator &locator) const; /** Find the last common block between this chain and a block index entry. */ - CBlockIndex *FindFork(CBlockIndex *pindex) const; + const CBlockIndex *FindFork(const CBlockIndex *pindex) const; }; /** The currently-connected chain of blocks. */ diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index 9ac7f24867..3b4b40aae3 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -54,8 +54,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" "Create new files with system default permissions, instead of umask 077 (only " "effective with disabled wallet functionality)"), QT_TRANSLATE_NOOP("bitcoin-core", "" -"Delete all wallet transactions and only recover those part of the blockchain " -"through -rescan on startup"), +"Delete all wallet transactions and only recover those parts of the " +"blockchain through -rescan on startup"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Distributed under the MIT/X11 software license, see the accompanying file " "COPYING or <http://www.opensource.org/licenses/mit-license.php>."), @@ -139,7 +139,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" "pay if you send a transaction."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Please check that your computer's date and time are correct! If " -"your clock is wrong Bitcoin will not work properly."), +"your clock is wrong Bitcoin Core will not work properly."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: The network does not appear to fully agree! Some miners appear to " "be experiencing issues."), @@ -192,7 +192,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environmen QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), -QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Bitcoin"), +QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Bitcoin Core"), QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), @@ -302,7 +302,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Wallet %s resides outside data directory %s"), -QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoin to complete"), +QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoin Core to complete"), QT_TRANSLATE_NOOP("bitcoin-core", "Wallet options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"), diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index 143f705327..2c95b5bba6 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -1284,7 +1284,7 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location line="+174"/> + <location line="+164"/> <location line="+13"/> <source>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</source> <translation type="unfinished"></translation> @@ -1310,7 +1310,7 @@ Address: %4 <translation>&Reset Options</translation> </message> <message> - <location line="-327"/> + <location line="-317"/> <source>&Network</source> <translation>&Network</translation> </message> @@ -1420,22 +1420,12 @@ Address: %4 <translation>Choose the default subdivision unit to show in the interface and when sending coins.</translation> </message> <message> - <location line="+9"/> - <source>Whether to show Bitcoin addresses in the transaction list or not.</source> - <translation>Whether to show Bitcoin addresses in the transaction list or not.</translation> - </message> - <message> - <location line="+3"/> - <source>&Display addresses in transaction list</source> - <translation>&Display addresses in transaction list</translation> - </message> - <message> - <location line="-252"/> + <location line="-240"/> <source>Whether to show coin control features or not.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+412"/> + <location line="+402"/> <source>&OK</source> <translation>&OK</translation> </message> @@ -1455,7 +1445,7 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location line="+83"/> + <location line="+82"/> <source>Confirm options reset</source> <translation>Confirm options reset</translation> </message> @@ -3583,7 +3573,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation type="unfinished"></translation> </message> <message> - <location line="+12"/> + <location line="+6"/> + <source>Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+6"/> <source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly.</source> <translation type="unfinished"></translation> </message> @@ -3648,12 +3643,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</translation> </message> <message> - <location line="+3"/> - <source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin will not work properly.</source> - <translation>Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin will not work properly.</translation> - </message> - <message> - <location line="+3"/> + <location line="+6"/> <source>Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.</source> <translation>Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.</translation> </message> @@ -3978,12 +3968,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation type="unfinished"></translation> </message> <message> - <location line="+3"/> - <source>Delete all wallet transactions and only recover those part of the blockchain through -rescan on startup</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> + <location line="+6"/> <source>Distributed under the MIT/X11 software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.</source> <translation type="unfinished"></translation> </message> @@ -4043,7 +4028,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation type="unfinished"></translation> </message> <message> - <location line="+29"/> + <location line="+13"/> + <source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin Core will not work properly.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+16"/> <source>Whitelist peers connecting from the given netmask or ip. Can be specified multiple times.</source> <translation type="unfinished"></translation> </message> @@ -4078,7 +4068,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation type="unfinished"></translation> </message> <message> - <location line="+16"/> + <location line="+12"/> + <source>Error loading wallet.dat: Wallet requires newer version of Bitcoin Core</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+4"/> <source>Error: Unsupported argument -tor found, use -onion.</source> <translation type="unfinished"></translation> </message> @@ -4298,7 +4293,12 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Username for JSON-RPC connections</translation> </message> <message> - <location line="+6"/> + <location line="+4"/> + <source>Wallet needed to be rewritten: restart Bitcoin Core to complete</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+2"/> <source>Warning</source> <translation>Warning</translation> </message> @@ -4393,17 +4393,7 @@ for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo. <translation>Error loading wallet.dat: Wallet corrupted</translation> </message> <message> - <location line="+1"/> - <source>Error loading wallet.dat: Wallet requires newer version of Bitcoin</source> - <translation>Error loading wallet.dat: Wallet requires newer version of Bitcoin</translation> - </message> - <message> - <location line="+110"/> - <source>Wallet needed to be rewritten: restart Bitcoin to complete</source> - <translation>Wallet needed to be rewritten: restart Bitcoin to complete</translation> - </message> - <message> - <location line="-112"/> + <location line="-1"/> <source>Error loading wallet.dat</source> <translation>Error loading wallet.dat</translation> </message> diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 253693e624..1e5198b85c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -461,3 +461,73 @@ Value getblockchaininfo(const Array& params, bool fHelp) obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); return obj; } + +/* Comparison function for sorting the getchaintips heads. */ +struct CompareBlocksByHeight +{ + bool operator()(const CBlockIndex* a, const CBlockIndex* b) const + { + /* Make sure that unequal blocks with the same height do not compare + equal. Use the pointers themselves to make a distinction. */ + + if (a->nHeight != b->nHeight) + return (a->nHeight > b->nHeight); + + return a < b; + } +}; + +Value getchaintips(const Array& params, bool fHelp) +{ + if (fHelp || params.size() != 0) + throw runtime_error( + "getchaintips\n" + "Return information about all known tips in the block tree," + " including the main chain as well as orphaned branches.\n" + "\nResult:\n" + "[\n" + " {\n" + " \"height\": xxxx, (numeric) height of the chain tip\n" + " \"hash\": \"xxxx\", (string) block hash of the tip\n" + " \"branchlen\": 0 (numeric) zero for main chain\n" + " },\n" + " {\n" + " \"height\": xxxx,\n" + " \"hash\": \"xxxx\",\n" + " \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n" + " }\n" + "]\n" + "\nExamples:\n" + + HelpExampleCli("getchaintips", "") + + HelpExampleRpc("getchaintips", "") + ); + + /* Build up a list of chain tips. We start with the list of all + known blocks, and successively remove blocks that appear as pprev + of another block. */ + std::set<const CBlockIndex*, CompareBlocksByHeight> setTips; + BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex) + setTips.insert(item.second); + BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex) + { + const CBlockIndex* pprev = item.second->pprev; + if (pprev) + setTips.erase(pprev); + } + + /* Construct the output array. */ + Array res; + BOOST_FOREACH(const CBlockIndex* block, setTips) + { + Object obj; + obj.push_back(Pair("height", block->nHeight)); + obj.push_back(Pair("hash", block->phashBlock->GetHex())); + + const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight; + obj.push_back(Pair("branchlen", branchLen)); + + res.push_back(obj); + } + + return res; +} diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 5deb6a4e08..716a7fba6a 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -235,6 +235,7 @@ static const CRPCCommand vRPCCommands[] = { "getblockcount", &getblockcount, true, false, false }, { "getblock", &getblock, true, false, false }, { "getblockhash", &getblockhash, true, false, false }, + { "getchaintips", &getchaintips, true, false, false }, { "getdifficulty", &getdifficulty, true, false, false }, { "getrawmempool", &getrawmempool, true, false, false }, { "gettxout", &gettxout, true, false, false }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 31badadd6d..176852ca8f 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -205,5 +205,6 @@ extern json_spirit::Value getblock(const json_spirit::Array& params, bool fHelp) extern json_spirit::Value gettxoutsetinfo(const json_spirit::Array& params, bool fHelp); extern json_spirit::Value gettxout(const json_spirit::Array& params, bool fHelp); extern json_spirit::Value verifychain(const json_spirit::Array& params, bool fHelp); +extern json_spirit::Value getchaintips(const json_spirit::Array& params, bool fHelp); #endif diff --git a/src/timedata.cpp b/src/timedata.cpp index 6c3bd9a48d..4576786b96 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -92,7 +92,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nTime) if (!fMatch) { fDone = true; - string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin will not work properly."); + string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin Core will not work properly."); strMiscWarning = strMessage; LogPrintf("*** %s\n", strMessage); uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING); |