From 627aaf734b425f0bb608f17ed73576de3c295988 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 31 May 2018 05:07:18 -1100 Subject: [PATCH 01/29] Skip invalid Ccid compare --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index efb59dee1..248396812 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -645,8 +645,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr if ( len+sizeof(ccdata.CCid)-opoffset <= opretlen ) { len += iguana_rwnum(0,&scriptbuf[len],sizeof(ccdata.CCid),(uint8_t *)&ccdata.CCid); - if ( ((MoMdepth>>16) & 0xffff) != (ccdata.CCid & 0xffff) ) - fprintf(stderr,"%s CCid mismatch %u != %u\n",ASSETCHAINS_SYMBOL,((MoMdepth>>16) & 0xffff),(ccdata.CCid & 0xffff)); + //if ( ((MoMdepth>>16) & 0xffff) != (ccdata.CCid & 0xffff) ) + // fprintf(stderr,"%s CCid mismatch %u != %u\n",ASSETCHAINS_SYMBOL,((MoMdepth>>16) & 0xffff),(ccdata.CCid & 0xffff)); ccdata.len = sizeof(ccdata.CCid); if ( ASSETCHAINS_SYMBOL[0] != 0 ) { From fe98fc34b916c3f480df1ee65b4e9b56d363626d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 03:30:25 -1100 Subject: [PATCH 02/29] Nameoffset --- src/komodo.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 248396812..9b069624b 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -603,9 +603,12 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } offset = 32 * (1 + matched) + 4; nameoffset = (int32_t)strlen((char *)&scriptbuf[len+offset]); - if ( nameoffset == 2 ) + /*if ( nameoffset == 2 ) nameoffset += 2; - else nameoffset++; + else if ( nameoffset == 1 ) + nameoffset += 3; + else*/ + nameoffset++; memset(&ccdata,0,sizeof(ccdata)); strncpy(ccdata.symbol,(char *)&scriptbuf[len+offset],sizeof(ccdata.symbol)); if ( j == 1 && opretlen >= len+offset-opoffset ) @@ -635,7 +638,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr ccdata.MoMdata.notarized_height = *notarizedheightp; ccdata.MoMdata.height = height; ccdata.MoMdata.txi = i; - //printf("nameoffset.%d len.%d + 36 %d vs opretlen.%d\n",nameoffset,len,len+36,opretlen); + printf("nameoffset.%d len.%d + 36 %d opoffset.%d vs opretlen.%d\n",nameoffset,len,len+36,opoffset,opretlen); if ( len+36-opoffset <= opretlen ) { len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&MoM); From 4a15f78eada27e2a254b2621ae57e75c38fecc8e Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:02:42 -1100 Subject: [PATCH 03/29] Kv test --- src/komodo.h | 9 ++------- src/komodo_kv.h | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 9b069624b..c6c523683 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -603,12 +603,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } offset = 32 * (1 + matched) + 4; nameoffset = (int32_t)strlen((char *)&scriptbuf[len+offset]); - /*if ( nameoffset == 2 ) - nameoffset += 2; - else if ( nameoffset == 1 ) - nameoffset += 3; - else*/ - nameoffset++; + nameoffset++; memset(&ccdata,0,sizeof(ccdata)); strncpy(ccdata.symbol,(char *)&scriptbuf[len+offset],sizeof(ccdata.symbol)); if ( j == 1 && opretlen >= len+offset-opoffset ) @@ -638,7 +633,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr ccdata.MoMdata.notarized_height = *notarizedheightp; ccdata.MoMdata.height = height; ccdata.MoMdata.txi = i; - printf("nameoffset.%d len.%d + 36 %d opoffset.%d vs opretlen.%d\n",nameoffset,len,len+36,opoffset,opretlen); + //printf("nameoffset.%d len.%d + 36 %d opoffset.%d vs opretlen.%d\n",nameoffset,len,len+36,opoffset,opretlen); if ( len+36-opoffset <= opretlen ) { len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&MoM); diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 58d550414..dbcf99f6c 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -64,7 +64,7 @@ int32_t komodo_kvsearch(uint256 *pubkeyp,int32_t current_height,uint32_t *flagsp if ( ptr != 0 ) { duration = komodo_kvduration(ptr->flags); - //printf("duration.%d flags.%d current.%d ht.%d keylen.%d valuesize.%d\n",duration,ptr->flags,current_height,ptr->height,ptr->keylen,ptr->valuesize); + printf("duration.%d flags.%d current.%d ht.%d keylen.%d valuesize.%d\n",duration,ptr->flags,current_height,ptr->height,ptr->keylen,ptr->valuesize); if ( current_height > (ptr->height + duration) ) { HASH_DELETE(hh,KOMODO_KV,ptr); @@ -171,7 +171,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) memcpy(ptr->key,key,keylen); newflag = 1; HASH_ADD_KEYPTR(hh,KOMODO_KV,ptr->key,ptr->keylen,ptr); - //printf("KV add.(%s) (%s)\n",ptr->key,valueptr); + printf("KV add.(%s) (%s)\n",ptr->key,valueptr); } if ( newflag != 0 || (ptr->flags & KOMODO_KVPROTECTED) == 0 ) { From 29806831f29e0f3acfa009d03102df9f1dc6f529 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:08:08 -1100 Subject: [PATCH 04/29] Print --- src/komodo_kv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index dbcf99f6c..0b0b21161 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -64,7 +64,7 @@ int32_t komodo_kvsearch(uint256 *pubkeyp,int32_t current_height,uint32_t *flagsp if ( ptr != 0 ) { duration = komodo_kvduration(ptr->flags); - printf("duration.%d flags.%d current.%d ht.%d keylen.%d valuesize.%d\n",duration,ptr->flags,current_height,ptr->height,ptr->keylen,ptr->valuesize); + fprintf(stderr,"duration.%d flags.%d current.%d ht.%d keylen.%d valuesize.%d\n",duration,ptr->flags,current_height,ptr->height,ptr->keylen,ptr->valuesize); if ( current_height > (ptr->height + duration) ) { HASH_DELETE(hh,KOMODO_KV,ptr); @@ -171,7 +171,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) memcpy(ptr->key,key,keylen); newflag = 1; HASH_ADD_KEYPTR(hh,KOMODO_KV,ptr->key,ptr->keylen,ptr); - printf("KV add.(%s) (%s)\n",ptr->key,valueptr); + fprintf(stderr,"KV add.(%s) (%s)\n",ptr->key,valueptr); } if ( newflag != 0 || (ptr->flags & KOMODO_KVPROTECTED) == 0 ) { From ebe5e09afe2cc5694ebecfb45ef60f6e40d8a839 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:10:52 -1100 Subject: [PATCH 05/29] Test --- src/komodo_kv.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 0b0b21161..116924b5a 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -88,7 +88,7 @@ int32_t komodo_kvsearch(uint256 *pubkeyp,int32_t current_height,uint32_t *flagsp if ( (retval= ptr->valuesize) > 0 ) memcpy(value,ptr->value,retval); } - } + } else fprintf(stderr,"couldnt find (%s)\n",(char *)key); portable_mutex_unlock(&KOMODO_KV_mutex); if ( retval < 0 ) { @@ -151,6 +151,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) HASH_FIND(hh,KOMODO_KV,key,keylen,ptr); if ( ptr != 0 ) { + fprintf(stderr,"(%s) already there\n",(char *)key); //if ( (ptr->flags & KOMODO_KVPROTECTED) != 0 ) { tstr = (char *)"transfer:"; From 3f1012ff4c136b2e7d7630b4816a7e0621171ac2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:15:07 -1100 Subject: [PATCH 06/29] Test --- src/komodo_kv.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 116924b5a..80fac5ff8 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -111,13 +111,13 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) if ( keylen+13 > opretlen ) { static uint32_t counter; - if ( ++counter < 1 ) - printf("komodo_kvupdate: keylen.%d + 13 > opretlen.%d, this can be ignored\n",keylen,opretlen); + if ( ++counter < 100 ) + fprintf(stderr,"komodo_kvupdate: keylen.%d + 13 > opretlen.%d, this can be ignored\n",keylen,opretlen); return; } valueptr = &key[keylen]; fee = komodo_kvfee(flags,opretlen,keylen); - //printf("fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]); + printf("fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]); if ( value >= fee ) { coresize = (int32_t)(sizeof(flags)+sizeof(height)+sizeof(keylen)+sizeof(valuesize)+keylen+valuesize+1); @@ -142,7 +142,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) { if ( komodo_kvsigverify(keyvalue,keylen+refvaluesize,refpubkey,sig) < 0 ) { - printf("komodo_kvsigverify error [%d]\n",coresize-13); + fprintf(stderr,"komodo_kvsigverify error [%d]\n",coresize-13); return; } } @@ -194,7 +194,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) ptr->height = height; ptr->flags = flags; // jl777 used to or in KVPROTECTED portable_mutex_unlock(&KOMODO_KV_mutex); - } else fprintf(stderr,"size mismatch %d vs %d\n",opretlen,coresize); + } else fprintf(stderr,"KV update size mismatch %d vs %d\n",opretlen,coresize); } else fprintf(stderr,"not enough fee\n"); } From 4263c6935d12c93287b071f69a106199698656cc Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:19:53 -1100 Subject: [PATCH 07/29] Prints --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index c6c523683..79d511db2 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -311,7 +311,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long { if ( memread(opret,olen,filedata,&fpos,datalen) != olen ) errs++; - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 ) + if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 ) { int32_t i; for (i=0; i Date: Fri, 1 Jun 2018 04:29:16 -1100 Subject: [PATCH 08/29] Fix state update --- src/komodo.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 79d511db2..c94dc0ece 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -717,13 +717,13 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr fwrite(&signedmask,1,sizeof(signedmask),signedfp); fflush(signedfp); } - if ( opretlen > len && scriptbuf[len] == 'A' ) - { - //for (i=0; i len && scriptbuf[len] == 'A' ) + { + for (i=0; i 600000 && matched != 0 ) From dd801e5d470238ae096b9875300e318d9b107e7d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:43:42 -1100 Subject: [PATCH 09/29] Test --- src/komodo.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index c94dc0ece..0a0fa2cd8 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -601,6 +601,11 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr if ( strcmp(ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) matched = 1; } + if ( scriptbuf[len] == 'K' ) + { + fprintf(stderr,"KV OPRET len.%d\n",opretlen); + return(-1); + } offset = 32 * (1 + matched) + 4; nameoffset = (int32_t)strlen((char *)&scriptbuf[len+offset]); nameoffset++; @@ -717,13 +722,13 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr fwrite(&signedmask,1,sizeof(signedmask),signedfp); fflush(signedfp); } - } - if ( opretlen > len && scriptbuf[len] == 'A' ) - { - for (i=0; i len && scriptbuf[len] == 'A' ) + { + //for (i=0; i 600000 && matched != 0 ) From b8fef917d954595dafb583d7b13ed90ef825fcb8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 04:46:41 -1100 Subject: [PATCH 10/29] Test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 0a0fa2cd8..d69768e8f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -603,7 +603,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } if ( scriptbuf[len] == 'K' ) { - fprintf(stderr,"KV OPRET len.%d\n",opretlen); + fprintf(stderr,"i.%d j.%d KV OPRET len.%d %.8f\n",i,j,opretlen,dstr(value)); return(-1); } offset = 32 * (1 + matched) + 4; From 265f4e9675a2c525396d925a1baf4da74e6f3608 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 05:44:42 -1100 Subject: [PATCH 11/29] Print --- src/miner.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 081796aaa..79e5d619c 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -957,9 +957,7 @@ void static BitcoinMiner() solutionTargetChecks.increment(); B = *pblock; h = UintToArith256(B.GetHash()); - if ( h > hashTarget ) - return false; - /*for (z=31; z>=16; z--) + for (z=31; z>=16; z--) fprintf(stderr,"%02x",((uint8_t *)&h)[z]); fprintf(stderr," mined "); for (z=31; z>=16; z--) @@ -967,7 +965,9 @@ void static BitcoinMiner() fprintf(stderr," hashTarget "); for (z=31; z>=16; z--) fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); - fprintf(stderr," POW\n");*/ + fprintf(stderr," POW\n"); + if ( h > hashTarget ) + return false; if ( NOTARY_PUBKEY33[0] != 0 && B.nTime > GetAdjustedTime() ) { fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetAdjustedTime())); From 2515c9f22a161519a2f893a22bab172fb3885342 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 05:52:39 -1100 Subject: [PATCH 12/29] First 10 blocks as normal --- src/komodo_bitcoind.h | 2 +- src/miner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 24f510b8b..5f96bf2b8 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1147,7 +1147,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he { CBlockIndex *pindex; arith_uint256 bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,ht,percPoS,diff,val; *percPoSp = percPoS = 0; - if ( height < 3 ) + if ( height < 10 ) return(target); sum = arith_uint256(0); ave = sum; diff --git a/src/miner.cpp b/src/miner.cpp index 79e5d619c..9dd800cdd 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -940,7 +940,7 @@ void static BitcoinMiner() // (x_1, x_2, ...) = A(I, V, n, k) LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); arith_uint256 hashTarget; - if ( NOTARY_PUBKEY33[0] == 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 ) + if ( NOTARY_PUBKEY33[0] == 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 ) hashTarget = HASHTarget_POW; else hashTarget = HASHTarget; std::function)> validBlock = From e83bf6b3cbbc701dd0eae09a5ef0010625af8317 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:05:23 -1100 Subject: [PATCH 13/29] Fix PoS PoW diff --- src/komodo_bitcoind.h | 5 ++++- src/main.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5f96bf2b8..5b605a4aa 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1154,6 +1154,8 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he for (i=n=0; i<100; i++) { ht = height - 100 + i; + if ( ht <= 1 ) + continue; if ( (pindex= komodo_chainactive(ht)) != 0 ) { bnTarget.SetCompact(pindex->nBits,&fNegative,&fOverflow); @@ -1341,7 +1343,8 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) { if ( slowflag != 0 ) bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); - else bnTarget = (bnTarget / arith_uint256(KOMODO_POWMINMULT)); // lower bound + else if ( height > 100 ) + bnTarget = (bnTarget / arith_uint256(KOMODO_POWMINMULT)); // lower bound if ( bhash > bnTarget ) { for (i=31; i>=16; i--) diff --git a/src/main.cpp b/src/main.cpp index 34d939431..12433f1e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4273,7 +4273,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo if ( checked != 0 && komodo_checkPOW(from_miner && ASSETCHAINS_STAKED == 0,pblock,height) < 0 ) { checked = 0; - fprintf(stderr,"passed checkblock but failed checkPOW.%d\n",from_miner && ASSETCHAINS_STAKED == 0); + //fprintf(stderr,"passed checkblock but failed checkPOW.%d\n",from_miner && ASSETCHAINS_STAKED == 0); } if (!checked && futureblock == 0) { From 3753f56834d0baf9452098c962cd8a6249988a41 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:16:44 -1100 Subject: [PATCH 14/29] Test --- src/komodo_bitcoind.h | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5b605a4aa..83f3bb518 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1147,7 +1147,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he { CBlockIndex *pindex; arith_uint256 bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,ht,percPoS,diff,val; *percPoSp = percPoS = 0; - if ( height < 10 ) + if ( height <= 10 ) return(target); sum = arith_uint256(0); ave = sum; @@ -1161,7 +1161,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he bnTarget.SetCompact(pindex->nBits,&fNegative,&fOverflow); bnTarget = (bnTarget / arith_uint256(KOMODO_POWMINMULT)); hashval = UintToArith256(pindex->GetBlockHash()); - if ( hashval <= bnTarget ) // PoW is never as easy as PoS/64, some PoS will be counted as PoW + if ( hashval <= bnTarget ) // PoW is never as easy as PoS/16, some PoS will be counted as PoW { fprintf(stderr,"1"); sum += hashval; @@ -1176,7 +1176,9 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he fprintf(stderr," %d, ",percPoS); } } - fprintf(stderr," -> %d%% percPoS ht.%d\n",percPoS,height); + if ( n < 100 ) + percPoS = ((percPoS * n) + (goalperc * (100-n))) / 100; + fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height); *percPoSp = percPoS; target = (target / arith_uint256(KOMODO_POWMINMULT)); if ( n > 0 ) @@ -1188,16 +1190,6 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget { bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256((goalperc) * (goalperc)); - /*if ( height > 1165 ) - { - if ( height > 1180 ) - { - if ( height > 1230 ) - bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256((goalperc) * (goalperc)); - else bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256(goalperc * goalperc); - } - else bnTarget = (ave * arith_uint256(goalperc * goalperc)) / arith_uint256(2 * (percPoS + goalperc) * (percPoS + goalperc)); - } else bnTarget = (ave * arith_uint256(goalperc)) / arith_uint256(percPoS + goalperc);*/ if ( 1 ) { for (i=31; i>=24; i--) From a2ec2aaad257d27d787e9dd9656d2c56d10db28c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:25:31 -1100 Subject: [PATCH 15/29] Stake best utxo --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 9dd800cdd..3c07fbb16 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -415,14 +415,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if ( (siglen= komodo_staked(txStaked,pblock->nBits,&blocktime,&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 ) { CAmount txfees = 0; - if ( GetAdjustedTime() < blocktime-13 ) + if ( (int32_t)chainActive.Tip()->nHeight+1 > 100 && GetAdjustedTime() < blocktime-13 ) return(0); pblock->vtx.push_back(txStaked); pblocktemplate->vTxFees.push_back(txfees); pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked)); nFees += txfees; pblock->nTime = blocktime; - //printf("PoS ht.%d t%u\n",(int32_t)chainActive.Tip()->nHeight+1,blocktime); + printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.Tip()->nHeight+1,blocktime,GetAdjustedTime() - (blocktime-13)); } else return(0); //fprintf(stderr,"no utxos eligible for staking\n"); } From 535f0c1a2c31188f53c27c1eb75cf89771f737a5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:26:38 -1100 Subject: [PATCH 16/29] Syntax --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 3c07fbb16..08f3da2be 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -422,7 +422,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked)); nFees += txfees; pblock->nTime = blocktime; - printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.Tip()->nHeight+1,blocktime,GetAdjustedTime() - (blocktime-13)); + printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.Tip()->nHeight+1,blocktime,(uint32_t)(GetAdjustedTime() - (blocktime-13))); } else return(0); //fprintf(stderr,"no utxos eligible for staking\n"); } From 7e679101e1a2afab6893e82d582945c81b0920a2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:33:50 -1100 Subject: [PATCH 17/29] Print --- src/komodo_bitcoind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 83f3bb518..fd8b19a55 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1128,7 +1128,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh } } //fprintf(stderr,"iterated until i.%d winner.%d\n",i,winner); - if ( 0 ) + if ( 1 ) { for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); @@ -1138,7 +1138,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d t.%u %.8f diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,blocktime,dstr(value),(int32_t)diff); } } - if ( nHeight < 2 ) + if ( nHeight < 10 ) return(blocktime); return(blocktime * winner); } From 2214fc14b8d44ce081566a7abd116641f648a2c6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:39:23 -1100 Subject: [PATCH 18/29] Prints --- src/miner.cpp | 2 -- src/wallet/rpcwallet.cpp | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 08f3da2be..dfad0f402 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -410,8 +410,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid,revtxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr; CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); - //if ( blocktime > pindexPrev->GetMedianTimePast()+60 ) - // blocktime = pindexPrev->GetMedianTimePast() + 60; if ( (siglen= komodo_staked(txStaked,pblock->nBits,&blocktime,&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 ) { CAmount txfees = 0; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 0b3b45a80..bac222f63 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4590,7 +4590,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt { if ( eligible != komodo_stake(1,bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,eligible,(uint32_t)tipindex->nTime,(char *)CBitcoinAddress(address).ToString().c_str()) ) { - //fprintf(stderr,"tip.%d validation of winning blocktime failed %u -> eligible.%u\n",(uint32_t)tipindex->nHeight,*blocktimep,eligible); + fprintf(stderr,"tip.%d validation of winning blocktime failed %u -> eligible.%u\n",(uint32_t)tipindex->nHeight,*blocktimep,eligible); } else if ( earliest == 0 || eligible < earliest || (eligible == earliest && (*utxovaluep == 0 || nValue < *utxovaluep)) ) { @@ -4632,9 +4632,9 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt for (i=0; i Date: Fri, 1 Jun 2018 06:45:45 -1100 Subject: [PATCH 19/29] -print --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index dfad0f402..ef943b3aa 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -955,7 +955,7 @@ void static BitcoinMiner() solutionTargetChecks.increment(); B = *pblock; h = UintToArith256(B.GetHash()); - for (z=31; z>=16; z--) + /*for (z=31; z>=16; z--) fprintf(stderr,"%02x",((uint8_t *)&h)[z]); fprintf(stderr," mined "); for (z=31; z>=16; z--) @@ -963,7 +963,7 @@ void static BitcoinMiner() fprintf(stderr," hashTarget "); for (z=31; z>=16; z--) fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); - fprintf(stderr," POW\n"); + fprintf(stderr," POW\n");*/ if ( h > hashTarget ) return false; if ( NOTARY_PUBKEY33[0] != 0 && B.nTime > GetAdjustedTime() ) From 2e4cc2a27f65b18335190497036139cc9c2ece94 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:54:14 -1100 Subject: [PATCH 20/29] Test --- src/wallet/rpcwallet.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index bac222f63..b09e656b8 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4550,7 +4550,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig) { - set setAddress; int32_t i,siglen=0,nMinDepth = 1,nMaxDepth = 9999999; vector vecOutputs; uint32_t eligible,earliest = 0; CScript best_scriptPubKey; arith_uint256 bnTarget; bool fNegative,fOverflow; + set setAddress; int32_t i,siglen=0,nMinDepth = 1,nMaxDepth = 99999999; vector vecOutputs; uint32_t eligible,earliest = 0; CScript best_scriptPubKey; arith_uint256 bnTarget; bool fNegative,fOverflow; bnTarget.SetCompact(nBits, &fNegative, &fOverflow); assert(pwalletMain != NULL); LOCK2(cs_main, pwalletMain->cs_wallet); @@ -4562,14 +4562,23 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt BOOST_FOREACH(const COutput& out, vecOutputs) { if ( out.nDepth < nMinDepth || out.nDepth > nMaxDepth ) + { + fprintf(stderr,"komodo_staked invalid depth %d\n",(int32_t)out.nDepth); continue; + } if ( setAddress.size() ) { CTxDestination address; if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) + { + fprintf(stderr,"komodo_staked ExtractDestination error\n"); continue; + } if (!setAddress.count(address)) + { + fprintf(stderr,"komodo_staked setAddress.count error\n"); continue; + } } CAmount nValue = out.tx->vout[out.i].nValue; const CScript& pk = out.tx->vout[out.i].scriptPubKey; @@ -4602,8 +4611,8 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt *txtimep = (uint32_t)out.tx->nLockTime; fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep); } - } - } + } else fprintf(stderr,"%s not eligible\n",out.tx->GetHash().c_str()); + } else fprintf(stderr,"no tipindex\n"); } if ( earliest != 0 ) { From 65777b40ab38cbea4b5d93969da99c4e85826b7a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:56:35 -1100 Subject: [PATCH 21/29] Syntax --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b09e656b8..5bb4a74aa 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4611,7 +4611,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt *txtimep = (uint32_t)out.tx->nLockTime; fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep); } - } else fprintf(stderr,"%s not eligible\n",out.tx->GetHash().c_str()); + } else fprintf(stderr,"%s not eligible\n",out.tx->GetHash()); } else fprintf(stderr,"no tipindex\n"); } if ( earliest != 0 ) From 3851fb86e406f552421a642ad0a22cb4678624d8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 06:58:50 -1100 Subject: [PATCH 22/29] Test --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5bb4a74aa..0ea28b696 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4611,7 +4611,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt *txtimep = (uint32_t)out.tx->nLockTime; fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep); } - } else fprintf(stderr,"%s not eligible\n",out.tx->GetHash()); + } else fprintf(stderr,"utxo not eligible\n"); } else fprintf(stderr,"no tipindex\n"); } if ( earliest != 0 ) From 985990dded76c10254508b60a9236e1e7653c302 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:03:34 -1100 Subject: [PATCH 23/29] +print --- src/komodo_bitcoind.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index fd8b19a55..0ddcb7ffe 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1087,9 +1087,13 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh if ( blocktime < prevtime+57 ) blocktime = prevtime+57; if ( value == 0 || txtime == 0 || blocktime == 0 || prevtime == 0 ) + { + fprintf(stderr,"komodo_stake null %.8f %u %u %u\n",dstr(value),txtime,blocktime,prevtime); return(0); + } if ( (minage= nHeight*3) > 6000 ) minage = 6000; + pindex = 0; if ( blocktime > txtime+minage && (pindex= komodo_chainactive(nHeight>200?nHeight-200:1)) != 0 ) { vcalc_sha256(0,(uint8_t *)&addrhash,(uint8_t *)address,(int32_t)strlen(address)); @@ -1137,7 +1141,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d t.%u %.8f diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,blocktime,dstr(value),(int32_t)diff); } - } + } else fprintf(stderr,"skip PoS scan: blocktime %u > %u txtime+minage %u\n",blocktime,txtime,minage); if ( nHeight < 10 ) return(blocktime); return(blocktime * winner); From 012026ed973161f14c50f4aa975ff16acbb81e09 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:03:52 -1100 Subject: [PATCH 24/29] -print --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 0ea28b696..6dddc5401 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4611,8 +4611,8 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt *txtimep = (uint32_t)out.tx->nLockTime; fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep); } - } else fprintf(stderr,"utxo not eligible\n"); - } else fprintf(stderr,"no tipindex\n"); + } //else fprintf(stderr,"utxo not eligible\n"); + } //else fprintf(stderr,"no tipindex\n"); } if ( earliest != 0 ) { From 3a9d2c4323d29809009c731dfafb39e25572dec7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:10:15 -1100 Subject: [PATCH 25/29] Test --- src/komodo_bitcoind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 0ddcb7ffe..52678da39 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1094,7 +1094,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh if ( (minage= nHeight*3) > 6000 ) minage = 6000; pindex = 0; - if ( blocktime > txtime+minage && (pindex= komodo_chainactive(nHeight>200?nHeight-200:1)) != 0 ) + if ( blocktime >= txtime+minage && (pindex= komodo_chainactive(nHeight>200?nHeight-200:1)) != 0 ) { vcalc_sha256(0,(uint8_t *)&addrhash,(uint8_t *)address,(int32_t)strlen(address)); segid = ((nHeight + addrhash.uints[0]) & 0x3f); @@ -1141,7 +1141,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d t.%u %.8f diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,blocktime,dstr(value),(int32_t)diff); } - } else fprintf(stderr,"skip PoS scan: blocktime %u > %u txtime+minage %u\n",blocktime,txtime,minage); + } else fprintf(stderr,"skip PoS scan: diff %d blocktime %u > %u txtime+minage %u pindex.%p\n",(int32_t)(blocktime - (txtime+minage)),blocktime,txtime,minage,pindex); if ( nHeight < 10 ) return(blocktime); return(blocktime * winner); From 26a2b5cd68cd713ba18019f46957f02e040575ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:13:08 -1100 Subject: [PATCH 26/29] Test --- src/komodo_bitcoind.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 52678da39..c9b1cf1c5 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1094,7 +1094,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh if ( (minage= nHeight*3) > 6000 ) minage = 6000; pindex = 0; - if ( blocktime >= txtime+minage && (pindex= komodo_chainactive(nHeight>200?nHeight-200:1)) != 0 ) + if ( (pindex= komodo_chainactive(nHeight>200?nHeight-200:1)) != 0 ) { vcalc_sha256(0,(uint8_t *)&addrhash,(uint8_t *)address,(int32_t)strlen(address)); segid = ((nHeight + addrhash.uints[0]) & 0x3f); @@ -1108,6 +1108,8 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh diff = (iter + blocktime - txtime - minage); if ( diff > 3600*24 ) break; + if ( blocktime+iter+segid*2 < txtime+minage ) + continue; coinage = (value * diff) * ((diff >> 16) + 1); hashval = arith_uint256(supply * 64) * (UintToArith256(hash) / arith_uint256(coinage+1)); if ( hashval <= bnTarget ) @@ -1141,7 +1143,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d t.%u %.8f diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,blocktime,dstr(value),(int32_t)diff); } - } else fprintf(stderr,"skip PoS scan: diff %d blocktime %u > %u txtime+minage %u pindex.%p\n",(int32_t)(blocktime - (txtime+minage)),blocktime,txtime,minage,pindex); + } //else fprintf(stderr,"skip PoS scan: diff %d blocktime %u > %u txtime+minage %u pindex.%p\n",(int32_t)(blocktime - (txtime+minage)),blocktime,txtime,minage,pindex); if ( nHeight < 10 ) return(blocktime); return(blocktime * winner); From 9b79591bba1d45663902964d0a169ec6c642abee Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:20:47 -1100 Subject: [PATCH 27/29] Test --- src/komodo_bitcoind.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index c9b1cf1c5..5f9cbae8a 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1106,8 +1106,10 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh for (iter=0; iter<3600; iter++) { diff = (iter + blocktime - txtime - minage); - if ( diff > 3600*24 ) - break; + if ( iter > 0 ) + diff += iter + segid*2; + //if ( diff > 3600*24 ) + // break; if ( blocktime+iter+segid*2 < txtime+minage ) continue; coinage = (value * diff) * ((diff >> 16) + 1); From ad277ac6449ae51588f0c2c4b4b9a141eb5e80a3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:30:49 -1100 Subject: [PATCH 28/29] -print --- 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 5f9cbae8a..a5ef1ccab 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1136,7 +1136,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh } } //fprintf(stderr,"iterated until i.%d winner.%d\n",i,winner); - if ( 1 ) + if ( 0 ) { for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); From 34bcc3094f09d164981f76357a40cdf8d1fc0740 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Jun 2018 07:37:41 -1100 Subject: [PATCH 29/29] -print --- src/wallet/rpcwallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6dddc5401..65dd0e22b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4599,7 +4599,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt { if ( eligible != komodo_stake(1,bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,eligible,(uint32_t)tipindex->nTime,(char *)CBitcoinAddress(address).ToString().c_str()) ) { - fprintf(stderr,"tip.%d validation of winning blocktime failed %u -> eligible.%u\n",(uint32_t)tipindex->nHeight,*blocktimep,eligible); + //fprintf(stderr,"tip.%d validation of winning blocktime failed %u -> eligible.%u\n",(uint32_t)tipindex->nHeight,*blocktimep,eligible); } else if ( earliest == 0 || eligible < earliest || (eligible == earliest && (*utxovaluep == 0 || nValue < *utxovaluep)) ) { @@ -4609,7 +4609,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt decode_hex((uint8_t *)utxotxidp,32,(char *)out.tx->GetHash().GetHex().c_str()); *utxovoutp = out.i; *txtimep = (uint32_t)out.tx->nLockTime; - fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep); + //fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep); } } //else fprintf(stderr,"utxo not eligible\n"); } //else fprintf(stderr,"no tipindex\n"); @@ -4641,7 +4641,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt for (i=0; i