test
This commit is contained in:
15
src/komodo.h
15
src/komodo.h
@@ -343,12 +343,15 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
uint8_t scriptbuf[4096],pubkeys[64][33]; uint256 kmdtxid,btctxid,txhash;
|
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;
|
int32_t i,j,k,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count;
|
||||||
komodo_init();
|
komodo_init();
|
||||||
KOMODO_INITDONE = (uint32_t)time(NULL);
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
#ifdef KOMODO_ISSUER
|
{
|
||||||
komodo_gateway_issuer();
|
while ( KOMODO_REALTIME == 0 || time(NULL) < KOMODO_REALTIME+10 )
|
||||||
#else
|
{
|
||||||
komodo_gateway_redeemer();
|
fprintf(stderr,"komodo_connect.(%s) waiting for realtime\n",ASSETCHAINS_SYMBOL);
|
||||||
#endif
|
sleep(3);
|
||||||
|
}
|
||||||
|
KOMODO_INITDONE = (uint32_t)time(NULL);
|
||||||
|
}
|
||||||
if ( pindex != 0 )
|
if ( pindex != 0 )
|
||||||
{
|
{
|
||||||
height = pindex->nHeight;
|
height = pindex->nHeight;
|
||||||
|
|||||||
@@ -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";
|
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);
|
tokomodo = (komodo_is_issuer() == 0);
|
||||||
for (i=0; i<opretlen; i++)
|
//for (i=0; i<opretlen; i++)
|
||||||
printf("%02x",opretbuf[i]);
|
// printf("%02x",opretbuf[i]);
|
||||||
printf(" DEPOSIT.[%c] tokomodo.%d %.8f %c%s -> %s ",opretbuf[0],tokomodo,dstr(fiatoshis),shortflag!=0?'-':'+',base,coinaddr);
|
//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 ( opretbuf[0] == ((tokomodo == 0) ? 'D' : 'W') )
|
||||||
{
|
{
|
||||||
if ( opretlen == 34 )
|
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;
|
char *retstr; int32_t i,kmdheight; cJSON *infoobj,*result; uint256 zero; uint16_t port = 7771;
|
||||||
if ( KMDHEIGHT <= 0 )
|
if ( KMDHEIGHT <= 0 )
|
||||||
KMDHEIGHT = 1;
|
KMDHEIGHT = 1;
|
||||||
|
KOMODO_REALTIME = 0;
|
||||||
if ( (retstr= komodo_issuemethod((char *)"getinfo",0,port)) != 0 )
|
if ( (retstr= komodo_issuemethod((char *)"getinfo",0,port)) != 0 )
|
||||||
{
|
{
|
||||||
if ( (infoobj= cJSON_Parse(retstr)) != 0 )
|
if ( (infoobj= cJSON_Parse(retstr)) != 0 )
|
||||||
@@ -396,6 +397,8 @@ void komodo_gateway_iteration(char *symbol)
|
|||||||
printf("error KMDHEIGHT %d\n",KMDHEIGHT);
|
printf("error KMDHEIGHT %d\n",KMDHEIGHT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ( KMDHEIGHT == kmdheight )
|
||||||
|
KOMODO_REALTIME = (uint32_t)time(NULL);
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,16 +412,3 @@ void komodo_gateway_iteration(char *symbol)
|
|||||||
sleep(30);
|
sleep(30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KOMODO_ISSUER
|
|
||||||
void komodo_gateway_issuer() // from "assetchain" connectblock()
|
|
||||||
{
|
|
||||||
// check for redeems
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
void komodo_gateway_redeemer() // from "KMD" connectblock()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ uint64_t ASSETCHAINS_SUPPLY = 10;
|
|||||||
int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000;
|
int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000;
|
||||||
uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID;
|
uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID;
|
||||||
pthread_mutex_t komodo_mutex;
|
pthread_mutex_t komodo_mutex;
|
||||||
uint32_t KOMODO_INITDONE;
|
uint32_t KOMODO_INITDONE,KOMODO_REALTIME;
|
||||||
char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771;
|
char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771;
|
||||||
uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX;
|
uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX;
|
||||||
|
|||||||
Reference in New Issue
Block a user