diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 9567ba57c..48a8b5880 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -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; diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 20c4bb1dc..7c44512f9 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -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 diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d77d8ed72..399fc4c69 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -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","");