From 2d44c20272cba4d922943182749c822386505963 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 27 Aug 2018 09:31:56 -1100 Subject: [PATCH 1/5] Mempool CC test --- src/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 85de0effa..e27738e04 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1530,18 +1530,20 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // XXX: is this neccesary for CryptoConditions? if ( KOMODO_CONNECTING <= 0 && chainActive.LastTip() != 0 ) { - flag = 1; + //flag = 1; KOMODO_CONNECTING = (1<<30) + (int32_t)chainActive.LastTip()->nHeight + 1; } if (!ContextualCheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId)) { if ( flag != 0 ) KOMODO_CONNECTING = -1; + else KOMODO_CONNECTING &= ~(1<<30); return error("AcceptToMemoryPool: BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); } if ( flag != 0 ) KOMODO_CONNECTING = -1; - + else KOMODO_CONNECTING &= ~(1<<30); + // Store transaction in memory if ( komodo_is_notarytx(tx) == 0 ) KOMODO_ON_DEMAND++; @@ -3468,7 +3470,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * { CCoinsViewCache view(pcoinsTip); bool rv = ConnectBlock(*pblock, state, pindexNew, view, false, true); - KOMODO_CONNECTING = -1; + //KOMODO_CONNECTING = -1; GetMainSignals().BlockChecked(*pblock, state); if (!rv) { if (state.IsInvalid()) From cf16cc42cf27ee144fe426ccdc3689eda79c4791 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 27 Aug 2018 09:33:22 -1100 Subject: [PATCH 2/5] +print --- src/cc/CCutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index a57197537..beed06574 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -266,7 +266,7 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector param from_mempool = 1; height &= ((1<<30) - 1); } - fprintf(stderr,"KOMODO_CONNECTING.%d mempool.%d\n",height,from_mempool); + fprintf(stderr,"KOMODO_CONNECTING.%d mempool.%d vs CCactive.%d\n",height,from_mempool,KOMODO_CCACTIVATE); // there is a chance CC tx is valid in mempool, but invalid when in block, so we cant filter duplicate requests. if any of the vins are spent, for example //txid = ctx.GetHash(); //if ( txid == cp->prevtxid ) From 57c2bccd766e7705a9b679920b3ceffd62fc7396 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 27 Aug 2018 09:34:20 -1100 Subject: [PATCH 3/5] Fix early activation --- src/cc/CCutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index beed06574..3c38d04b3 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -259,7 +259,7 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector param height = KOMODO_CONNECTING; if ( KOMODO_CONNECTING < 0 ) // always comes back with > 0 for final confirmation return(true); - if ( ASSETCHAINS_CC == 0 || height < KOMODO_CCACTIVATE ) + if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < KOMODO_CCACTIVATE ) return eval->Invalid("CC are disabled or not active yet"); if ( (KOMODO_CONNECTING & (1<<30)) != 0 ) { From a5057f7e568a09872616895c9676965ce03ad80a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 27 Aug 2018 09:39:12 -1100 Subject: [PATCH 4/5] Revert most of test changes --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e27738e04..e25d6419b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1530,19 +1530,17 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // XXX: is this neccesary for CryptoConditions? if ( KOMODO_CONNECTING <= 0 && chainActive.LastTip() != 0 ) { - //flag = 1; + flag = 1; KOMODO_CONNECTING = (1<<30) + (int32_t)chainActive.LastTip()->nHeight + 1; } if (!ContextualCheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId)) { if ( flag != 0 ) KOMODO_CONNECTING = -1; - else KOMODO_CONNECTING &= ~(1<<30); return error("AcceptToMemoryPool: BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); } if ( flag != 0 ) KOMODO_CONNECTING = -1; - else KOMODO_CONNECTING &= ~(1<<30); // Store transaction in memory if ( komodo_is_notarytx(tx) == 0 ) @@ -3470,7 +3468,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * { CCoinsViewCache view(pcoinsTip); bool rv = ConnectBlock(*pblock, state, pindexNew, view, false, true); - //KOMODO_CONNECTING = -1; + KOMODO_CONNECTING = -1; GetMainSignals().BlockChecked(*pblock, state); if (!rv) { if (state.IsInvalid()) From 1a5b40c2e111cc9e215c799dc8f74898916d2dd7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 27 Aug 2018 09:52:32 -1100 Subject: [PATCH 5/5] Update version to 0.2.1 --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index cd99d531d..a42afbb61 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -55,7 +55,7 @@ extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t komodo_segid32(char *coinaddr); int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height); int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); -#define KOMODO_VERSION "0.2.0" +#define KOMODO_VERSION "0.2.1" extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; extern uint32_t ASSETCHAINS_MAGIC;