From dd36961aaf2539886c63214d11b20a63c71ff59a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 22 Mar 2017 23:03:41 +0200 Subject: [PATCH 01/17] 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 02/17] 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 03/17] 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 04/17] 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 05/17] 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 06/17] 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 07/17] 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 08/17] 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 09/17] 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 10/17] 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 11/17] 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 12/17] 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 13/17] 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 14/17] 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 15/17] 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 16/17] 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 17/17] 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();