aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/dnsseed-policy.md52
-rwxr-xr-xqa/rpc-tests/getchaintips.py24
-rw-r--r--src/init.cpp6
-rw-r--r--src/main.cpp6
-rw-r--r--src/main.h2
-rw-r--r--src/qt/bitcoinstrings.cpp10
-rw-r--r--src/qt/locale/bitcoin_en.ts74
-rw-r--r--src/rpcblockchain.cpp70
-rw-r--r--src/rpcserver.cpp1
-rw-r--r--src/rpcserver.h1
-rw-r--r--src/timedata.cpp2
11 files changed, 193 insertions, 55 deletions
diff --git a/doc/dnsseed-policy.md b/doc/dnsseed-policy.md
new file mode 100644
index 0000000000..73e307f7cd
--- /dev/null
+++ b/doc/dnsseed-policy.md
@@ -0,0 +1,52 @@
+Expectations for DNS Seed operators
+====================================
+
+Bitcoin Core attempts to minimize the level of trust in DNS seeds,
+but DNS seeds still pose a small amount of risk for the network.
+Other implementations of Bitcoin software may also use the same
+seeds and may be more exposed. In light of this exposure this
+document establishes some basic expectations for the expectations
+for the operation of dnsseeds.
+
+0. A DNS seed operating organization or person is expected
+to follow good host security practices and maintain control of
+their serving infrastructure and not sell or transfer control of their
+DNS seed. Any hosting services contracted by the operator are
+equally expected to uphold these expectations.
+
+1. The DNS seed results must consist exclusively of fairly selected and
+functioning Bitcoin nodes from the public network to the best of the
+operators understanding and capability.
+
+2. For the avoidance of doubt, the results may be randomized but must not
+single-out any group of hosts to receive different results unless due to an
+urgent technical necessity and disclosed.
+
+3. The results may not be served with a DNS TTL of less than one minute.
+
+4. Any logging of DNS queries should be only that which is necessary
+for the operation of the service or urgent health of the Bitcoin
+network and must not be retained longer than necessary or disclosed
+to any third party.
+
+5. Information gathered as a result of the operators node-spidering
+(not from DNS queries) may be freely published or retained, but only
+if this data was not made more complete by biasing node connectivity
+(a violation of expectation (1)).
+
+6. Operators are encouraged, but not required, to publicly document the
+details of their operating practices.
+
+7. A reachable email contact address must be published for inquiries
+related to the DNS seed operation.
+
+If these expectations cannot be satisfied the operator should
+discontinue providing services and contact the active Bitcoin
+Core development team as well as posting on bitcoin-development.
+
+Behavior outside of these expectations may be reasonable in some
+situations but should be discussed in public in advance.
+
+See also
+----------
+- [bitcoin-seeder](https://github.com/sipa/bitcoin-seeder) is a reference implementation of a DNS seed.
diff --git a/qa/rpc-tests/getchaintips.py b/qa/rpc-tests/getchaintips.py
new file mode 100755
index 0000000000..a83c499743
--- /dev/null
+++ b/qa/rpc-tests/getchaintips.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 The Bitcoin Core developers
+# Distributed under the MIT/X11 software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+# Exercise the getchaintips API.
+
+# Since the test framework does not generate orphan blocks, we can
+# unfortunately not check for them!
+
+from test_framework import BitcoinTestFramework
+from util import assert_equal
+
+class GetChainTipsTest (BitcoinTestFramework):
+
+ def run_test (self, nodes):
+ res = nodes[0].getchaintips ()
+ assert_equal (len (res), 1)
+ res = res[0]
+ assert_equal (res['branchlen'], 0)
+ assert_equal (res['height'], 200)
+
+if __name__ == '__main__':
+ GetChainTipsTest ().main ()
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>&amp;Reset Options</translation>
</message>
<message>
- <location line="-327"/>
+ <location line="-317"/>
<source>&amp;Network</source>
<translation>&amp;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>&amp;Display addresses in transaction list</source>
- <translation>&amp;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>&amp;OK</source>
<translation>&amp;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 &quot;Bitcoin Alert&quot; 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 &quot;Bitcoin Alert&quot; 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&apos;s date and time are correct! If your clock is wrong Bitcoin will not work properly.</source>
- <translation>Warning: Please check that your computer&apos;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 &quot;Bitcoin Alert&quot; 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 &lt;http://www.opensource.org/licenses/mit-license.php&gt;.</source>
<translation type="unfinished"></translation>
</message>
@@ -4043,7 +4028,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+29"/>
+ <location line="+13"/>
+ <source>Warning: Please check that your computer&apos;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 &quot;Bitcoin Alert&quot; 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 &quot;Bitcoin Alert&quot; 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 &quot;Bitcoin Alert&quot; 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);