This commit is contained in:
jl777
2016-10-31 16:51:59 -03:00
parent a5355664fb
commit 2d657c5bac
3 changed files with 16 additions and 23 deletions

View File

@@ -343,12 +343,15 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
uint8_t scriptbuf[4096],pubkeys[64][33]; uint256 kmdtxid,btctxid,txhash;
int32_t i,j,k,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count;
komodo_init();
KOMODO_INITDONE = (uint32_t)time(NULL);
#ifdef KOMODO_ISSUER
komodo_gateway_issuer();
#else
komodo_gateway_redeemer();
#endif
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
while ( KOMODO_REALTIME == 0 || time(NULL) < KOMODO_REALTIME+10 )
{
fprintf(stderr,"komodo_connect.(%s) waiting for realtime\n",ASSETCHAINS_SYMBOL);
sleep(3);
}
KOMODO_INITDONE = (uint32_t)time(NULL);
}
if ( pindex != 0 )
{
height = pindex->nHeight;

View File

@@ -211,9 +211,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
uint8_t rmd160[20],addrtype,shortflag,pubkey33[33]; int32_t i,j,n,len,tokomodo=0; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; int64_t fiatoshis,checktoshis; const char *typestr = "unknown";
tokomodo = (komodo_is_issuer() == 0);
for (i=0; i<opretlen; i++)
printf("%02x",opretbuf[i]);
printf(" DEPOSIT.[%c] tokomodo.%d %.8f %c%s -> %s ",opretbuf[0],tokomodo,dstr(fiatoshis),shortflag!=0?'-':'+',base,coinaddr);
//for (i=0; i<opretlen; i++)
// printf("%02x",opretbuf[i]);
//printf(" DEPOSIT.[%c] tokomodo.%d %.8f %c%s -> %s ",opretbuf[0],tokomodo,dstr(fiatoshis),shortflag!=0?'-':'+',base,coinaddr);
if ( opretbuf[0] == ((tokomodo == 0) ? 'D' : 'W') )
{
if ( opretlen == 34 )
@@ -377,6 +377,7 @@ void komodo_gateway_iteration(char *symbol)
char *retstr; int32_t i,kmdheight; cJSON *infoobj,*result; uint256 zero; uint16_t port = 7771;
if ( KMDHEIGHT <= 0 )
KMDHEIGHT = 1;
KOMODO_REALTIME = 0;
if ( (retstr= komodo_issuemethod((char *)"getinfo",0,port)) != 0 )
{
if ( (infoobj= cJSON_Parse(retstr)) != 0 )
@@ -396,6 +397,8 @@ void komodo_gateway_iteration(char *symbol)
printf("error KMDHEIGHT %d\n",KMDHEIGHT);
break;
}
if ( KMDHEIGHT == kmdheight )
KOMODO_REALTIME = (uint32_t)time(NULL);
usleep(10000);
}
}
@@ -409,16 +412,3 @@ void komodo_gateway_iteration(char *symbol)
sleep(30);
}
}
#ifdef KOMODO_ISSUER
void komodo_gateway_issuer() // from "assetchain" connectblock()
{
// check for redeems
}
#else
void komodo_gateway_redeemer() // from "KMD" connectblock()
{
}
#endif

View File

@@ -29,6 +29,6 @@ uint64_t ASSETCHAINS_SUPPLY = 10;
int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000;
uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID;
pthread_mutex_t komodo_mutex;
uint32_t KOMODO_INITDONE;
uint32_t KOMODO_INITDONE,KOMODO_REALTIME;
char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771;
uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX;