Merge remote-tracking branch 'bitcoin/0.12' into mergebtc0.12

This commit is contained in:
UdjinM6 2016-02-21 04:09:11 +03:00
commit 6ec64f8ff6
8 changed files with 48 additions and 21 deletions

View File

@ -1,8 +1,8 @@
Release Process Release Process
==================== ====================
* update translations (ping wumpus, Diapolo or tcatm on IRC) * Update translations, see [translation_process.md](https://github.com/dashpay/dash/blob/master/doc/translation_process.md#syncing-with-transifex)
* see https://github.com/dashpay/dash/blob/master/doc/translation_process.md#syncing-with-transifex * Update hardcoded [seeds](/contrib/seeds)
* * * * * *
@ -19,8 +19,10 @@ Check out the source code in the following directory hierarchy.
pushd ./dash pushd ./dash
contrib/verifysfbinaries/verify.sh contrib/verifysfbinaries/verify.sh
configure.ac
doc/README* doc/README*
share/setup.nsi doc/Doxyfile
contrib/gitian-descriptors/*.yml
src/clientversion.h (change CLIENT_VERSION_IS_RELEASE to true) src/clientversion.h (change CLIENT_VERSION_IS_RELEASE to true)
# tag version in git # tag version in git
@ -40,8 +42,8 @@ Check out the source code in the following directory hierarchy.
pushd ./dash pushd ./dash
export SIGNER=(your Gitian key, ie bluematt, sipa, etc) export SIGNER=(your Gitian key, ie bluematt, sipa, etc)
export VERSION=(new version, e.g. 0.8.0) export VERSION=(new version, e.g. 0.8.0)
git fetch
git checkout v${VERSION} git checkout v${VERSION}
popd popd
@ -84,22 +86,19 @@ NOTE: Offline builds must use the --url flag to ensure Gitian fetches only from
``` ```
The gbuild invocations below <b>DO NOT DO THIS</b> by default. The gbuild invocations below <b>DO NOT DO THIS</b> by default.
###Build (and optionally verify) Dash Core for Linux, Windows, and OS X: ###Build and sign Dash Core for Linux, Windows, and OS X:
./bin/gbuild --commit dash=v${VERSION} ../dash/contrib/gitian-descriptors/gitian-linux.yml ./bin/gbuild --commit dash=v${VERSION} ../dash/contrib/gitian-descriptors/gitian-linux.yml
./bin/gsign --signer $SIGNER --release ${VERSION}-linux --destination ../gitian.sigs/ ../dash/contrib/gitian-descriptors/gitian-linux.yml ./bin/gsign --signer $SIGNER --release ${VERSION}-linux --destination ../gitian.sigs/ ../dash/contrib/gitian-descriptors/gitian-linux.yml
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-linux ../dash/contrib/gitian-descriptors/gitian-linux.yml
mv build/out/dash-*.tar.gz build/out/src/dash-*.tar.gz ../ mv build/out/dash-*.tar.gz build/out/src/dash-*.tar.gz ../
./bin/gbuild --commit bitcoin=v${VERSION} ../dash/contrib/gitian-descriptors/gitian-win.yml ./bin/gbuild --commit bitcoin=v${VERSION} ../dash/contrib/gitian-descriptors/gitian-win.yml
./bin/gsign --signer $SIGNER --release ${VERSION}-win-unsigned --destination ../gitian.sigs/ ../dash/contrib/gitian-descriptors/gitian-win.yml ./bin/gsign --signer $SIGNER --release ${VERSION}-win-unsigned --destination ../gitian.sigs/ ../dash/contrib/gitian-descriptors/gitian-win.yml
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-win-unsigned ../dash/contrib/gitian-descriptors/gitian-win.yml
mv build/out/dash-*-win-unsigned.tar.gz inputs/dash-win-unsigned.tar.gz mv build/out/dash-*-win-unsigned.tar.gz inputs/dash-win-unsigned.tar.gz
mv build/out/dash-*.zip build/out/dash-*.exe ../ mv build/out/dash-*.zip build/out/dash-*.exe ../
./bin/gbuild --commit bitcoin=v${VERSION} ../dash/contrib/gitian-descriptors/gitian-osx.yml ./bin/gbuild --commit bitcoin=v${VERSION} ../dash/contrib/gitian-descriptors/gitian-osx.yml
./bin/gsign --signer $SIGNER --release ${VERSION}-osx-unsigned --destination ../gitian.sigs/ ../dash/contrib/gitian-descriptors/gitian-osx.yml ./bin/gsign --signer $SIGNER --release ${VERSION}-osx-unsigned --destination ../gitian.sigs/ ../dash/contrib/gitian-descriptors/gitian-osx.yml
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-unsigned ../dash/contrib/gitian-descriptors/gitian-osx.yml
mv build/out/dash-*-osx-unsigned.tar.gz inputs/dash-osx-unsigned.tar.gz mv build/out/dash-*-osx-unsigned.tar.gz inputs/dash-osx-unsigned.tar.gz
mv build/out/dash-*.tar.gz build/out/dash-*.dmg ../ mv build/out/dash-*.tar.gz build/out/dash-*.dmg ../
popd popd
@ -112,6 +111,20 @@ The gbuild invocations below <b>DO NOT DO THIS</b> by default.
4. OS X unsigned installer and dist tarball (dash-${VERSION}-osx-unsigned.dmg, dash-${VERSION}-osx64.tar.gz) 4. OS X unsigned installer and dist tarball (dash-${VERSION}-osx-unsigned.dmg, dash-${VERSION}-osx64.tar.gz)
5. Gitian signatures (in gitian.sigs/${VERSION}-<linux|{win,osx}-unsigned>/(your Gitian key)/ 5. Gitian signatures (in gitian.sigs/${VERSION}-<linux|{win,osx}-unsigned>/(your Gitian key)/
###Verify other gitian builders signatures to your own. (Optional)
Add other gitian builders keys to your gpg keyring
gpg --import ../dash/contrib/gitian-downloader/*.pgp
Verify the signatures
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-linux ../dash/contrib/gitian-descriptors/gitian-linux.yml
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-win-unsigned ../dash/contrib/gitian-descriptors/gitian-win.yml
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-unsigned ../dash/contrib/gitian-descriptors/gitian-osx.yml
popd
###Next steps: ###Next steps:
Commit your signature to gitian.sigs: Commit your signature to gitian.sigs:
@ -125,7 +138,6 @@ Commit your signature to gitian.sigs:
popd popd
Wait for Windows/OS X detached signatures: Wait for Windows/OS X detached signatures:
Once the Windows/OS X builds each have 3 matching signatures, they will be signed with their respective release keys. Once the Windows/OS X builds each have 3 matching signatures, they will be signed with their respective release keys.
Detached signatures will then be committed to the [dash-detached-sigs](https://github.com/dashpay/dash-detached-sigs) repository, which can be combined with the unsigned apps to create signed binaries. Detached signatures will then be committed to the [dash-detached-sigs](https://github.com/dashpay/dash-detached-sigs) repository, which can be combined with the unsigned apps to create signed binaries.

View File

@ -536,7 +536,7 @@ class CBlock(CBlockHeader):
return True return True
def solve(self): def solve(self):
self.calc_sha256() self.rehash()
target = uint256_from_compact(self.nBits) target = uint256_from_compact(self.nBits)
while self.sha256 > target: while self.sha256 > target:
self.nNonce += 1 self.nNonce += 1

View File

@ -17,6 +17,9 @@
#include <boost/algorithm/string.hpp> // boost::trim #include <boost/algorithm/string.hpp> // boost::trim
#include <boost/foreach.hpp> //BOOST_FOREACH #include <boost/foreach.hpp> //BOOST_FOREACH
/** WWW-Authenticate to present with 401 Unauthorized response */
static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\"";
/** Simple one-shot callback timer to be used by the RPC mechanism to e.g. /** Simple one-shot callback timer to be used by the RPC mechanism to e.g.
* re-lock the wellet. * re-lock the wellet.
*/ */
@ -147,6 +150,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
// Check authorization // Check authorization
std::pair<bool, std::string> authHeader = req->GetHeader("authorization"); std::pair<bool, std::string> authHeader = req->GetHeader("authorization");
if (!authHeader.first) { if (!authHeader.first) {
req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
req->WriteReply(HTTP_UNAUTHORIZED); req->WriteReply(HTTP_UNAUTHORIZED);
return false; return false;
} }
@ -159,6 +163,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
shouldn't have their RPC port exposed. */ shouldn't have their RPC port exposed. */
MilliSleep(250); MilliSleep(250);
req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
req->WriteReply(HTTP_UNAUTHORIZED); req->WriteReply(HTTP_UNAUTHORIZED);
return false; return false;
} }

