From 41bdbde1345de8c64320a54dc368b44fa2d8a83c Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 30 Nov 2016 08:11:20 -0300 Subject: [PATCH 1/5] test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 30fca14a8..45a32c63b 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -514,7 +514,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) numvalid = bitweight(signedmask); //if ( height == 79633 ) // notarized = 1; - if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/3)) ) + if ( (((height < 95000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/3)) ) { printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); notarized = 1; From 6c0b4a8c8b744ef1d7db86244f75fe2531d59aea Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 30 Nov 2016 08:32:01 -0300 Subject: [PATCH 2/5] test --- src/komodo.h | 2 +- src/komodo_bitcoind.h | 4 ++-- src/komodo_notary.h | 2 +- src/miner.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 45a32c63b..30fca14a8 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -514,7 +514,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) numvalid = bitweight(signedmask); //if ( height == 79633 ) // notarized = 1; - if ( (((height < 95000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/3)) ) + if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/3)) ) { printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); notarized = 1; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a754f24ea..6678abaf2 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -557,11 +557,11 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]) { if ( komodo_minerid(height-i) == notaryid ) { - //fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d\n",height,notaryid,i); + fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d\n",height,notaryid,i); return(-1); } } - //fprintf(stderr,"special notaryid.%d ht.%d limit.%d\n",notaryid,height,limit); + fprintf(stderr,"special notaryid.%d ht.%d limit.%d\n",notaryid,height,limit); return(1); } return(0); diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 6415b9d94..67cc6d8dc 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -108,7 +108,7 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) memcpy(kp->pubkey,pubkeys[k],33); kp->notaryid = k; HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); - if ( 0 && height > 10000 ) + if ( 1 && height > 10000 ) { for (i=0; i<33; i++) printf("%02x",pubkeys[k][i]); diff --git a/src/miner.cpp b/src/miner.cpp index 3f4a8975a..a0588bcba 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -473,7 +473,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) script[34] = OP_CHECKSIG; //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } - if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) + if ( 1 && ASSETCHAINS_SYMBOL[0] == 0 ) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i)); From 6c96293f9355f70a81fb93aa74b7d6a0f407083b Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 30 Nov 2016 08:37:22 -0300 Subject: [PATCH 3/5] test --- src/pow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index a5d75e7ba..644a3f59d 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -108,7 +108,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]); int32_t komodo_currentheight(); extern int32_t KOMODO_CHOSEN_ONE; -//extern int8_t Minerids[1024 * 1024 * 5]; // 5 million blocks +#define KOMODO_ELECTION_GAP 2000 bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { @@ -128,12 +128,12 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in } if ( nonz == 0 ) return(true); // will come back via different path with pubkey set - if ( notaryid >= 0 ) + if ( notaryid >= 0 && ((height % KOMODO_ELECTION_GAP) == 0 || (height % KOMODO_ELECTION_GAP) > 64) ) { special2 = komodo_is_special(height,pubkey33); - if ( special2 == -2 ) - printf("height.%d special2.%d special.%d\n",height,special2,special); - if ( special2 == -2 || (height < 80000 && (special != 0 || special2 > 0)) || + //if ( special2 == -2 ) + // printf("height.%d special2.%d special.%d\n",height,special2,special); + if ( (height % KOMODO_ELECTION_GAP) == 0 || (height < 80000 && (special != 0 || special2 > 0)) || (height >= 80000 && special2 > 0) ) { bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); From ce6f853d4f942f88ec7d7e48c44f95f4d25f3f19 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 30 Nov 2016 08:39:12 -0300 Subject: [PATCH 4/5] test --- src/pow.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index 644a3f59d..0a9e5ee28 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -128,13 +128,12 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in } if ( nonz == 0 ) return(true); // will come back via different path with pubkey set - if ( notaryid >= 0 && ((height % KOMODO_ELECTION_GAP) == 0 || (height % KOMODO_ELECTION_GAP) > 64) ) + if ( notaryid >= 0 && (height <= 90000 || (height % KOMODO_ELECTION_GAP) > 64) ) { special2 = komodo_is_special(height,pubkey33); //if ( special2 == -2 ) // printf("height.%d special2.%d special.%d\n",height,special2,special); - if ( (height % KOMODO_ELECTION_GAP) == 0 || (height < 80000 && (special != 0 || special2 > 0)) || - (height >= 80000 && special2 > 0) ) + if ( height < 90000 || (height % KOMODO_ELECTION_GAP) == 0 || (height < 80000 && (special != 0 || special2 > 0)) || (height >= 80000 && special2 > 0) ) { bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); flag = 1; From c0225afd134a0ef6ed60ac14064ca3b83f7bc137 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 30 Nov 2016 08:42:33 -0300 Subject: [PATCH 5/5] test --- src/komodo_notary.h | 2 +- src/miner.cpp | 2 +- src/pow.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 67cc6d8dc..6415b9d94 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -108,7 +108,7 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) memcpy(kp->pubkey,pubkeys[k],33); kp->notaryid = k; HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); - if ( 1 && height > 10000 ) + if ( 0 && height > 10000 ) { for (i=0; i<33; i++) printf("%02x",pubkeys[k][i]); diff --git a/src/miner.cpp b/src/miner.cpp index a0588bcba..3f4a8975a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -473,7 +473,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) script[34] = OP_CHECKSIG; //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } - if ( 1 && ASSETCHAINS_SYMBOL[0] == 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i)); diff --git a/src/pow.cpp b/src/pow.cpp index 0a9e5ee28..e9d0e7eef 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -128,9 +128,9 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in } if ( nonz == 0 ) return(true); // will come back via different path with pubkey set + special2 = komodo_is_special(height,pubkey33); if ( notaryid >= 0 && (height <= 90000 || (height % KOMODO_ELECTION_GAP) > 64) ) { - special2 = komodo_is_special(height,pubkey33); //if ( special2 == -2 ) // printf("height.%d special2.%d special.%d\n",height,special2,special); if ( height < 90000 || (height % KOMODO_ELECTION_GAP) == 0 || (height < 80000 && (special != 0 || special2 > 0)) || (height >= 80000 && special2 > 0) )