From 131207a1f48d4ae93b45a552f286bc0297d009e1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 20 Nov 2016 18:20:15 -0300 Subject: [PATCH] test --- src/komodo.h | 10 ++-------- src/komodo_gateway.h | 8 ++++++++ src/komodo_utils.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index ed05c1a46..59fbe0442 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -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 ) { diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d72c4b1c0..afb032448 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -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) { diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 78d38141d..d18dca12d 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -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];