From b0bf5d028285c19b5e1d53e68b2addf132747068 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 21 Apr 2018 15:55:59 +0300 Subject: [PATCH 1/4] -print --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 014efac2d..d243dc564 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4128,7 +4128,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) if ( (pindex= miSelf->second) == 0 ) // create pindex so first Accept block doesnt fail { miSelf->second = AddToBlockIndex(*pblock); - fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); + //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); } } } From 2c089649f01693a0ddbbc201dceac60498c3778b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 21 Apr 2018 16:19:16 +0300 Subject: [PATCH 2/4] Fix --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index ecc568f6c..f52c8b649 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1286,7 +1286,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) //if ( height == 0 ) return(-1); } - if ( bhash > bnTarget ) + if ( (ASSETCHAINS_SYMBOL[0] != 0 || height > 792000) && bhash > bnTarget ) { failed = 1; if ( height > 0 && ASSETCHAINS_SYMBOL[0] == 0 ) // for the fast case From 985907e4ec21c3844097fddb652bf67713db99c5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 21 Apr 2018 16:36:54 +0300 Subject: [PATCH 3/4] Fix too strict --- src/komodo_bitcoind.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index f52c8b649..1f4bde79c 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1280,11 +1280,9 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) //fprintf(stderr,"height.%d slowflag.%d possible.%d cmp.%d\n",height,slowflag,possible,bhash > bnTarget); if ( height == 0 && slowflag != 0 ) // we need to assume all prior height is in the block index { - if ( (pprev= mapBlockIndex[pblock->hashPrevBlock]) != 0 ) - height = pprev->nHeight + 1; - fprintf(stderr,"komodo_checkPOW slowflag.%d zeroheight -> calcht.%d \n",slowflag,height); - //if ( height == 0 ) - return(-1); + //if ( (pprev= mapBlockIndex[pblock->hashPrevBlock]) != 0 ) + // height = pprev->nHeight + 1; + return(0); } if ( (ASSETCHAINS_SYMBOL[0] != 0 || height > 792000) && bhash > bnTarget ) { From 28b18b61272fbe783c62fadcc66136135bfbd4de Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 21 Apr 2018 16:55:03 +0300 Subject: [PATCH 4/4] Test --- src/komodo_bitcoind.h | 11 +++++++---- src/komodo_ccdata.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 1f4bde79c..bdc5bdecc 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1278,11 +1278,14 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) bhash = UintToArith256(hash); possible = komodo_block2pubkey33(pubkey33,pblock); //fprintf(stderr,"height.%d slowflag.%d possible.%d cmp.%d\n",height,slowflag,possible,bhash > bnTarget); - if ( height == 0 && slowflag != 0 ) // we need to assume all prior height is in the block index + if ( height == 0 ) { - //if ( (pprev= mapBlockIndex[pblock->hashPrevBlock]) != 0 ) - // height = pprev->nHeight + 1; - return(0); + if ( slowflag != 0 ) + return(0); + if ( (pprev= mapBlockIndex[pblock->hashPrevBlock]) != 0 ) + height = pprev->nHeight + 1; + if ( height == 0 ) + return(0); } if ( (ASSETCHAINS_SYMBOL[0] != 0 || height > 792000) && bhash > bnTarget ) { diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 75eaffe48..32db78283 100644 --- a/src/komodo_ccdata.h +++ b/src/komodo_ccdata.h @@ -208,6 +208,7 @@ void komodo_purge_ccdata(int32_t height) int32_t komodo_rwccdata(char *thischain,int32_t rwflag,struct komodo_ccdata *ccdata,struct komodo_ccdataMoMoM *MoMoMdata) { uint256 hash,zero; bits256 tmp; int32_t i,nonz; struct komodo_ccdata *ptr; struct notarized_checkpoint *np; + return(0); // disable this path as libscott method is much better if ( rwflag == 0 ) { // load from disk