View File

@ -344,8 +344,10 @@ void FinalizeNode(NodeId nodeid) {
AddressCurrentlyConnected(state->address); AddressCurrentlyConnected(state->address);
} }
BOOST_FOREACH(const QueuedBlock& entry, state->vBlocksInFlight) BOOST_FOREACH(const QueuedBlock& entry, state->vBlocksInFlight) {
nQueuedValidatedHeaders -= entry.fValidatedHeaders;
mapBlocksInFlight.erase(entry.hash); mapBlocksInFlight.erase(entry.hash);
}
EraseOrphansFor(nodeid); EraseOrphansFor(nodeid);
nPreferredDownload -= state->fPreferredDownload; nPreferredDownload -= state->fPreferredDownload;
@ -2475,7 +2477,7 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
return AbortNode(state, "Failed to write to coin database"); return AbortNode(state, "Failed to write to coin database");
nLastFlush = nNow; nLastFlush = nNow;
} }
if ((mode == FLUSH_STATE_ALWAYS || mode == FLUSH_STATE_PERIODIC) && nNow > nLastSetChain + (int64_t)DATABASE_WRITE_INTERVAL * 1000000) { if (fDoFullFlush || ((mode == FLUSH_STATE_ALWAYS || mode == FLUSH_STATE_PERIODIC) && nNow > nLastSetChain + (int64_t)DATABASE_WRITE_INTERVAL * 1000000)) {
// Update best block in wallet (so we can detect restored wallets). // Update best block in wallet (so we can detect restored wallets).
GetMainSignals().SetBestChain(chainActive.GetLocator()); GetMainSignals().SetBestChain(chainActive.GetLocator());
nLastSetChain = nNow; nLastSetChain = nNow;

View File

@ -299,7 +299,7 @@ public:
{ {
switch (banReason) { switch (banReason) {
case BanReasonNodeMisbehaving: case BanReasonNodeMisbehaving:
return "node misbehabing"; return "node misbehaving";
case BanReasonManuallyAdded: case BanReasonManuallyAdded:
return "manually added"; return "manually added";
default: default:

View File

@ -75,7 +75,7 @@ UniValue GetNetworkHashPS(int lookup, int height) {
arith_uint256 workDiff = pb->nChainWork - pb0->nChainWork; arith_uint256 workDiff = pb->nChainWork - pb0->nChainWork;
int64_t timeDiff = maxTime - minTime; int64_t timeDiff = maxTime - minTime;
return (int64_t)(workDiff.getdouble() / timeDiff); return workDiff.getdouble() / timeDiff;
} }
UniValue getnetworkhashps(const UniValue& params, bool fHelp) UniValue getnetworkhashps(const UniValue& params, bool fHelp)

View File

@ -165,7 +165,10 @@ bool static IsLowDERSignature(const valtype &vchSig, ScriptError* serror) {
return set_error(serror, SCRIPT_ERR_SIG_DER); return set_error(serror, SCRIPT_ERR_SIG_DER);
} }
std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1); std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1);
return CPubKey::CheckLowS(vchSigCopy); if (!CPubKey::CheckLowS(vchSigCopy)) {
return set_error(serror, SCRIPT_ERR_SIG_HIGH_S);
}
return true;
} }
bool static IsDefinedHashtypeSignature(const valtype &vchSig) { bool static IsDefinedHashtypeSignature(const valtype &vchSig) {

View File

@ -927,14 +927,19 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
{ {
LOCK2(cs_main, cs_wallet); LOCK2(cs_main, cs_wallet);
CBlockIndex* pindex;
assert(mapBlockIndex.count(hashBlock));
pindex = mapBlockIndex[hashBlock];
int conflictconfirms = 0; int conflictconfirms = 0;
if (mapBlockIndex.count(hashBlock)) {
CBlockIndex* pindex = mapBlockIndex[hashBlock];
if (chainActive.Contains(pindex)) { if (chainActive.Contains(pindex)) {
conflictconfirms = -(chainActive.Height() - pindex->nHeight + 1); conflictconfirms = -(chainActive.Height() - pindex->nHeight + 1);
} }
assert(conflictconfirms < 0); }
// If number of conflict confirms cannot be determined, this means
// that the block is still unknown or not yet part of the main chain,
// for example when loading the wallet during a reindex. Do nothing in that
// case.
if (conflictconfirms >= 0)
return;
// Do not flush the wallet here for performance reasons // Do not flush the wallet here for performance reasons
CWalletDB walletdb(strWalletFile, "r+", false); CWalletDB walletdb(strWalletFile, "r+", false);