From 7f18fdc40651e97beb588223d1c19337e6736198 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 20 Oct 2016 12:20:58 -0300 Subject: [PATCH] test --- src/komodo.h | 52 ++-------------------------------------------------- src/pow.cpp | 2 +- 2 files changed, 3 insertions(+), 51 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 129bd832e..99097488d 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -20,6 +20,7 @@ #include #define KOMODO_TESTNET_EXPIRATION 60000 +#define KOMODOE_PUBKEYS_HEIGHT(height) (((((height)+500)/1000) + 1) * 1000) int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,NOTARIZED_HEIGHT,Num_nutxos,KOMODO_NUMNOTARIES = 64; std::string NOTARY_PUBKEY; @@ -504,7 +505,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) memset(&txhash,0,sizeof(txhash)); komodo_stateupdate(height,pubkeys,numvalid,0,txhash,0,0); } - printf("new notaries.%d newheight.%d from height.%d\n",numvouts-1,(((height+500)/1000)+1)*1000,height); + printf("new notaries.%d newheight.%d from height.%d\n",numvouts-1,KOMODO_PUBKEYHEIGHT(height),height); } } } @@ -575,53 +576,4 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) } } -/*int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp) -{ - // 1 -> valid notary block, change nBits to KOMODO_MINDIFF_NBITS - // -1 -> invalid, ie, prior to notarized block - CBlock block; int32_t i,height; char *coinbasestr; - if ( pindex == 0 ) - return(0); - if ( ReadBlockFromDisk(block,pindex,1) == 0 ) - return(0); - if ( block.vtx.size() > 0 ) - { - height = pindex->nHeight; - coinbasestr = (char *)block.vtx[0].vout[0].scriptPubKey.ToString().c_str(); - for (i=0; i<64; i++) - { - if ( Notaries[i][0] == 0 || Notaries[i][1] == 0 || Notaries[i][0][0] == 0 || Notaries[i][1][0] == 0 ) - break; - if ( strncmp(Notaries[i][1],coinbasestr,66) == 0 ) - { - //printf("Notary.[%d] %s ht.%d (%s)\n",i,Notaries[i][0],height,coinbasestr); - //*nBitsp = KOMODO_MINDIFF_NBITS; - return(1); - } - } - } - // compare against elected notary pubkeys as of height - return(0); -} - -int32_t komodo_is_notaryblock(CBlockHeader& blockhdr) -{ - //uint32_t nBits = 0; - //return(komodo_blockindexcheck(mapBlockIndex[blockhdr.GetHash()],&nBits)); - return(0); -} - -int32_t komodo_blockhdrcheck(CBlockHeader& blockhdr,uint32_t *nBitsp) -{ - int32_t retval; - if ( (retval= komodo_is_notaryblock(blockhdr)) > 0 ) - *nBitsp = KOMODO_MINDIFF_NBITS; - return(retval); -} - -int32_t komodo_blockcheck(CBlock& block,uint32_t *nBitsp) -{ - return(komodo_blockhdrcheck(block,nBitsp)); -}*/ - #endif diff --git a/src/pow.cpp b/src/pow.cpp index 9389daee5..11161fb68 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -112,7 +112,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in arith_uint256 bnTarget; bnTarget.SetCompact(nBits, &fNegative, &fOverflow); - if ( height >= 33310 && (special= komodo_heightnotary(height,pubkey33)) != 0 ) // 0 -> non-special notary + if ( height >= 33325 && (special= komodo_heightnotary(height,pubkey33)) != 0 ) // 0 -> non-special notary { int32_t i,nonz = 0; for (i=0; i<33; i++)