Merge remote-tracking branch 'bitcoin/0.10' into master-0.10

This commit is contained in:
Warren Togami 2015-04-29 18:35:22 -10:00
commit bca95b3dd3
6 changed files with 44 additions and 14 deletions

View File

@ -3,8 +3,7 @@ Bitcoin Core version 0.10.1 is now available from:
<https://bitcoin.org/bin/bitcoin-core-0.10.1/>
This is a new minor version release, bringing bug fixes and translation
updates. If you are using 0.10.0, it is recommended to upgrade to this
version.
updates. It is recommended to upgrade to this version.
Please report bugs using the issue tracker at github:
@ -59,6 +58,7 @@ behavior, not code moves, refactors or string updates.
RPC:
- `7f502be` fix crash: createmultisig and addmultisigaddress
- `eae305f` Fix missing lock in submitblock
Block (database) and transaction handling:
- `1d2cdd2` Fix InvalidateBlock to add chainActive.Tip to setBlockIndexCandidates
@ -66,6 +66,8 @@ Block (database) and transaction handling:
- `002c8a2` fix possible block db breakage during re-index
- `a1f425b` Add (optional) consistency check for the block chain data structures
- `1c62e84` Keep mempool consistent during block-reorgs
- `57d1f46` Fix CheckBlockIndex for reindex
- `bac6fca` Set nSequenceId when a block is fully linked
P2P protocol and network code:
- `78f64ef` don't trickle for whitelisted nodes
@ -77,6 +79,7 @@ P2P protocol and network code:
- `0c6f334` Always use a 50% chance to choose between tried and new entries (countermeasure 2 against eclipse attacks)
- `214154e` Do not bias outgoing connections towards fresh addresses (countermeasure 2 against eclipse attacks)
- `aa587d4` Scale up addrman (countermeasure 6 against eclipse attacks)
- `139cd81` Cap nAttempts penalty at 8 and switch to pow instead of a division loop
Validation:
- `d148f62` Acquire CCheckQueue's lock to avoid race condition
@ -98,11 +101,14 @@ Tests:
Miscellaneous:
- `c9e022b` Initialization: set Boost path locale in main thread
- `23126a0` Sanitize command strings before logging them.
- `323de27` Initialization: setup environment before starting QT tests
- `7494e09` Initialization: setup environment before starting tests
- `df45564` Initialization: set fallback locale as environment variable
Credits
=======
Thanks to everyone who contributed to this release:
Thanks to everyone who directly contributed to this release:
- Alex Morcos
- Cory Fields
@ -111,11 +117,27 @@ Thanks to everyone who contributed to this release:
- Gavin Andresen
- Gregory Maxwell
- Ivan Pustogarov
- Jonas Nick
- Jonas Schnelli
- Matt Corallo
- mrbandrews
- Pieter Wuille
- Ruben de Vries
- Suhas Daftuar
- Wladimir J. van der Laan
And all those who contributed additional code review and/or security research:
- 21E14
- Alison Kendler
- Aviv Zohar
- Ethan Heilman
- Evil-Knievel
- fanquake
- Jeff Garzik
- Jonas Nick
- Luke Dashjr
- Patrick Strateman
- Philip Kaufmann
- Sergio Demian Lerner
- Sharon Goldberg
As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/).

View File

@ -67,9 +67,8 @@ double CAddrInfo::GetChance(int64_t nNow) const
if (nSinceLastTry < 60 * 10)
fChance *= 0.01;
// deprioritize 50% after each failed attempt
for (int n = 0; n < nAttempts; n++)
fChance /= 1.5;
// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
fChance *= pow(0.66, min(nAttempts, 8));
return fChance;
}

View File

@ -2325,10 +2325,6 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
pindexNew->nUndoPos = 0;
pindexNew->nStatus |= BLOCK_HAVE_DATA;
pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS);
{
LOCK(cs_nBlockSequenceId);
pindexNew->nSequenceId = nBlockSequenceId++;
}
setDirtyBlockIndex.insert(pindexNew);
if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) {
@ -2341,6 +2337,10 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
CBlockIndex *pindex = queue.front();
queue.pop_front();
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
{
LOCK(cs_nBlockSequenceId);
pindex->nSequenceId = nBlockSequenceId++;
}
if (chainActive.Tip() == NULL || !setBlockIndexCandidates.value_comp()(pindex, chainActive.Tip())) {
setBlockIndexCandidates.insert(pindex);
}
@ -3311,6 +3311,11 @@ void static CheckBlockIndex()
assert(pindex->GetBlockHash() == Params().HashGenesisBlock()); // Genesis block's hash must match.
assert(pindex == chainActive.Genesis()); // The current active chain's genesis block must be this block.
}
// HAVE_DATA is equivalent to VALID_TRANSACTIONS and equivalent to nTx > 0 (we stored the number of transactions in the block)
assert(!(pindex->nStatus & BLOCK_HAVE_DATA) == (pindex->nTx == 0));
assert(((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS) == (pindex->nTx > 0));
if (pindex->nChainTx == 0) assert(pindex->nSequenceId == 0); // nSequenceId can't be set for blocks that aren't linked
// All parents having data is equivalent to all parents being VALID_TRANSACTIONS, which is equivalent to nChainTx being set.
assert((pindexFirstMissing != NULL) == (pindex->nChainTx == 0)); // nChainTx == 0 is used to signal that all parent block's transaction data is available.
assert(pindex->nHeight == nHeight); // nHeight must be consistent.
assert(pindex->pprev == NULL || pindex->nChainWork >= pindex->pprev->nChainWork); // For every block except the genesis block, the chainwork must be larger than the parent's.

View File

@ -6,6 +6,7 @@
#include "config/bitcoin-config.h"
#endif
#include "util.h"
#include "uritests.h"
#ifdef ENABLE_WALLET
@ -27,6 +28,7 @@ Q_IMPORT_PLUGIN(qkrcodecs)
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
SetupEnvironment();
bool fInvalid = false;
// Don't remove this, it's needed to access

View File

@ -30,6 +30,7 @@ struct TestingSetup {
boost::thread_group threadGroup;
TestingSetup() {
SetupEnvironment();
fPrintToDebugLog = false; // don't want to write to debug.log file
fCheckBlockIndex = true;
SelectParams(CBaseChainParams::UNITTEST);

View File

@ -713,18 +713,19 @@ void RenameThread(const char* name)
void SetupEnvironment()
{
std::locale loc("C");
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// may be invalid, in which case the "C" locale is used as fallback.
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
try {
std::locale(""); // Raises a runtime error if current locale is invalid
loc = std::locale(""); // Raises a runtime error if current locale is invalid
} catch (const std::runtime_error&) {
std::locale::global(std::locale("C"));
setenv("LC_ALL", "C", 1);
}
#endif
// The path locale is lazy initialized and to avoid deinitialization errors
// in multithreading environments, it is set explicitly by the main thread.
boost::filesystem::path::imbue(std::locale());
boost::filesystem::path::imbue(loc);
}
void SetThreadPriority(int nPriority)