From 8e172149f632cdcb7944b563c2f0e5819b8abbf9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 8 Jan 2019 23:19:28 -1100 Subject: [PATCH 1/6] Add context check in connectTip --- src/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 20f28d46a..8dcd3cc10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3170,6 +3170,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin //fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock); return false; } + if ( fCheckPOW != 0 && pindex->nTime > 1548979200 && !ContextualCheckBlock(block, state, pindex->pprev) ) // activate check Feb 1, 2019 + { + fprintf(stderr,"ContextualCheckBlock failed ht.%d\n",(int32_t)pindex->GetHeight()); + return false; + } // verify that the view's current state corresponds to the previous block uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash(); From cb64a2dc5673b7e9d94704fdd34013ebbdabf669 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 8 Jan 2019 23:20:34 -1100 Subject: [PATCH 2/6] Activate jan 15th --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 8dcd3cc10..861fb7eab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3170,7 +3170,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin //fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock); return false; } - if ( fCheckPOW != 0 && pindex->nTime > 1548979200 && !ContextualCheckBlock(block, state, pindex->pprev) ) // activate check Feb 1, 2019 + if ( fCheckPOW != 0 && pindex->nTime > 1547510400 && !ContextualCheckBlock(block, state, pindex->pprev) ) // activate check Jan 15, 2019 { fprintf(stderr,"ContextualCheckBlock failed ht.%d\n",(int32_t)pindex->GetHeight()); return false; From 0e49163d4af4fba54bce04c47e21c8d2e9cb2067 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 Jan 2019 00:04:30 -1100 Subject: [PATCH 3/6] Jan 15th activation of stricter block checks --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 861fb7eab..fe6fb4030 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3170,10 +3170,12 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin //fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock); return false; } - if ( fCheckPOW != 0 && pindex->nTime > 1547510400 && !ContextualCheckBlock(block, state, pindex->pprev) ) // activate check Jan 15, 2019 + if ( fCheckPOW != 0 && !ContextualCheckBlock(block, state, pindex->pprev) ) // Activate Jan 15th, 2019 { fprintf(stderr,"ContextualCheckBlock failed ht.%d\n",(int32_t)pindex->GetHeight()); - return false; + if ( pindex->nTime > 1547510400 ) + return false; + fprintf(stderr,"grandfathered exception, until jan 15th 2019\n"); } // verify that the view's current state corresponds to the previous block From 8a5f7bdf6a35a967c0fad805424a500ce3a8aad4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 Jan 2019 00:05:22 -1100 Subject: [PATCH 4/6] Version 0.3.3b --- src/rpc/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 323540790..e29abc60e 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -56,7 +56,7 @@ extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t komodo_segid32(char *coinaddr); int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height); int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); -#define KOMODO_VERSION "0.3.3" +#define KOMODO_VERSION "0.3.3b" #define VERUS_VERSION "0.4.0g" extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; From 1f46aa58e6913856f4a921305329b407d3af28fc Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 Jan 2019 01:26:25 -1100 Subject: [PATCH 5/6] Allow tunable maxreorg --- src/komodo_utils.h | 1 + src/main.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 19941a172..aa887bba3 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1701,6 +1701,7 @@ void komodo_args(char *argv0) } } KOMODO_STOPAT = GetArg("-stopat",0); + MAX_REORG_LENGTH = GetArg("-maxreorg",MAX_REORG_LENGTH); ASSETCHAINS_CC = GetArg("-ac_cc",0); KOMODO_CCACTIVATE = GetArg("-ac_ccactivate",0); ASSETCHAINS_PUBLIC = GetArg("-ac_public",0); diff --git a/src/main.h b/src/main.h index fdd9fcae8..775b31eb6 100644 --- a/src/main.h +++ b/src/main.h @@ -63,7 +63,7 @@ static const bool DEFAULT_ALERTS = true; /** Minimum alert priority for enabling safe mode. */ static const int ALERT_PRIORITY_SAFE_MODE = 4000; /** Maximum reorg length we will accept before we shut down and alert the user. */ -static const unsigned int MAX_REORG_LENGTH = _COINBASE_MATURITY - 1; +static unsigned int MAX_REORG_LENGTH = _COINBASE_MATURITY - 1; /** Maximum number of signature check operations in an IsStandard() P2SH script */ static const unsigned int MAX_P2SH_SIGOPS = 15; /** The maximum number of sigops we're willing to relay/mine in a single tx */ From ba1b2b5c5674af96051eb7a22ce86d1b707566d7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 Jan 2019 01:43:10 -1100 Subject: [PATCH 6/6] -Static assert --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index fe6fb4030..3d2f19b55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4078,7 +4078,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo // then pindexFork will be null, and we would need to remove the entire chain including // our genesis block. In practice this (probably) won't happen because of checks elsewhere. auto reorgLength = pindexOldTip ? pindexOldTip->GetHeight() - (pindexFork ? pindexFork->GetHeight() : -1) : 0; - static_assert(MAX_REORG_LENGTH > 0, "We must be able to reorg some distance"); + assert(MAX_REORG_LENGTH > 0);//, "We must be able to reorg some distance"); if (reorgLength > MAX_REORG_LENGTH) { int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid;