Skip to content

Commit

Permalink
Merge pull request jl777#77 from jl777/acspeed
Browse files Browse the repository at this point in the history
Acspeed
  • Loading branch information
jl777 authored Dec 4, 2016
2 parents 83d6699 + 730a500 commit ba9104d
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 148 deletions.
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// first suggest a reindex
if (!fReset) {
bool fRet = uiInterface.ThreadSafeMessageBox(
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
strLoadError + ".\n\n" + _("error in HDD data, might just need to update to latest, if that doesnt work, then you need to resync"),
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
if (fRet) {
fReindex = true;
Expand Down
6 changes: 3 additions & 3 deletions src/komodo.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,17 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
{
if ( (k= komodo_notarycmp(scriptPubKey,scriptlen,pubkeys,numnotaries,rmd160)) >= 0 )
signedmask |= (1LL << k);
else if ( numvins >= 17 )
else if ( 0 && numvins >= 17 )
{
int32_t k;
for (k=0; k<scriptlen; k++)
printf("%02x",scriptPubKey[k]);
printf(" scriptPubKey doesnt match any notary\n");
printf(" scriptPubKey doesnt match any notary vini.%d of %d\n",j,numvins);
}
} else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j);
}
numvalid = bitweight(signedmask);
if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/3)) )
if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/4)) )
{
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;
Expand Down
43 changes: 30 additions & 13 deletions src/komodo_bitcoind.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,24 +366,41 @@ uint256 komodo_getblockhash(int32_t height)
}
free_json(result);
}
//printf("KMD hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash);
printf("KMD hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash);
free(jsonstr);
}
return(hash);
}

uint256 _komodo_getblockhash(int32_t height);

uint64_t komodo_seed(int32_t height)
{
uint256 hash; uint64_t seed = 0; CBlockIndex *pindex;
memset(&hash,0,sizeof(hash));
if ( height > 10 )
height -= 10;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
uint64_t seed = 0;
if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds...
{
uint256 hash,zero; CBlockIndex *pindex;
memset(&hash,0,sizeof(hash));
memset(&zero,0,sizeof(zero));
if ( height > 10 )
height -= 10;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
hash = _komodo_getblockhash(height);
if ( memcmp(&hash,&zero,sizeof(hash)) == 0 )
hash = komodo_getblockhash(height);
int32_t i;
for (i=0; i<32; i++)
printf("%02x",((uint8_t *)&hash)[i]);
printf(" seed.%d\n",height);
seed = arith_uint256(hash.GetHex()).GetLow64();
}
else
{
if ( (pindex= chainActive[height]) != 0 )
hash = pindex->GetBlockHash();
} else hash = komodo_getblockhash(height);
seed = arith_uint256(hash.GetHex()).GetLow64();
seed = (height << 13) ^ (height << 2);
seed <<= 21;
seed |= (height & 0xffffffff);
seed ^= (seed << 17) ^ (seed << 1);
}
return(seed);
}

Expand Down Expand Up @@ -452,7 +469,7 @@ int32_t komodo_block2height(CBlock *block)
}
//printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height);
}
komodo_init(height);
//komodo_init(height);
return(height);
}

Expand All @@ -464,7 +481,7 @@ void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block)
#else
uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0];
#endif
komodo_init(0);
//komodo_init(0);
n = block.vtx[0].vout[0].scriptPubKey.size();
if ( n == 35 )
memcpy(pubkey33,ptr+1,33);
Expand All @@ -491,7 +508,7 @@ int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex)
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
{
CBlock block;
komodo_init(height);
//komodo_init(height);
memset(pubkey33,0,33);
if ( pindex != 0 )
{
Expand Down
Loading

0 comments on commit ba9104d

Please sign in to comment.