From 4ff37947b10c03df679003289e2e79590ff73115 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 8 Jul 2018 04:32:02 -1100 Subject: [PATCH 1/5] -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 d742914e8..1f6680134 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -567,7 +567,7 @@ uint32_t komodo_txtime(uint64_t *valuep,uint256 hash,int32_t n,char *destaddr) #endif hashBlock, true)) { - fprintf(stderr,"ERROR: %s/v%d locktime.%u\n",hash.ToString().c_str(),n,(uint32_t)tx.nLockTime); + //fprintf(stderr,"ERROR: %s/v%d locktime.%u\n",hash.ToString().c_str(),n,(uint32_t)tx.nLockTime); return(0); } //fprintf(stderr,"%s/v%d locktime.%u\n",hash.ToString().c_str(),n,(uint32_t)tx.nLockTime); From 5aa69f6d75c8c5839bc00e61c2e93a0830949b66 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 8 Jul 2018 04:34:27 -1100 Subject: [PATCH 2/5] -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 1f6680134..2b4cf8cbc 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1490,7 +1490,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) { if ( KOMODO_TEST_ASSETCHAIN_SKIP_POW ) return(0); - fprintf(stderr,"pow violation and no chance it is notary ht.%d %s\n",height,hash.ToString().c_str()); + //fprintf(stderr,"pow violation and no chance it is notary ht.%d %s\n",height,hash.ToString().c_str()); return(-1); } } From 45ee62cb719499b3ff2fde6168e2ef9aa0364076 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 8 Jul 2018 16:17:39 -1100 Subject: [PATCH 3/5] Ht 6000 test --- src/komodo_bitcoind.h | 20 ++++++-------------- src/miner.cpp | 11 ++--------- src/pow.cpp | 2 -- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 2b4cf8cbc..0f3033914 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1140,15 +1140,16 @@ uint32_t komodo_newstake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHe { CBlockIndex *pindex; bool fNegative,fOverflow; uint8_t hashbuf[256]; char address[64]; bits256 addrhash; arith_uint256 hashval; uint256 hash,pasthash; int64_t diff=0; int32_t segid,minage,i,iter=0; uint32_t mfactor=64,txtime,winner = 0; arith_uint256 bnMaxPoSdiff; uint64_t value,coinage,supply = ASSETCHAINS_SUPPLY + nHeight*ASSETCHAINS_REWARD/SATOSHIDEN; txtime = komodo_txtime(&value,txid,vout,address); - if ( blocktime < prevtime+60 ) - blocktime = prevtime+60; + if ( nHeight < 6000 ) + { + if ( blocktime < prevtime+60 ) + blocktime = prevtime+60; + } 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 ( nHeight < 4400 ) // POSTEST64 change newstake to stake and stake to oldstake and remove - bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); mfactor = 1024; if ( (minage= nHeight*3) > 6000 ) // about 100 blocks minage = 6000; @@ -1449,16 +1450,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) return(-1); } hash = pblock->GetHash(); - /*if ( ASSETCHAINS_STAKED == 100 && height >= 4250 && height < 4400 ) // POSTEST64 - { - bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); - fprintf(stderr,"setmindiff ht.%d\n",height); - } - else*/ - { - bnTarget.SetCompact(pblock->nBits,&fNegative,&fOverflow); - //fprintf(stderr,"set diff ht.%d slowflag.%d\n",height,slowflag); - } + bnTarget.SetCompact(pblock->nBits,&fNegative,&fOverflow); bhash = UintToArith256(hash); possible = komodo_block2pubkey33(pubkey33,pblock); //fprintf(stderr,"height.%d slowflag.%d possible.%d cmp.%d\n",height,slowflag,possible,bhash > bnTarget); diff --git a/src/miner.cpp b/src/miner.cpp index 2fb623b84..5e7871dd4 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -425,7 +425,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) if ( (siglen= komodo_staked(txStaked,pblock->nBits,&blocktime,&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 ) { CAmount txfees = 0; - if ( (int32_t)chainActive.Tip()->nHeight+1 > 100 && GetAdjustedTime() < blocktime-13 ) + if ( (int32_t)chainActive.Tip()->nHeight+1 > 100 && GetAdjustedTime() < blocktime-30 ) return(0); pblock->vtx.push_back(txStaked); pblocktemplate->vTxFees.push_back(txfees); @@ -914,14 +914,7 @@ void static BitcoinMiner() if ( ASSETCHAINS_STAKED != 0 && GetArg("-genproclimit", 0) == 0 ) { int32_t percPoS,z; - /*if ( Mining_height <= 100 ) - { - sleep(60); - continue; - }*/ HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED); - if ( Mining_height >= 4000 && Mining_height < 4400 ) // POSTEST64 remove this - HASHTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS); if ( ASSETCHAINS_STAKED < 100 ) { for (z=31; z>=0; z--) @@ -984,7 +977,7 @@ void static BitcoinMiner() return false; if ( B.nTime > GetAdjustedTime() ) { - fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetAdjustedTime())); + //fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetAdjustedTime())); while ( GetAdjustedTime() < B.nTime-2 ) { sleep(1); diff --git a/src/pow.cpp b/src/pow.cpp index a6117b35c..2e525e8cb 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -190,8 +190,6 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int } if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) return error("CheckProofOfWork(): nBits below minimum work"); - if ( ASSETCHAINS_STAKED != 0 && height >= 4200 && height < 4400 ) // POSTEST64 remove this - bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { From 7ed0e00b8201a1c6e5f7c63d040c59a04e71c9c1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 8 Jul 2018 16:23:30 -1100 Subject: [PATCH 4/5] Test --- src/komodo_bitcoind.h | 2 ++ src/pow.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 0f3033914..b95efc8d1 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1150,6 +1150,8 @@ uint32_t komodo_newstake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHe //fprintf(stderr,"komodo_stake null %.8f %u %u %u\n",dstr(value),txtime,blocktime,prevtime); return(0); } + if ( nHeight < 4400 ) // POSTEST64 change newstake to stake and stake to oldstake and remove + bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); mfactor = 1024; if ( (minage= nHeight*3) > 6000 ) // about 100 blocks minage = 6000; diff --git a/src/pow.cpp b/src/pow.cpp index 2e525e8cb..a6117b35c 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -190,6 +190,8 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int } if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) return error("CheckProofOfWork(): nBits below minimum work"); + if ( ASSETCHAINS_STAKED != 0 && height >= 4200 && height < 4400 ) // POSTEST64 remove this + bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { From 4646f21b5bd0b210e56336cdeeab914eb1ffcfde Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 8 Jul 2018 16:30:41 -1100 Subject: [PATCH 5/5] Height 6000 disable 60 sec delay --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index b95efc8d1..e1249a955 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1125,13 +1125,13 @@ int32_t komodo_segids(uint8_t *hashbuf,int32_t height,int32_t n) for (i=0; i