This commit is contained in:
jl777
2016-11-21 10:17:21 -03:00
parent 9bd3a9cddc
commit 23256cca8f
3 changed files with 29 additions and 12 deletions

View File

@@ -346,6 +346,34 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
return(retstr2);
}
uint256 komodo_getblockhash(int32_t height)
{
uint256 hash; char params[128];
memset(&hash,0,sizeof(hash));
sprintf(params,"[%d]",height);
if ( (hexstr= komodo_issuemethod(KMDUSERPASS,"getblockhash",params,7771)) != 0 )
{
if ( is_hexstr(hexstr,0) == 64 )
decode_hex((uint8_t *)&hash,32,hexstr);
printf("KMD hash.%d (%s)\n",height,hexstr);
free(hexstr);
}
return(hash);
}
uint64_t komodo_seed(int32_t height)
{
uint256 hash; uint64_t seed = 0; CBlockIndex *pindex;
memset(&hash,0,sizeof(hash));
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
if ( (pindex= chainActive[height]) != 0 )
hash = pindex->GetBlockHash();
} else hash = komodo_getblockhash(height);
seed = arith_uint256(hash.GetHex()).GetLow64();
return(seed);
}
uint32_t komodo_txtime(uint256 hash)
{
CTransaction tx;
@@ -362,17 +390,6 @@ uint32_t komodo_txtime(uint256 hash)
return(0);
}
uint64_t komodo_seed(int32_t height)
{
uint256 hash; uint64_t seed = 0; CBlockIndex *pindex = chainActive[height];
if ( pindex != 0 )
{
hash = pindex->GetBlockHash();
seed = arith_uint256(hash.GetHex()).GetLow64();
}
return(seed);
}
void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
{
char symbol[16],dest[16]; struct komodo_state *sp;

View File

@@ -185,6 +185,7 @@ int32_t komodo_pending_withdraws(char *opretstr)
return(0);
HASH_ITER(hh,PAX,pax,tmp)
{
printf("pax %s marked.%u approved.%u\n",pax->symbol,pax->marked,pax->approved);
if ( pax->marked == 0 && strcmp((char *)"KMD",pax->symbol) == 0 && pax->approved == 0 )
{
// add 'A' opreturn entry

View File

@@ -1456,7 +1456,6 @@ void komodo_args()
int32_t komodo_baseid(char *origbase);
extern int COINBASE_MATURITY;
komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1);
//if ( komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 )
COINBASE_MATURITY = 1;
}
ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");