This commit is contained in:
jl777
2016-12-01 16:09:35 -03:00
parent ada006e086
commit 6b0e06b5d0
3 changed files with 17 additions and 5 deletions

View File

@@ -372,6 +372,8 @@ uint256 komodo_getblockhash(int32_t height)
return(hash); return(hash);
} }
uint256 _komodo_getblockhash(int32_t height);
uint64_t komodo_seed(int32_t height) uint64_t komodo_seed(int32_t height)
{ {
uint256 hash; uint64_t seed = 0; CBlockIndex *pindex; uint256 hash; uint64_t seed = 0; CBlockIndex *pindex;
@@ -379,10 +381,8 @@ uint64_t komodo_seed(int32_t height)
if ( height > 10 ) if ( height > 10 )
height -= 10; height -= 10;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
{ hash = _komodo_getblockhash(height);
if ( (pindex= chainActive[height]) != 0 ) else hash = komodo_getblockhash(height);
hash = pindex->GetBlockHash();
} else hash = komodo_getblockhash(height);
seed = arith_uint256(hash.GetHex()).GetLow64(); seed = arith_uint256(hash.GetHex()).GetLow64();
return(seed); return(seed);
} }

View File

@@ -589,7 +589,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
if ( didstats != 0 ) if ( didstats != 0 )
pax->didstats = 1; pax->didstats = 1;
} }
} } else printf("pax %s deposit %.8f rejected\n",base,dstr(fiatoshis));
} }
} }
} }

View File

@@ -272,6 +272,18 @@ Value getblockhash(const Array& params, bool fHelp)
return pblockindex->GetBlockHash().GetHex(); return pblockindex->GetBlockHash().GetHex();
} }
uint256 _komodo_getblockhash(int32_t height);
{
uint256 hash;
LOCK(cs_main);
if ( nHeight >= 0 && nHeight <= chainActive.Height() )
{
CBlockIndex* pblockindex = chainActive[nHeight];
hash = pblockindex->GetBlockHash();
} else memset(&hash,0,sizeof(hash));
return(hash);
}
Value getblock(const Array& params, bool fHelp) Value getblock(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() < 1 || params.size() > 2) if (fHelp || params.size() < 1 || params.size() > 2)