Skip to content

Commit b1d95b2

Browse files
authored
Merge pull request #8 from ShieldCoin/develop
Hardfork planned for block 370000
2 parents 13a44f5 + 61f7e71 commit b1d95b2

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
22
AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 2)
4-
define(_CLIENT_VERSION_MINOR, 1)
4+
define(_CLIENT_VERSION_MINOR, 3)
55
define(_CLIENT_VERSION_REVISION, 0)
66
define(_CLIENT_VERSION_BUILD, 0)
77
define(_CLIENT_VERSION_IS_RELEASE, true)
8-
define(_COPYRIGHT_YEAR, 2016)
8+
define(_COPYRIGHT_YEAR, 2017)
99
AC_INIT([SHIELD Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/ShieldCoin/shield/issues],[SHIELD],[http://ShieldCoin.github.io/])
1010
AC_CONFIG_AUX_DIR([src/build-aux])
1111
AC_CONFIG_MACRO_DIR([src/m4])

src/clientversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
1111
#define CLIENT_VERSION_MAJOR 2
12-
#define CLIENT_VERSION_MINOR 2
12+
#define CLIENT_VERSION_MINOR 3
1313
#define CLIENT_VERSION_REVISION 0
1414
#define CLIENT_VERSION_BUILD 0
1515

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ bool AppInit2()
622622
struct in_addr inaddr_any;
623623
inaddr_any.s_addr = INADDR_ANY;
624624
fBound |= Bind(CService(in6addr_any, GetListenPort()), BF_NONE);
625-
fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE);
625+
fBound |= Bind(CService(inaddr_any, GetListenPort()), (!fBound) ? (BF_REPORT_ERROR & 0x01) : BF_NONE);//FIXME: test if it works
626626
}
627627
if (!fBound)
628628
return InitError(_("Failed to listen on any port. Use -listen=0 if you want this."));

src/main.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
4949
unsigned int nStakeMinAge = 10000 * 10000; // minimum age disabled
5050
unsigned int nStakeMaxAge = 10000 * 10000; // stake max age disabled
5151
unsigned int nStakeTargetSpacing = 30; // 30 seconds POS block spacing
52-
unsigned int nProofOfWorkTargetSpacing = 15; // 30 seconds PoW block spacing
52+
//unsigned int nProofOfWorkTargetSpacing = 15; // 30 seconds PoW block spacing
5353

