Skip to content

Commit

Permalink
fixing difficulty algo
Browse files Browse the repository at this point in the history
  • Loading branch information
bumbacoin committed Jun 28, 2018
1 parent ece80e1 commit 1b022f7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions configure.ac
@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 5)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
Expand Down
2 changes: 1 addition & 1 deletion contrib/macdeploy/macdeployqtplus
Expand Up @@ -714,7 +714,7 @@ elif config.sign:

# ------------------------------------------------

input('On some systems it may be useful to copy libboost_system-mt.dylib to the app file in dist folder now. Then press <ENTER> to continue')
input('On some systems it may be useful to copy libboost_system-mt.dylib to the app file frameworks folder in dist folder now. Then press <ENTER> to continue')


if config.dmg is not None:
Expand Down
4 changes: 2 additions & 2 deletions src/clientversion.h
Expand Up @@ -15,8 +15,8 @@

//! These need to be macros, as clientversion.cpp's and mirai*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 5
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
//bitcoingui.cpp L116
//! Set to true for release, false for prerelease or test build
Expand Down
9 changes: 7 additions & 2 deletions src/pow.cpp
Expand Up @@ -37,8 +37,13 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
uint256 bnTargetLimit = (~uint256(0) >> 20);

int64_t nTargetSpacing = Params().TargetSpacing();
int64_t nTargetTimespan = Params().TargetTimespan()*40;

int64_t nTargetTimespan;

// fix difficulty adjustment
if (pindexLast->nHeight <= 5400)
nTargetTimespan = Params().TargetTimespan()*40; // this is 40 days. currently breaking Diff adjustment
if (pindexLast->nHeight > 5400)
nTargetTimespan = 42 * 5 * 60; // ~42 blocks. the meaning of blockchain
int64_t nActualSpacing = 0;
if (pindexLast->nHeight != 0)
nActualSpacing = pindexLast->GetBlockTime() - pindexLast->pprev->GetBlockTime();
Expand Down
4 changes: 2 additions & 2 deletions src/spork.h
Expand Up @@ -53,8 +53,8 @@ using namespace boost;
#define SPORK_12_RECONSIDER_BLOCKS_DEFAULT 0
#define SPORK_13_ENABLE_SUPERBLOCKS_DEFAULT 4070908800 //OFF
#define SPORK_14_NEW_PROTOCOL_ENFORCEMENT_DEFAULT 4070908800 //OFF
#define SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2_DEFAULT 4070908800 // Age in seconds. This should be > MASTERNODE_REMOVAL_SECONDS to avoid
#define SPORK_16_MN_WINNER_MINIMUM_AGE_DEFAULT 1500 // misconfigured new nodes in the list.
#define SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2_DEFAULT 1530262800 // (GMT): Friday, June 29, 2018 9:00:00 AM disconnect older clients in preperation for difficulty algo adjustment
#define SPORK_16_MN_WINNER_MINIMUM_AGE_DEFAULT 1500 // Age in seconds. This should be > MASTERNODE_REMOVAL_SECONDS to avoid misconfigured new nodes in the list.
// Set this to zero to emulate classic behaviour
class CSporkMessage;
class CSporkManager;
Expand Down
6 changes: 3 additions & 3 deletions src/version.h
Expand Up @@ -12,7 +12,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 70718;
static const int PROTOCOL_VERSION = 70719;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand All @@ -22,15 +22,15 @@ static const int GETHEADERS_VERSION = 70077;

//! disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 70717;
static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70717;
static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70719;

//! nTime field added to CAddress, starting with this version;
//! if possible, avoid requesting addresses nodes older than this
static const int CADDR_TIME_VERSION = 31402;

//! only request blocks from nodes outside this range of versions
static const int NOBLKS_VERSION_START = 32000;
static const int NOBLKS_VERSION_END = 32400;
static const int NOBLKS_VERSION_END = 32400; // does nothing

//! BIP 0031, pong message, is enabled for all versions AFTER this one
static const int BIP0031_VERSION = 60000;
Expand Down

1 comment on commit 1b022f7

@bumbacoin
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the moment block time is very hard to predict, but we are working with the figure of around 200 blocks/day
this gives approximately 2 days until fork block.

new clients will reject older clients in approx 24 hours -- this commit has wrong time, so next commit sets time back to 6pm june 29.gmt

Please sign in to comment.