This commit is contained in:
jl777
2016-12-01 17:28:41 -03:00
parent 7cce5f6a5f
commit 8aef9e40ca

View File

@@ -375,6 +375,8 @@ uint256 komodo_getblockhash(int32_t height)
uint256 _komodo_getblockhash(int32_t height); uint256 _komodo_getblockhash(int32_t height);
uint64_t komodo_seed(int32_t height) uint64_t komodo_seed(int32_t height)
{
if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds...
{ {
uint256 hash,zero; uint64_t seed = 0; CBlockIndex *pindex; uint256 hash,zero; uint64_t seed = 0; CBlockIndex *pindex;
memset(&hash,0,sizeof(hash)); memset(&hash,0,sizeof(hash));
@@ -390,6 +392,14 @@ uint64_t komodo_seed(int32_t height)
printf("%02x",((uint8_t *)&hash)[i]); printf("%02x",((uint8_t *)&hash)[i]);
printf(" seed.%d\n",height); printf(" seed.%d\n",height);
seed = arith_uint256(hash.GetHex()).GetLow64(); seed = arith_uint256(hash.GetHex()).GetLow64();
}
else
{
seed = calc_crc32(0,(void *)&height,sizeof(height));
seed <<= 32;
seed |= (height & 0xffffffff);
seed |= calc_crc32(0,(void *)&seed,sizeof(seed));
}
return(seed); return(seed);
} }