Skip to content

Commit

Permalink
Minor changes to testnet city hash calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlg-buildbot committed Nov 29, 2017
1 parent eca5a5a commit de68c0a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 6)
define(_CLIENT_VERSION_REVISION, 4)
define(_CLIENT_VERSION_BUILD, 6)
define(_CLIENT_VERSION_BUILD, 7)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2016)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
4 changes: 1 addition & 3 deletions src/Gulden/Common/diff_common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015-2017 The Gulden developers
// Copyright (c) 2015-2016 The Gulden developers
// Authored by: Malcolm MacLeod ([email protected])
// Distributed under the GULDEN software license, see the accompanying
// file COPYING
Expand All @@ -13,7 +13,6 @@
#define BLOCK_TIME(block) block.getTimeSeconds()
#define INDEX_TYPE StoredBlock
#define INDEX_HEIGHT(block) block.getHeight()
//fixme: (GULDEN) (2.0)
#define INDEX_TIME(block) block.getHeader().getTimeSeconds()
#define INDEX_PREV(block) blockStore.get(block.getHeader().getPrevBlockHash())
#define INDEX_TARGET(block) block.getHeader().getDifficultyTarget()
Expand All @@ -34,7 +33,6 @@
#define BLOCK_TIME(block) (int64_t) block.timestamp
#define INDEX_TYPE BRMerkleBlock *
#define INDEX_HEIGHT(block) block.height

#define INDEX_TIME(block) (int64_t) block.timestamp
#define INDEX_PREV(block) [[BRPeerManager sharedInstance] blockForHash:(block.prevBlock)]
#define INDEX_TARGET(block) block.target
Expand Down
11 changes: 5 additions & 6 deletions src/Gulden/Common/diff_delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public

static int64_t nPrevHeight = 0;
static int64_t nPrevDifficulty = 0;
static bool debugLogging = false;

std::string sLogInfo;
#endif
Expand Down Expand Up @@ -166,7 +165,7 @@ public
if ((nQBTimespan > nBadTimeLimit) && (nQBTimespan < nQBMinGap) && (nLBTimespan < nRetargetTimespan * 40 / PERCENT_FACTOR)) {
#ifndef __JAVA__
#ifndef BUILD_IOS
if (debugLogging && (nPrevHeight != INDEX_HEIGHT(pindexLast)))
if (fDebug && (nPrevHeight != INDEX_HEIGHT(pindexLast)))
sLogInfo += "<DELTA> Multiple fast blocks - ignoring long and medium weightings.\n";
#endif
#endif
Expand Down Expand Up @@ -211,15 +210,15 @@ public
bnNew = BIGINT_DIVIDE(bnNew, arith_uint256(PERCENT_FACTOR));
#ifndef __JAVA__
#ifndef BUILD_IOS
if (debugLogging && (nPrevHeight != INDEX_HEIGHT(pindexLast)))
if (fDebug && (nPrevHeight != INDEX_HEIGHT(pindexLast)))
sLogInfo += strprintf("<DELTA> Last block time [%ld] was far below target but adjustment still downward, forcing difficulty up by 5%% instead\n", nLBTimespan);
#endif
#endif
} else {
SET_COMPACT(bnNew, INDEX_TARGET(pindexLast));
#ifndef __JAVA__
#ifndef BUILD_IOS
if (debugLogging && (nPrevHeight != INDEX_HEIGHT(pindexLast)))
if (fDebug && (nPrevHeight != INDEX_HEIGHT(pindexLast)))
sLogInfo += strprintf("<DELTA> Last block time [%ld] below target but adjustment still downward, blocking downward adjustment\n", nLBTimespan);
#endif
#endif
Expand All @@ -236,7 +235,7 @@ public

#ifndef __JAVA__
#ifndef BUILD_IOS
if (debugLogging && (nPrevHeight != INDEX_HEIGHT(pindexLast) || GET_COMPACT(bnNew) != nPrevDifficulty))
if (fDebug && (nPrevHeight != INDEX_HEIGHT(pindexLast) || GET_COMPACT(bnNew) != nPrevDifficulty))
sLogInfo += strprintf("<DELTA> Maximum block time hit - halving difficulty %08x %s\n", GET_COMPACT(bnNew), bnNew.ToString().c_str());
#endif
#endif
Expand All @@ -248,7 +247,7 @@ public

#ifndef BUILD_IOS
#ifndef __JAVA__
if (debugLogging) {
if (fDebug) {
if (nPrevHeight != INDEX_HEIGHT(pindexLast) || GET_COMPACT(bnNew) != nPrevDifficulty) {
static CCriticalSection logCS;
LOCK(logCS);
Expand Down
3 changes: 1 addition & 2 deletions src/Gulden/Common/diff_old.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015-2017 The Gulden developers
// Copyright (c) 2015-2016 The Gulden developers
// Authored by: Malcolm MacLeod ([email protected])
// Distributed under the GULDEN software license, see the accompanying
// file COPYING
Expand Down Expand Up @@ -43843,7 +43843,6 @@ public
nRet = (unsigned int)udiff[nHeight];
#ifndef __JAVA__
#ifndef BUILD_IOS
static bool fDebug = false;
if (fDebug) {
static CCriticalSection logCS;
LOCK(logCS);
Expand Down
2 changes: 1 addition & 1 deletion src/Gulden/Common/hash/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inline void hash_city(const void* pData, arith_uint256& thash)
thash <<= 64;
thash |= temphash.second;
thash <<= 64;
temphash = CityHash128((char*)&thash, 80);
temphash = CityHash128((char*)ArithToUint256(thash).begin(), 32);
thash |= temphash.first;
thash <<= 64;
thash |= temphash.second;
Expand Down
10 changes: 6 additions & 4 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,19 @@ class CTestNetParams : public CChainParams {
genesis.nTime++;
}
consensus.hashGenesisBlock = genesis.GetHash();
printf("genesis nonce: %d\n", genesis.nNonce);
printf("genesis time: %d\n", genesis.nTime);
printf("genesis bits: %d\n", genesis.nBits);
printf("genesis hash: %s\n", consensus.hashGenesisBlock.ToString().c_str());

pchMessageStart[0] = targetInterval;
pchMessageStart[3] = sTestnetParams[0];
pchMessageStart[1] = seedTimestamp >> 8;
pchMessageStart[2] = seedTimestamp >> 16;
vAlertPubKey = ParseHex("06087071e40ddf2ecbdf1ae40f536fa8f78e9383006c710dd3ecce957a3cb9292038d0840e3be5042a6b863f75dfbe1cae8755a0f7887ae459af689f66caacab52");

printf("genesis nonce: %d\n", genesis.nNonce);
printf("genesis time: %d\n", genesis.nTime);
printf("genesis bits: %d\n", genesis.nBits);
printf("genesis hash: %s\n", consensus.hashGenesisBlock.ToString().c_str());
printf("pchMessageStart [%d %d %d %d]\n", pchMessageStart[0], pchMessageStart[1], pchMessageStart[2], pchMessageStart[3]);

checkpointData = (CCheckpointData){
boost::assign::map_list_of(0, genesis.GetHash()),
seedTimestamp,
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 6
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_BUILD 6
#define CLIENT_VERSION_BUILD 7

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE false
Expand Down

0 comments on commit de68c0a

Please sign in to comment.