From 83da1e16c306b9d426188ad16dfb50d6f3084422 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 17:12:40 +0200 Subject: [PATCH 01/48] Test --- src/komodo_bitcoind.h | 7 ++++--- src/main.cpp | 18 +++++++++--------- src/rpcblockchain.cpp | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d575b02b1..36b16bde2 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -740,7 +740,7 @@ int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 has return(0); } -uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n) +uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n) { LOCK(cs_main); CTransaction tx; uint256 hashBlock; CBlockIndex *pindex,*tipindex; @@ -753,6 +753,7 @@ uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *va { *valuep = tx.vout[n].nValue; *txheightp = pindex->nHeight; + *txheighttimep = pindex->nTime; *tiptimep = tipindex->nTime; locktime = tx.nLockTime; //fprintf(stderr,"tx locktime.%u %.8f height.%d | tiptime.%u\n",locktime,(double)*valuep/COIN,*txheightp,*tiptimep); @@ -764,8 +765,8 @@ uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *va uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue) { - uint64_t value; uint32_t tiptime; - if ( (*locktimep= komodo_interest_args(txheightp,&tiptime,&value,hash,n)) != 0 ) + uint64_t value; uint32_t tiptime,txheighttimep; + if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 ) { if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) ) return(komodo_interest(*txheightp,value,*locktimep,tiptime)); diff --git a/src/main.cpp b/src/main.cpp index 627722907..10d0d29e1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -708,26 +708,26 @@ bool IsStandardTx(const CTransaction& tx, string& reason) int32_t komodo_validate_interest(const CTransaction& tx) { - int32_t i,txheight=0; uint32_t prevblocktime=0,locktime; uint64_t value=0; + int32_t i,txheight=0; uint32_t txheighttime,tiptime=0,locktime; uint64_t value=0; if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) { - locktime = komodo_interest_args(&txheight,&prevblocktime,&value,tx.GetHash(),0); - if ( prevblocktime == 0 ) + locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); + if ( txheighttime == 0 ) { static uint32_t counter0; - prevblocktime = chainActive.Tip()->nTime; + txheighttime = tiptime; if ( counter0++ < 3 ) - fprintf(stderr,"error getting prevblocktime, set to tiptime.%u\n",prevblocktime); + fprintf(stderr,"error getting txheighttime, set to tiptime.%u\n",tiptime); } - if ( (int64_t)tx.nLockTime < prevblocktime-3600 ) + if ( (int64_t)tx.nLockTime < txheighttime-3600 ) { - if ( prevblocktime > 1490159171 || (txheight == 0 && prevblocktime >= 1490159171) ) // 246748 + if ( txheighttime > 1490159171 || (txheight == 0 && txheighttime >= 1490159171) ) // 246748 { static uint32_t counter; if ( counter++ < 100 ) - fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u prevblocktime.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,prevblocktime); + fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime); return(-1); - } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs nBlockTime %u\n",(int32_t)txheight,tx.nLockTime,(uint32_t)prevblocktime); + } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs nBlockTime %u txheighttime.%u\n",(int32_t)txheight,tx.nLockTime,(uint32_t)prevblocktime,txheighttime); } } return(0); diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 70456a63f..b1fa9d3d5 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -406,7 +406,7 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel); int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height); char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len); -uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n); +//uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n); int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width); int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[IGUANA_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen); From eab04ab9c820e8fb080991c19075c4d6f8833139 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 17:15:35 +0200 Subject: [PATCH 02/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 10d0d29e1..d893a897c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -727,7 +727,7 @@ int32_t komodo_validate_interest(const CTransaction& tx) if ( counter++ < 100 ) fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime); return(-1); - } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs nBlockTime %u txheighttime.%u\n",(int32_t)txheight,tx.nLockTime,(uint32_t)prevblocktime,txheighttime); + } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime); } } return(0); From 63c93b0c0e26907de07087f66d1f7529004c7f1a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 17:20:30 +0200 Subject: [PATCH 03/48] Test --- src/komodo_bitcoind.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 36b16bde2..481ede104 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -744,6 +744,8 @@ uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_ { LOCK(cs_main); CTransaction tx; uint256 hashBlock; CBlockIndex *pindex,*tipindex; + *txheighttimep = *txheightp = *tiptimep = 0; + *valuep = 0; if ( !GetTransaction(hash,tx,hashBlock,true) ) return(0); uint32_t locktime = 0; From 36f4d2cdc6bf4a77956697ec15e541ff7828ddc3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 17:25:32 +0200 Subject: [PATCH 04/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d893a897c..3f944a3bc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -715,9 +715,9 @@ int32_t komodo_validate_interest(const CTransaction& tx) if ( txheighttime == 0 ) { static uint32_t counter0; - txheighttime = tiptime; + txheighttime = chainActive.Tip()->nTime; if ( counter0++ < 3 ) - fprintf(stderr,"error getting txheighttime, set to tiptime.%u\n",tiptime); + fprintf(stderr,"error getting txheighttime, set to tiptime.%u\n",txheighttime); } if ( (int64_t)tx.nLockTime < txheighttime-3600 ) { From 89e99094aafca9ee6191d19441e3040c2b5dfaa8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 17:29:04 +0200 Subject: [PATCH 05/48] Test --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3f944a3bc..f8a32e000 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -898,8 +898,8 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,libzcash:: static uint256 array[15]; int32_t j,k,n; if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); - if ( komodo_validate_interest(tx) < 0 ) - return(false); + //if ( komodo_validate_interest(tx) < 0 ) + // return(false); n = tx.vin.size(); for (j=0; jGetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } From ff51a18d9ac97167df78845f2fb56e54f23bf2a1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 17:38:04 +0200 Subject: [PATCH 06/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f8a32e000..6bf802ef8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -898,8 +898,8 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,libzcash:: static uint256 array[15]; int32_t j,k,n; if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); - //if ( komodo_validate_interest(tx) < 0 ) - // return(false); + if ( komodo_validate_interest(tx) < 0 ) + return(false); n = tx.vin.size(); for (j=0; j Date: Wed, 22 Mar 2017 17:42:45 +0200 Subject: [PATCH 07/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 6bf802ef8..3f944a3bc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3320,7 +3320,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } From 3750f5afb810088a52f57e0ca3965c4f9b895d60 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 18:00:08 +0200 Subject: [PATCH 08/48] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 84ce254f3..14ad70405 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -717,8 +717,8 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above extern int32_t KOMODO_REWIND; if ( KOMODO_REWIND < 0 ) { - fprintf(stderr,"rewind.%d\n",KOMODO_REWIND); - sleep(3); + fprintf(stderr,">>>>>>> rewind.%d will pause here for a minute. issue command and stop\n",KOMODO_REWIND); + sleep(60); KOMODO_REWIND = 0; } // 6a35506c65617365206d616b6520796f75722047697420636f6d6d6974206d65737361676573206d6f726520696e74657265737469 height.241778 checkdeposit n.4 [6a] [P] 80 vs 88 From 6ff77181f26f61fdd23d7cc61f5cf072881bf9fb Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 18:23:20 +0200 Subject: [PATCH 09/48] Test --- src/main.cpp | 17 +++++++++++------ src/main.h | 2 +- src/miner.cpp | 12 +++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3f944a3bc..d258d185c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -721,7 +721,7 @@ int32_t komodo_validate_interest(const CTransaction& tx) } if ( (int64_t)tx.nLockTime < txheighttime-3600 ) { - if ( txheighttime > 1490159171 || (txheight == 0 && txheighttime >= 1490159171) ) // 246748 + if ( txheighttime > 1490159171 )//|| (txheight == 0 && txheighttime >= 1490159171) ) // 246748 { static uint32_t counter; if ( counter++ < 100 ) @@ -733,18 +733,20 @@ int32_t komodo_validate_interest(const CTransaction& tx) return(0); } -bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags) +bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags) { int32_t i; + if ( expiredp != 0 ) + *expiredp = 0; if (tx.nLockTime == 0) return true; if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 ) { - //if ( komodo_validate_interest(tx) < 0 ) - // return(false); if ( nBlockTime >= 1490159171 || nBlockHeight > 246748 ) // 246748 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); + if ( expiredp != 0 ) + *expiredp = nBlockTime-3600; return(false); // need to prevent pastdating tx } else fprintf(stderr,"IsFinalTx grandfather.%d locktime %u vs nBlockTime %u\n",(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); } @@ -793,7 +795,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime(); - return IsFinalTx(tx, nBlockHeight, nBlockTime,flags); + return IsFinalTx(0,tx, nBlockHeight, nBlockTime,flags); } /** @@ -899,7 +901,10 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,libzcash:: if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); if ( komodo_validate_interest(tx) < 0 ) + { + fprintf(stderr,"CheckTransaction komodo_validate_interest error\n"); return(false); + } n = tx.vin.size(); for (j=0; jGetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } diff --git a/src/main.h b/src/main.h index 0a137188d..dcbd23632 100644 --- a/src/main.h +++ b/src/main.h @@ -351,7 +351,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason); * Check if transaction is final and can be included in a block with the * specified height and time. Consensus critical. */ -bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags); +bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags); /** * Check if transaction will be final in the next block to be created. diff --git a/src/miner.cpp b/src/miner.cpp index ab95c4aa6..cb6d4e23a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -183,7 +183,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) pblock->nTime = GetAdjustedTime(); const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast(); CCoinsViewCache view(pcoinsTip); - + uin32_t expired; + // Priority order to process transactions list vOrphan; // list memory doesn't move map > mapDependers; @@ -201,9 +202,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) ? nMedianTimePast : pblock->GetBlockTime(); - if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) + if (tx.IsCoinBase() || !IsFinalTx(&expired,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) + { + if ( expired != 0 ) + { + fprintf(stderr,"expire from mempool tx.(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN); + } continue; - + } COrphan* porphan = NULL; double dPriority = 0; CAmount nTotalIn = 0; From 0a4ad821515eff6f4f3a4d22d5d687f8f044669e Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 18:30:02 +0200 Subject: [PATCH 10/48] Test --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index cb6d4e23a..aaf481db2 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -183,7 +183,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) pblock->nTime = GetAdjustedTime(); const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast(); CCoinsViewCache view(pcoinsTip); - uin32_t expired; + uint32_t expired; // Priority order to process transactions list vOrphan; // list memory doesn't move @@ -206,7 +206,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { if ( expired != 0 ) { - fprintf(stderr,"expire from mempool tx.(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN); + fprintf(stderr,"expire from mempool tx.\n");//(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN); } continue; } From a6e10f4082895fed788dfc6a776a81812d26bae0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 19:29:04 +0200 Subject: [PATCH 11/48] Test --- src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index d258d185c..df92930a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -712,6 +712,8 @@ int32_t komodo_validate_interest(const CTransaction& tx) if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) { locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); + if ( tiptime == 0 ) + tiptime = (int32_t)chainActive.Tip()->nTime; if ( txheighttime == 0 ) { static uint32_t counter0; @@ -723,12 +725,14 @@ int32_t komodo_validate_interest(const CTransaction& tx) { if ( txheighttime > 1490159171 )//|| (txheight == 0 && txheighttime >= 1490159171) ) // 246748 { + // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 static uint32_t counter; if ( counter++ < 100 ) fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime); return(-1); } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime); } + fprintf(stderr,"validateinterest accept.%d locktime %u/%u vs txheighttime.%u tiptime.%u\n",(int32_t)txheight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime); } return(0); } From b667a3cc4d8570627ba495aa6b5fbdcff2eaaef9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 19:35:42 +0200 Subject: [PATCH 12/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index df92930a7..f561d504d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -723,7 +723,7 @@ int32_t komodo_validate_interest(const CTransaction& tx) } if ( (int64_t)tx.nLockTime < txheighttime-3600 ) { - if ( txheighttime > 1490159171 )//|| (txheight == 0 && txheighttime >= 1490159171) ) // 246748 + if ( txheighttime > 1490159171 || (txheight == 0 && txheighttime >= 1490159171) ) // 246748 { // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 static uint32_t counter; From 3087a316f42b1150f507bc923505e83c3c5a55eb Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 19:45:09 +0200 Subject: [PATCH 13/48] Test --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f561d504d..c98a985e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -723,11 +723,11 @@ int32_t komodo_validate_interest(const CTransaction& tx) } if ( (int64_t)tx.nLockTime < txheighttime-3600 ) { - if ( txheighttime > 1490159171 || (txheight == 0 && txheighttime >= 1490159171) ) // 246748 + if ( txheighttime > 1490159171 )//|| (txheight == 0 && txheighttime >= 1490159171) ) // 246748 { // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 - static uint32_t counter; - if ( counter++ < 100 ) + //static uint32_t counter; + //if ( counter++ < 100 ) fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime); return(-1); } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime); From 74d56dfd45b584df0c4d4ebc23cd8c7241ea5c67 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 19:58:37 +0200 Subject: [PATCH 14/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c98a985e8..3fa381af1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -904,7 +904,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,libzcash:: static uint256 array[15]; int32_t j,k,n; if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); - if ( komodo_validate_interest(tx) < 0 ) + if ( 0 && komodo_validate_interest(tx) < 0 ) { fprintf(stderr,"CheckTransaction komodo_validate_interest error\n"); return(false); @@ -3329,7 +3329,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } From 1ebbcd18b3565ddcd66f94703edf5be33f546a9e Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 20:04:03 +0200 Subject: [PATCH 15/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3fa381af1..c98a985e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -904,7 +904,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,libzcash:: static uint256 array[15]; int32_t j,k,n; if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); - if ( 0 && komodo_validate_interest(tx) < 0 ) + if ( komodo_validate_interest(tx) < 0 ) { fprintf(stderr,"CheckTransaction komodo_validate_interest error\n"); return(false); @@ -3329,7 +3329,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } From 837b94ee83f634e1ee17adec0712720b11e9582f Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 20:18:41 +0200 Subject: [PATCH 16/48] Test --- src/main.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c98a985e8..29b11998e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -706,7 +706,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) return true; } -int32_t komodo_validate_interest(const CTransaction& tx) +int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { int32_t i,txheight=0; uint32_t txheighttime,tiptime=0,locktime; uint64_t value=0; if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) @@ -746,7 +746,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 return true; if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 ) { - if ( nBlockTime >= 1490159171 || nBlockHeight > 246748 ) // 246748 + if ( nBlockTime >= 1490159171 ) // 246748 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); if ( expiredp != 0 ) @@ -904,11 +904,11 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,libzcash:: static uint256 array[15]; int32_t j,k,n; if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); - if ( komodo_validate_interest(tx) < 0 ) + /*if ( komodo_validate_interest(tx) < 0 ) { fprintf(stderr,"CheckTransaction komodo_validate_interest error\n"); return(false); - } + }*/ n = tx.vin.size(); for (j=0; j Date: Wed, 22 Mar 2017 20:22:05 +0200 Subject: [PATCH 17/48] Test --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 29b11998e..7fdc7fc44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -721,18 +721,18 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) if ( counter0++ < 3 ) fprintf(stderr,"error getting txheighttime, set to tiptime.%u\n",txheighttime); } - if ( (int64_t)tx.nLockTime < txheighttime-3600 ) + if ( (int64_t)tx.nLockTime < txblocktime-3600 )//txheighttime-3600 ) { if ( txheighttime > 1490159171 )//|| (txheight == 0 && txheighttime >= 1490159171) ) // 246748 { // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 //static uint32_t counter; //if ( counter++ < 100 ) - fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime); + fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime); return(-1); - } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime); + } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime); } - fprintf(stderr,"validateinterest accept.%d locktime %u/%u vs txheighttime.%u tiptime.%u\n",(int32_t)txheight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime); + fprintf(stderr,"validateinterest accept.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u\n",(int32_t)txheight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime); } return(0); } @@ -3251,7 +3251,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat // Check transactions BOOST_FOREACH(const CTransaction& tx, block.vtx) { - if ( komodo_validate_interest(tx,block.vtx.nTime) < 0 ) + if ( komodo_validate_interest(tx,block.nTime) < 0 ) { fprintf(stderr,"CheckBlock(): komodo_validate_interest failure\n"); return error("CheckBlock: komodo_validate_interest failed"); From de463b10508dae4364dac6b57ad5a0a8865fc855 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 20:45:07 +0200 Subject: [PATCH 18/48] Test --- src/main.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7fdc7fc44..236b4b1af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -708,7 +708,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { - int32_t i,txheight=0; uint32_t txheighttime,tiptime=0,locktime; uint64_t value=0; + int32_t i,txheight=0; uint32_t cmptime,txheighttime,tiptime=0,locktime; uint64_t value=0; if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) { locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); @@ -721,9 +721,17 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) if ( counter0++ < 3 ) fprintf(stderr,"error getting txheighttime, set to tiptime.%u\n",txheighttime); } - if ( (int64_t)tx.nLockTime < txblocktime-3600 )//txheighttime-3600 ) + if ( txheighttime != 0 && txblocktime != 0 ) { - if ( txheighttime > 1490159171 )//|| (txheight == 0 && txheighttime >= 1490159171) ) // 246748 + cmptime = txheighttime; + if ( txblocktime < cmptime ) + cmptime = txblocktime; + } + else if ( (cmptime= txheighttime) == 0 ) + cmptime = txblockime; + if ( cmptime != 0 && (int64_t)tx.nLockTime < cmptime-3600 ) + { + if ( txheighttime > 1490159171 || (locktime == 0 && txheighttime >= 1490159171) ) // 246748 { // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 //static uint32_t counter; From 7133babe5fe78c35d76f124e6b3c312ff196627d Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 20:47:03 +0200 Subject: [PATCH 19/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 236b4b1af..01e0fc7f9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -728,7 +728,7 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) cmptime = txblocktime; } else if ( (cmptime= txheighttime) == 0 ) - cmptime = txblockime; + cmptime = txblocktime; if ( cmptime != 0 && (int64_t)tx.nLockTime < cmptime-3600 ) { if ( txheighttime > 1490159171 || (locktime == 0 && txheighttime >= 1490159171) ) // 246748 From 241a6ce5f4423b41976ef0fb6cac991b7af5a78d Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 21:34:03 +0200 Subject: [PATCH 20/48] Test --- src/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 01e0fc7f9..6afb42ce6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -729,6 +729,11 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) } else if ( (cmptime= txheighttime) == 0 ) cmptime = txblocktime; + if ( tiptime != 0 && tiptime < cmptime ) + cmptime = tiptime; + //validateinterest accept.246749 locktime 1490205024/1490205024 vs txheighttime.1490205794 tiptime.1490159171 txb.1490205794 + //komodo_validate_interest reject.246749 locktime 1490201846/1490201846 vs nBlockTime 1490159171 txheighttime.1490205794 tiptime.1490159171 txb.1490205794 + //CheckBlock(): komodo_validate_interest failure if ( cmptime != 0 && (int64_t)tx.nLockTime < cmptime-3600 ) { if ( txheighttime > 1490159171 || (locktime == 0 && txheighttime >= 1490159171) ) // 246748 @@ -736,11 +741,11 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 //static uint32_t counter; //if ( counter++ < 100 ) - fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime); + fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u cmp.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime,cmptime); return(-1); - } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime); + } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); } - fprintf(stderr,"validateinterest accept.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u\n",(int32_t)txheight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime); + fprintf(stderr,"validateinterest accept.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime,cmptime); } return(0); } From d022ff08d461b8562bb88c2bc5f882691fee40e2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 22:07:39 +0200 Subject: [PATCH 21/48] Test --- src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6afb42ce6..82cd0f366 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -709,7 +709,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { int32_t i,txheight=0; uint32_t cmptime,txheighttime,tiptime=0,locktime; uint64_t value=0; - if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && txblocktime > 1490159171-24*3600*100 ) { locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); if ( tiptime == 0 ) @@ -757,9 +757,10 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 *expiredp = 0; if (tx.nLockTime == 0) return true; - if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && nBlockTime > 1490159171-24*3600*100 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 { - if ( nBlockTime >= 1490159171 ) // 246748 + if ( komodo_validate_interest(tx,nBlockTime) < 0 ) + //if ( nBlockTime >= 1490159171 ) // 246748 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); if ( expiredp != 0 ) From 3d7d73a47a94553e00050720eb036113956306c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 22:12:07 +0200 Subject: [PATCH 22/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 82cd0f366..62a476c4b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -709,7 +709,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { int32_t i,txheight=0; uint32_t cmptime,txheighttime,tiptime=0,locktime; uint64_t value=0; - if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && txblocktime > 1490159171-24*3600*100 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && txblocktime >= 1473793441 ) { locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); if ( tiptime == 0 ) @@ -757,7 +757,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 *expiredp = 0; if (tx.nLockTime == 0) return true; - if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && nBlockTime > 1490159171-24*3600*100 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 + if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && nBlockTime >= 1473793441 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 { if ( komodo_validate_interest(tx,nBlockTime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 From dd36961aaf2539886c63214d11b20a63c71ff59a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 23:03:41 +0200 Subject: [PATCH 23/48] Test --- src/komodo_gateway.h | 6 +++--- src/main.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 14ad70405..185145bdd 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -520,8 +520,8 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to } if ( ASSETCHAINS_SYMBOL[0] != 0 && (pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis) ) { - if ( pax->height > 214700 || strcmp(ASSETCHAINS_SYMBOL,symbol) == 0 ) - printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); + //if ( pax->height > 214700 || strcmp(ASSETCHAINS_SYMBOL,symbol) == 0 ) + // printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); continue; } /*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0); @@ -1213,7 +1213,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->withdrawn += value; didstats = 1; - if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p withdrawn %s += %.8f check %.8f\n",basesp,base,dstr(value),dstr(checktoshis)); } if ( 0 && strcmp(base,"RUB") == 0 && (pax == 0 || pax->approved == 0) ) diff --git a/src/main.cpp b/src/main.cpp index 62a476c4b..337d8bef3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -741,6 +741,7 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 //static uint32_t counter; //if ( counter++ < 100 ) + if ( tx.nLockTime != 1477258935 ) fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u cmp.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime,cmptime); return(-1); } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); @@ -3267,7 +3268,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(tx,block.nTime) < 0 ) { - fprintf(stderr,"CheckBlock(): komodo_validate_interest failure\n"); + //fprintf(stderr,"CheckBlock(): komodo_validate_interest failure\n"); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From 32f5c6fbb2b02df1a6eaf354791b9b5c3a4a0b5c Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 23:04:22 +0200 Subject: [PATCH 24/48] Test --- src/miner.cpp | 2 +- src/pow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index aaf481db2..39bcbdd88 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -677,7 +677,7 @@ void static BitcoinMiner(CWallet *pwallet) if ( externalflag == 0 && i != 66 ) printf("VIOLATION at %d\n",i); for (i=0; i<66; i++) - {break; + { break; for (j=0; j<33; j++) printf("%02x",pubkeys[i][j]); printf(" p%d -> %d\n",i,komodo_minerid(pindexPrev->nHeight-i,pubkeys[i])); diff --git a/src/pow.cpp b/src/pow.cpp index 655a9dfad..ce959254c 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -111,7 +111,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33); void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height); extern int32_t KOMODO_CHOSEN_ONE; #define KOMODO_ELECTION_GAP 2000 - + int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height); int32_t KOMODO_LOADINGBLOCKS; From aa4d30c8cc989ba9ed08b9f4d53d0d44435170dd Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 02:56:45 +0200 Subject: [PATCH 25/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 337d8bef3..86a123be5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3268,7 +3268,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(tx,block.nTime) < 0 ) { - //fprintf(stderr,"CheckBlock(): komodo_validate_interest failure\n"); + fprintf(stderr,"CheckBlock(%d): komodo_validate_interest failure\n",height); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From e251f378d1b5f8d4ed365af8c85d178e0e89af8b Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:00:27 +0200 Subject: [PATCH 26/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 86a123be5..4fecd17b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3268,7 +3268,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(tx,block.nTime) < 0 ) { - fprintf(stderr,"CheckBlock(%d): komodo_validate_interest failure\n",height); + fprintf(stderr,"CheckBlock(%d) %d, %u: komodo_validate_interest failure\n",height,pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From 6c6ed52068054db21e94245b161863f2bab5be62 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:01:51 +0200 Subject: [PATCH 27/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 4fecd17b9..a914d7ab1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3268,7 +3268,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(tx,block.nTime) < 0 ) { - fprintf(stderr,"CheckBlock(%d) %d, %u: komodo_validate_interest failure\n",height,pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0); + fprintf(stderr,"CheckBlock(%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From eb5f62e7ce902e8da8d213c684bd053466f4f526 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:05:03 +0200 Subject: [PATCH 28/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a914d7ab1..77acc17ba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -746,7 +746,7 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) return(-1); } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); } - fprintf(stderr,"validateinterest accept.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime,cmptime); + fprintf(stderr,"validateinterest accept.%d tip.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,(int32_t)chainActive.Tip()->nHeight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime,cmptime); } return(0); } From 3683acba649b18e5e32e532e8b86f7c60e291108 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:09:14 +0200 Subject: [PATCH 29/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 77acc17ba..3835ee966 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3268,7 +3268,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(tx,block.nTime) < 0 ) { - fprintf(stderr,"CheckBlock(%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); + fprintf(stderr,"CheckBlock(%d:%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,komodo_block2height((Cblock *)&block),pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From 26d8ed58f6299e20514cd43812833549c9d20f6b Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:10:07 +0200 Subject: [PATCH 30/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 3835ee966..e777eb470 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3268,7 +3268,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(tx,block.nTime) < 0 ) { - fprintf(stderr,"CheckBlock(%d:%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,komodo_block2height((Cblock *)&block),pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); + fprintf(stderr,"CheckBlock(%d:%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,komodo_block2height((CBlock *)&block),pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From ba8419c7a079b5581b00d2da0d80795c75611a20 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:20:32 +0200 Subject: [PATCH 31/48] Test --- src/miner.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/miner.cpp b/src/miner.cpp index 39bcbdd88..50ddd61c6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -511,7 +511,19 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese { LOCK(cs_main); if (pblock->hashPrevBlock != chainActive.Tip()->GetBlockHash()) + { + uint256 hash; int32_t i; + hash = pblock->hashPrevBlock; + for (i=0; i<32; i++) + fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); + fprintf(stderr," <- prev\n"); + hash = chainActive.Tip()->GetBlockHash(); + for (i=0; i<32; i++) + fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); + fprintf(stderr," <- chainTip\n"); + return error("KomodoMiner: generated block is stale"); + } } // Remove key from key pool From c0dbb034f380ac4a3c827e2d166adb1abc08587e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:30:15 +0200 Subject: [PATCH 32/48] test --- src/main.cpp | 11 +++++++++++ src/miner.cpp | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e777eb470..f0b1925e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3200,6 +3200,17 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl { uint8_t pubkey33[33]; // Check timestamp + { + uint256 hash; int32_t i; + hash = blockhdr.GetHash(); + for (i=0; i<32; i++) + fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); + fprintf(stderr," <- CheckBlockHeader\n"); + hash = chainActive.Tip()->GetBlockHash(); + for (i=0; i<32; i++) + fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); + fprintf(stderr," <- chainTip\n"); + } if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60) return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new"); // Check block version diff --git a/src/miner.cpp b/src/miner.cpp index 50ddd61c6..fdd5ea8c3 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -516,11 +516,11 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese hash = pblock->hashPrevBlock; for (i=0; i<32; i++) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); - fprintf(stderr," <- prev\n"); + fprintf(stderr," <- prev (stale)\n"); hash = chainActive.Tip()->GetBlockHash(); for (i=0; i<32; i++) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); - fprintf(stderr," <- chainTip\n"); + fprintf(stderr," <- chainTip (stale)\n"); return error("KomodoMiner: generated block is stale"); } From 92266e99590fee4892568f49e1d6fde5d28ad8c7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 03:35:44 +0200 Subject: [PATCH 33/48] Test --- src/main.cpp | 4 ++-- src/miner.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f0b1925e3..ba38979ba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3203,11 +3203,11 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl { uint256 hash; int32_t i; hash = blockhdr.GetHash(); - for (i=0; i<32; i++) + for (i=31; i>=0; i--) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); fprintf(stderr," <- CheckBlockHeader\n"); hash = chainActive.Tip()->GetBlockHash(); - for (i=0; i<32; i++) + for (i=31; i>=0; i--) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); fprintf(stderr," <- chainTip\n"); } diff --git a/src/miner.cpp b/src/miner.cpp index fdd5ea8c3..2582980b1 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -514,11 +514,11 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese { uint256 hash; int32_t i; hash = pblock->hashPrevBlock; - for (i=0; i<32; i++) + for (i=31; i>=0; i--) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); fprintf(stderr," <- prev (stale)\n"); hash = chainActive.Tip()->GetBlockHash(); - for (i=0; i<32; i++) + for (i=31; i>=0; i--) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); fprintf(stderr," <- chainTip (stale)\n"); From 807949f42f6e4e8613e4ec73d3e7bbaa999b6f74 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 04:05:11 +0200 Subject: [PATCH 34/48] Test --- src/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ba38979ba..5e38a9a4c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3206,10 +3206,13 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl for (i=31; i>=0; i--) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); fprintf(stderr," <- CheckBlockHeader\n"); - hash = chainActive.Tip()->GetBlockHash(); - for (i=31; i>=0; i--) - fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); - fprintf(stderr," <- chainTip\n"); + if ( chainActive.Tip() != 0 ) + { + hash = chainActive.Tip()->GetBlockHash(); + for (i=31; i>=0; i--) + fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); + fprintf(stderr," <- chainTip\n"); + } } if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60) return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new"); From 9f07c80c9f24f1d68a1195997b3076a339080fb7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 04:22:21 +0200 Subject: [PATCH 35/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 5e38a9a4c..5c3cca34b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2949,7 +2949,7 @@ bool ActivateBestChain(CValidationState &state, CBlock *pblock) { } // Notify external listeners about the new tip. uiInterface.NotifyBlockTip(hashNewTip); - } + } else fprintf(stderr,"initial download skips propagation\n"); } while(pindexMostWork != chainActive.Tip()); CheckBlockIndex(); From 7f32cee6398fab7ae48873904a4087e658ef8cf3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 04:23:54 +0200 Subject: [PATCH 36/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 5c3cca34b..5ffbf2e94 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1614,7 +1614,7 @@ bool IsInitialBlockDownload() state = ((chainActive.Height() < ptr->nHeight - 24*6) || ptr->GetBlockTime() < (GetTime() - chainParams.MaxTipAge())); else state = (chainActive.Height() < ptr->nHeight - 100); - //fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge())); + fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge())); if (!state) { lockIBDState = true; From eca6ba0d9fe553eabfcf5ed892fb412e778a4d15 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 04:29:57 +0200 Subject: [PATCH 37/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 5ffbf2e94..0a5462200 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1611,7 +1611,7 @@ bool IsInitialBlockDownload() else if ( pindexBestHeader != 0 && pindexBestHeader->nHeight > ptr->nHeight ) ptr = pindexBestHeader; if ( ASSETCHAINS_SYMBOL[0] == 0 ) - state = ((chainActive.Height() < ptr->nHeight - 24*6) || + state = chainActive.Height() > 2467500 && ((chainActive.Height() < ptr->nHeight - 24*6) || ptr->GetBlockTime() < (GetTime() - chainParams.MaxTipAge())); else state = (chainActive.Height() < ptr->nHeight - 100); fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge())); From 43aafea7c9ac41b16e78e3149a57cf8798d52024 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 04:32:03 +0200 Subject: [PATCH 38/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0a5462200..60f7ac508 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1611,9 +1611,9 @@ bool IsInitialBlockDownload() else if ( pindexBestHeader != 0 && pindexBestHeader->nHeight > ptr->nHeight ) ptr = pindexBestHeader; if ( ASSETCHAINS_SYMBOL[0] == 0 ) - state = chainActive.Height() > 2467500 && ((chainActive.Height() < ptr->nHeight - 24*6) || + state = ((chainActive.Height() < ptr->nHeight - 24*60) || ptr->GetBlockTime() < (GetTime() - chainParams.MaxTipAge())); - else state = (chainActive.Height() < ptr->nHeight - 100); + else state = (chainActive.Height() < ptr->nHeight - 3); fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge())); if (!state) { From b11963b5b0829de522456d982ef6729e116e7985 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 04:39:44 +0200 Subject: [PATCH 39/48] Test --- src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 60f7ac508..9698984bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1614,7 +1614,7 @@ bool IsInitialBlockDownload() state = ((chainActive.Height() < ptr->nHeight - 24*60) || ptr->GetBlockTime() < (GetTime() - chainParams.MaxTipAge())); else state = (chainActive.Height() < ptr->nHeight - 3); - fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge())); + //fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge())); if (!state) { lockIBDState = true; @@ -2949,7 +2949,7 @@ bool ActivateBestChain(CValidationState &state, CBlock *pblock) { } // Notify external listeners about the new tip. uiInterface.NotifyBlockTip(hashNewTip); - } else fprintf(stderr,"initial download skips propagation\n"); + } //else fprintf(stderr,"initial download skips propagation\n"); } while(pindexMostWork != chainActive.Tip()); CheckBlockIndex(); @@ -3200,6 +3200,7 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl { uint8_t pubkey33[33]; // Check timestamp + if ( 0 ) { uint256 hash; int32_t i; hash = blockhdr.GetHash(); From fc901e2f4a76134f3fd8ebfc1b3819993111b433 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 05:31:12 +0200 Subject: [PATCH 40/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9698984bf..ec37b80f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -709,7 +709,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { int32_t i,txheight=0; uint32_t cmptime,txheighttime,tiptime=0,locktime; uint64_t value=0; - if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && txblocktime >= 1473793441 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && txblocktime >= 1490159171 - 24*3600*100 )//1473793441 ) { locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); if ( tiptime == 0 ) @@ -758,7 +758,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 *expiredp = 0; if (tx.nLockTime == 0) return true; - if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && nBlockTime >= 1473793441 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 + if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD )//&& nBlockTime >= 1473793441 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 { if ( komodo_validate_interest(tx,nBlockTime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 From 7ef5540bca0589c6d2317d21b530e3ed4907d898 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 05:47:19 +0200 Subject: [PATCH 41/48] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ec37b80f4..3a80075bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -746,7 +746,7 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) return(-1); } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); } - fprintf(stderr,"validateinterest accept.%d tip.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,(int32_t)chainActive.Tip()->nHeight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime,cmptime); + //fprintf(stderr,"validateinterest accept.%d tip.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,(int32_t)chainActive.Tip()->nHeight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime,cmptime); } return(0); } @@ -767,7 +767,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 if ( expiredp != 0 ) *expiredp = nBlockTime-3600; return(false); // need to prevent pastdating tx - } else fprintf(stderr,"IsFinalTx grandfather.%d locktime %u vs nBlockTime %u\n",(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); + } //else fprintf(stderr,"IsFinalTx accept.%d locktime %u vs nBlockTime %u\n",(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); } if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) return true; From 67cb4250ede2c24cf4d5bc497fa588e85bd4f087 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 05:53:28 +0200 Subject: [PATCH 42/48] Test --- src/main.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3a80075bf..6a2adb60d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -709,7 +709,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { int32_t i,txheight=0; uint32_t cmptime,txheighttime,tiptime=0,locktime; uint64_t value=0; - if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && txblocktime >= 1490159171 - 24*3600*100 )//1473793441 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD )//1473793441 ) { locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); if ( tiptime == 0 ) @@ -731,20 +731,17 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) cmptime = txblocktime; if ( tiptime != 0 && tiptime < cmptime ) cmptime = tiptime; - //validateinterest accept.246749 locktime 1490205024/1490205024 vs txheighttime.1490205794 tiptime.1490159171 txb.1490205794 - //komodo_validate_interest reject.246749 locktime 1490201846/1490201846 vs nBlockTime 1490159171 txheighttime.1490205794 tiptime.1490159171 txb.1490205794 - //CheckBlock(): komodo_validate_interest failure - if ( cmptime != 0 && (int64_t)tx.nLockTime < cmptime-3600 ) + if ( cmptime >= 1490159171 - 24*3600 ) { - if ( txheighttime > 1490159171 || (locktime == 0 && txheighttime >= 1490159171) ) // 246748 + if ( cmptime != 0 && (int64_t)tx.nLockTime < cmptime-3600 ) { - // komodo_validate_interest reject.0 locktime 1490193206/0 vs nBlockTime 1490202625 txheighttime.1490202625 tiptime.0 - //static uint32_t counter; - //if ( counter++ < 100 ) - if ( tx.nLockTime != 1477258935 ) - fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u cmp.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime,cmptime); - return(-1); - } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); + if ( txheighttime > 1490159171 || (locktime == 0 && txheighttime >= 1490159171) ) // 246748 + { + if ( tx.nLockTime != 1477258935 ) + fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u cmp.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime,cmptime); + return(-1); + } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); + } } //fprintf(stderr,"validateinterest accept.%d tip.%d locktime %u/%u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,(int32_t)chainActive.Tip()->nHeight,(int32_t)tx.nLockTime,locktime,txheighttime,tiptime,txblocktime,cmptime); } From 2d14730eeb6cd6019ea8e6d34109344a2de16387 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 06:17:53 +0200 Subject: [PATCH 43/48] Test --- src/main.cpp | 13 ++++++------- src/miner.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6a2adb60d..884ce1248 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -706,7 +706,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) return true; } -int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) +int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,uint32_t txblocktime) { int32_t i,txheight=0; uint32_t cmptime,txheighttime,tiptime=0,locktime; uint64_t value=0; if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD )//1473793441 ) @@ -739,6 +739,8 @@ int32_t komodo_validate_interest(const CTransaction& tx,uint32_t txblocktime) { if ( tx.nLockTime != 1477258935 ) fprintf(stderr,"komodo_validate_interest reject.%d locktime %u/%u vs nBlockTime %u txheighttime.%u tiptime.%u txb.%u cmp.%u\n",txheight,(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,txheighttime,tiptime,txblocktime,cmptime); + if ( expiredp != 0 ) + *expiredp = cmptime-3600; return(-1); } else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime); } @@ -757,12 +759,9 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 return true; if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD )//&& nBlockTime >= 1473793441 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 { - if ( komodo_validate_interest(tx,nBlockTime) < 0 ) - //if ( nBlockTime >= 1490159171 ) // 246748 + if ( komodo_validate_interest(expiredp,tx,nBlockTime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); - if ( expiredp != 0 ) - *expiredp = nBlockTime-3600; return(false); // need to prevent pastdating tx } //else fprintf(stderr,"IsFinalTx accept.%d locktime %u vs nBlockTime %u\n",(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); } @@ -1157,7 +1156,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa if (pfMissingInputs) *pfMissingInputs = false; auto verifier = libzcash::ProofVerifier::Strict(); - /*if ( komodo_validate_interest(tx) < 0 ) // called from IsFinalTx() below + /*if ( komodo_validate_interest(tx) < 0 ) // called from CheckFinalTx() below { fprintf(stderr,"komodo_validate_interest failure\n"); return error("AcceptToMemoryPool: komodo_validate_interest failed"); @@ -3278,7 +3277,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat // Check transactions BOOST_FOREACH(const CTransaction& tx, block.vtx) { - if ( komodo_validate_interest(tx,block.nTime) < 0 ) + if ( komodo_validate_interest(0,tx,block.nTime) < 0 ) { fprintf(stderr,"CheckBlock(%d:%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,komodo_block2height((CBlock *)&block),pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); return error("CheckBlock: komodo_validate_interest failed"); diff --git a/src/miner.cpp b/src/miner.cpp index 2582980b1..54eafa5b6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -207,6 +207,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if ( expired != 0 ) { fprintf(stderr,"expire from mempool tx.\n");//(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN); + list removed; + mempool.remove(tx, removed, true); } continue; } @@ -436,8 +438,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) static uint32_t counter; if ( counter++ < 100 ) fprintf(stderr,"warning: testblockvalidity failed\n"); - return(0); - //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); + //return(0); + throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); } } From d5ecb91b00e9836402a9b0eee3ae745e8fb69a7c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 06:21:21 +0200 Subject: [PATCH 44/48] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 884ce1248..ad89f0a8a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3279,7 +3279,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat { if ( komodo_validate_interest(0,tx,block.nTime) < 0 ) { - fprintf(stderr,"CheckBlock(%d:%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,komodo_block2height((CBlock *)&block),pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); + //fprintf(stderr,"CheckBlock(%d:%d) %d, %u: komodo_validate_interest failure blocksize.%d\n",height,komodo_block2height((CBlock *)&block),pindex!=0?(int32_t)pindex->nHeight:0,pindex!=0?(int32_t)pindex->nTime:0,(int32_t)block.vtx.size()); return error("CheckBlock: komodo_validate_interest failed"); } if (!CheckTransaction(tx, state, verifier)) From 7a57bbb4462bb801b5a893b55b43569f85b9ab1c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 06:28:05 +0200 Subject: [PATCH 45/48] Test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 54eafa5b6..219f9e883 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -211,7 +211,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) mempool.remove(tx, removed, true); } continue; - } + } else fprintf(stderr,"coinbase or is finaltx (%d %u)\n",(int32_t)nHeight,(uint32_t)nLockTimeCutoff); COrphan* porphan = NULL; double dPriority = 0; CAmount nTotalIn = 0; From 3915943450552f389016bd1c60723128860d3653 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 06:37:28 +0200 Subject: [PATCH 46/48] Test --- src/main.cpp | 2 +- src/miner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ad89f0a8a..03224d168 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -763,7 +763,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); return(false); // need to prevent pastdating tx - } //else fprintf(stderr,"IsFinalTx accept.%d locktime %u vs nBlockTime %u\n",(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); + } else fprintf(stderr,"IsFinalTx accept.%d locktime %u vs nBlockTime %u\n",(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); } if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) return true; diff --git a/src/miner.cpp b/src/miner.cpp index 219f9e883..be3153c57 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -211,7 +211,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) mempool.remove(tx, removed, true); } continue; - } else fprintf(stderr,"coinbase or is finaltx (%d %u)\n",(int32_t)nHeight,(uint32_t)nLockTimeCutoff); + } else fprintf(stderr,"coinbase or is finaltx (%d %u)\n",(int32_t)nHeight,(uint32_t)tx.nLockTime); COrphan* porphan = NULL; double dPriority = 0; CAmount nTotalIn = 0; From 253b7bc01daa48a9f259394568fa0a6373fc0635 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 06:46:30 +0200 Subject: [PATCH 47/48] Test --- src/main.cpp | 8 ++++---- src/main.h | 2 +- src/miner.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 03224d168..7396530ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -750,7 +750,7 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,uint3 return(0); } -bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags) +bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags,int32_t interesttime) { int32_t i; if ( expiredp != 0 ) @@ -759,7 +759,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 return true; if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD )//&& nBlockTime >= 1473793441 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 { - if ( komodo_validate_interest(expiredp,tx,nBlockTime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 + if ( komodo_validate_interest(expiredp,tx,interesttime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); return(false); // need to prevent pastdating tx @@ -810,7 +810,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime(); - return IsFinalTx(0,tx, nBlockHeight, nBlockTime,flags); + return IsFinalTx(0,tx, nBlockHeight, nBlockTime,flags,chainActive.Tip()->nTime); } /** @@ -3361,7 +3361,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS,pindexPrev->nTime)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } diff --git a/src/main.h b/src/main.h index dcbd23632..1bea5030f 100644 --- a/src/main.h +++ b/src/main.h @@ -351,7 +351,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason); * Check if transaction is final and can be included in a block with the * specified height and time. Consensus critical. */ -bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags); +bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags,int32_t interesttime); /** * Check if transaction will be final in the next block to be created. diff --git a/src/miner.cpp b/src/miner.cpp index be3153c57..ee7c608b2 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -202,7 +202,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) ? nMedianTimePast : pblock->GetBlockTime(); - if (tx.IsCoinBase() || !IsFinalTx(&expired,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) + if (tx.IsCoinBase() || !IsFinalTx(&expired,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS,chainActive.Tip()->nTime)) { if ( expired != 0 ) { From 3fb77104701e37bdc6d097e60290b9e89f7ce7cf Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 07:25:53 +0200 Subject: [PATCH 48/48] Post-fork with mining --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index ee7c608b2..91318d641 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -206,12 +206,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { if ( expired != 0 ) { - fprintf(stderr,"expire from mempool tx.\n");//(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN); + fprintf(stderr,"expire from mempool tx. need to verify this works\n");//(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN); list removed; mempool.remove(tx, removed, true); } continue; - } else fprintf(stderr,"coinbase or is finaltx (%d %u)\n",(int32_t)nHeight,(uint32_t)tx.nLockTime); + } //else fprintf(stderr,"coinbase or is finaltx (%d %u)\n",(int32_t)nHeight,(uint32_t)tx.nLockTime); COrphan* porphan = NULL; double dPriority = 0; CAmount nTotalIn = 0;