Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
fix drift bug
Browse files Browse the repository at this point in the history
  • Loading branch information
krilson committed Aug 1, 2017
1 parent 7bddd36 commit 58a68f7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aquariuscoin-qt.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = aquariuscoin-qt
VERSION = 2.0.0
VERSION = 2.0.1
INCLUDEPATH += src src/json src/qt
QT += network
DEFINES += ENABLE_WALLET
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Expand Up @@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 0

// Set to true for release, false for prerelease or test build
Expand Down
13 changes: 10 additions & 3 deletions src/main.cpp
Expand Up @@ -2008,9 +2008,16 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
return DoS(50, error("CheckBlock() : proof of work failed"));

// Check timestamp
if (GetBlockTime() > FutureDriftV1(GetAdjustedTime()))
return error("CheckBlock() : block timestamp too far in the future");

if (IsProtocolV4(nTime))
{
if (GetBlockTime() > (FutureDriftV2(GetAdjustedTime())))
return error("CheckBlock() : block timestamp too far in the future");
}
else
{
if (GetBlockTime() > (FutureDriftV1(GetAdjustedTime())))
return error("CheckBlock() : block timestamp too far in the future");
}
// First transaction must be coinbase, the rest must not be
if (vtx.empty() || !vtx[0].IsCoinBase())
return DoS(100, error("CheckBlock() : first tx is not coinbase"));
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Expand Up @@ -58,6 +58,7 @@ static const int64_t COIN_YEAR_REWARD2 = 6 * CENT; // fork at block 70000 = IsR
inline bool IsRewardHF(int nHeight) { return TestNet() || nHeight > 70000; } // initialize fixed 1 COIN (with halving) + 6% reward
inline bool IsProtocolV2(int nHeight) { return TestNet() || nHeight > 589289; } // 589289 ARCO HardFork to v2 Protocol
inline bool IsProtocolV3(int64_t nTime) { return TestNet() || nTime > 1489900000; } // 1489900000 GMT: Sun, 19 Mar 2017 05:06:40 GMT
inline bool IsProtocolV4(int64_t nTime) { return TestNet() || nTime > 1501700400; } // future drift fix, (GMT): Wednesday, August 2, 2017 7:00:00 PM

inline int64_t FutureDriftV1(int64_t nTime) { return nTime + 10 * 60; }
inline int64_t FutureDriftV2(int64_t nTime) { return nTime + 15; }
Expand Down
4 changes: 2 additions & 2 deletions src/version.h
Expand Up @@ -30,13 +30,13 @@ static const int DATABASE_VERSION = 70510;
// network protocol versioning
//

static const int PROTOCOL_VERSION = 60015;
static const int PROTOCOL_VERSION = 60016;

// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;

// disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 60014;
static const int MIN_PEER_PROTO_VERSION = 60015;

// nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this
Expand Down

0 comments on commit 58a68f7

Please sign in to comment.