5454
int64 nChainStartTime = 1507311620;
5555
int nCoinbaseMaturity = 240;
@@ -1088,7 +1088,7 @@ void avgRecentTimestamps(const CBlockIndex* pindexLast, int64_t *avgOf5, int64_t
10881088
}
10891089
else
10901090
{ // genesis block or previous
1091-
blocktime -= nProofOfWorkTargetSpacing;
1091+
blocktime -= GetTargetSpacing(pindexLast->nHeight);
10921092
}
10931093
// for each block, add interval.
10941094
if (blockoffset < 5) *avgOf5 += (oldblocktime - blocktime);
@@ -1116,8 +1116,8 @@ unsigned int GetNextTargetRequired_V2(const CBlockIndex* pindexLast, bool fProof
11161116
int64_t now;
11171117
int64_t BlockHeightTime;
11181118

1119-
int64_t nFastInterval = (nProofOfWorkTargetSpacing * 9 ) / 10; // seconds per block desired when far behind schedule
1120-
int64_t nSlowInterval = (nProofOfWorkTargetSpacing * 11) / 10; // seconds per block desired when far ahead of schedule
1119+
int64_t nFastInterval = (GetTargetSpacing(pindexLast->nHeight) * 9 ) / 10; // seconds per block desired when far behind schedule
1120+
int64_t nSlowInterval = (GetTargetSpacing(pindexLast->nHeight) * 11) / 10; // seconds per block desired when far ahead of schedule
11211121
int64_t nIntervalDesired;
11221122

11231123

@@ -1136,15 +1136,15 @@ unsigned int GetNextTargetRequired_V2(const CBlockIndex* pindexLast, bool fProof
11361136

11371137
now = pindexLast->GetBlockTime();
11381138

1139-
BlockHeightTime = pindexGenesisBlock->nTime + pindexLast->nHeight * nProofOfWorkTargetSpacing;
1139+
BlockHeightTime = pindexGenesisBlock->nTime + pindexLast->nHeight * GetTargetSpacing(pindexLast->nHeight);
11401140

11411141
if (now < BlockHeightTime + nTargetTimespan && now > BlockHeightTime )
11421142
// ahead of schedule by less than one interval.
1143-
nIntervalDesired = ((nTargetTimespan - (now - BlockHeightTime)) * nProofOfWorkTargetSpacing +
1144-
(now - BlockHeightTime) * nFastInterval) / nProofOfWorkTargetSpacing;
1143+
nIntervalDesired = ((nTargetTimespan - (now - BlockHeightTime)) * GetTargetSpacing(pindexLast->nHeight) +
1144+
(now - BlockHeightTime) * nFastInterval) / GetTargetSpacing(pindexLast->nHeight);
11451145
else if (now + nTargetTimespan > BlockHeightTime && now < BlockHeightTime)
11461146
// behind schedule by less than one interval.
1147-
nIntervalDesired = ((nTargetTimespan - (BlockHeightTime - now)) * nProofOfWorkTargetSpacing +
1147+
nIntervalDesired = ((nTargetTimespan - (BlockHeightTime - now)) * GetTargetSpacing(pindexLast->nHeight) +
11481148
(BlockHeightTime - now) * nSlowInterval) / nTargetTimespan;
11491149

11501150
// ahead by more than one interval;
@@ -1212,7 +1212,7 @@ unsigned int GetNextTargetRequired_V2(const CBlockIndex* pindexLast, bool fProof
12121212

12131213
printf("difficulty: ctual time %" PRId64 ", Scheduled time for this block height = %" PRId64 "\n", now, BlockHeightTime );
12141214
printf("difficulty: Nominal block interval = %u, regulating on interval %" PRId64 " to get back to schedule.\n",
1215-
nProofOfWorkTargetSpacing, nIntervalDesired );
1215+
GetTargetSpacing(pindexLast->nHeight), nIntervalDesired );
12161216
printf("difficulty: Intervals of last 5/7/9/17 blocks = %" PRId64 "/ %" PRId64 " / %" PRId64 " / %" PRId64 ".\n",
12171217
avgOf5, avgOf7, avgOf9, avgOf17);
12181218
printf("difficulty: Difficulty Before Adjustment: %u %s\n", pindexLast->nBits, bnOld.ToString().c_str());
@@ -1361,7 +1361,7 @@ unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfS
13611361
{
13621362
return GetNextTargetRequired_V2(pindexLast, fProofOfStake, algo);
13631363
}
1364-
return DarkGravityWave3(pindexLast, nProofOfWorkTargetSpacing, algo);//Then DarkGravityWave3
1364+
return DarkGravityWave3(pindexLast, GetTargetSpacing(pindexLast->nHeight), algo);//Then DarkGravityWave3
13651365
}
13661366

13671367

src/main.h

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,21 @@ enum
155155
BLOCK_VERSION_LYRA2RE = (10 << 11),
156156
};
157157

158+
inline int GetTargetSpacing(int Height=nBestHeight, bool fProofOfStake=false)
159+
{
160+
if(fProofOfStake){
161+
return 45;
162+
}
163+
else
164+
{
165+
if (Height < 370000){
166+
return 15;//15/5 = 3sec
167+
}else{
168+
return 225;//225/5 = 45sec
169+
}
170+
}
171+
}
172+
158173
inline int GetAlgo(int nVersion)
159174
{
160175
switch (nVersion & BLOCK_VERSION_ALGO)
@@ -165,10 +180,10 @@ inline int GetAlgo(int nVersion)
165180
return ALGO_GROESTL;
166181
case BLOCK_VERSION_LYRA2RE:
167182
return ALGO_LYRA2RE;
168-
case BLOCK_VERSION_X17:
169-
return ALGO_X17;
170-
case BLOCK_VERSION_BLAKE:
171-
return ALGO_BLAKE;
183+
case BLOCK_VERSION_X17:
184+
return ALGO_X17;
185+
case BLOCK_VERSION_BLAKE:
186+
return ALGO_BLAKE;
172187
}
173188
return ALGO_SCRYPT;
174189
}
@@ -183,10 +198,10 @@ inline std::string GetAlgoName(int Algo)
183198
return std::string("groestl");
184199
case ALGO_LYRA2RE:
185200
return std::string("lyra2re");
186-
case ALGO_BLAKE:
187-
return std::string("blake");
188-
case ALGO_X17:
189-
return std::string("x17");
201+
case ALGO_BLAKE:
202+
return std::string("blake");
203+
case ALGO_X17:
204+
return std::string("x17");
190205

191206
}
192207
return std::string("unknown");

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static const int DATABASE_VERSION = 70509;
2626
// network protocol versioning
2727
//
2828

29-
static const int PROTOCOL_VERSION = 90004;
29+
static const int PROTOCOL_VERSION = 90005;
3030

3131
// clients with smaller version number are disconnected
3232
static const int MIN_PROTO_VERSION = 90002;

0 commit comments

Comments
 (0)