This commit is contained in:
jl777
2016-11-20 18:20:15 -03:00
parent 71f6160288
commit 131207a1f4
3 changed files with 40 additions and 8 deletions

View File

@@ -168,7 +168,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
return(func);
} else return(-1);
}
void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout)
{
static FILE *fp; static int32_t errs;
@@ -177,13 +177,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
return;
if ( fp == 0 )
{
#ifdef WIN32
sprintf(fname,"%s\\%s",GetDataDir(false).string().c_str(),(char *)"komodostate");
//sprintf(fname2,"%s\\%s",GetDataDir(false).string().c_str(),(char *)"minerids");
#else
sprintf(fname,"%s/%s",GetDataDir(false).string().c_str(),(char *)"komodostate");
//sprintf(fname2,"%s/%s",GetDataDir(false).string().c_str(),(char *)"minerids");
#endif
komodo_statename(fname,ASSETCHAINS_SYMBOL);
/*memset(Minerids,0xfe,sizeof(Minerids));
if ( (Minerfp= fopen(fname2,"rb+")) == 0 )
{

View File

@@ -385,6 +385,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
return(typestr);
}
#ifdef pollmethod
void komodo_gateway_voutupdate(char *symbol,int32_t isspecial,int32_t height,int32_t txi,bits256 txid,int32_t vout,int32_t numvouts,uint64_t value,uint8_t *script,int32_t len)
{
int32_t i,opretlen,offset = 0; uint256 zero,utxid; const char *typestr;
@@ -531,6 +532,13 @@ void komodo_gateway_iteration(char *symbol)
sleep(30);
}
}
#else
void komodo_gateway_iteration(char *symbol)
{
}
#endif
void komodo_iteration(char *symbol)
{

View File

@@ -1261,6 +1261,36 @@ void komodo_userpass(char *username,char *password,FILE *fp)
free(rpcpassword);
}
void komodo_statename(char *fname,char *symbol)
{
int32_t n,len;
sprintf(fname,"%s",GetDataDir(false).string().c_str());
if ( (n= (int32_t)strlen(ASSETCHAINS_SYMBOL)) != 0 )
{
len = (int32_t)strlen(fname);
if ( strcmp(ASSETCHAINS_SYMBOL,&fname[len - n]) == 0 )
{
fname[len - n] = 0;
if ( symbol[0] != 0 )
{
strcpy(&fname[len - n],symbol);
#ifdef WIN32
strcat(fname,"\\");
#else
strcat(fname,"//");
#endif
}
}
else
{
printf("unexpected fname.(%s) vs %s\n",fname,ASSETCHAINS_SYMBOL);
return;
}
}
strcat(fname,(char *)"komodostate");
printf("statename.(%s) %s\n",symbol,fname);
}
void komodo_configfile(char *symbol,uint16_t port)
{
static char myusername[512],mypassword[8192];