From 16b911e0bf7ea2d0399c11321822b643c255cb10 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 7 Dec 2016 12:27:39 +0200 Subject: [PATCH] test --- src/komodo.h | 7 +++++-- src/komodo_gateway.h | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 2d978d443..2c5cee2fc 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -200,8 +200,11 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"komodostate"); if ( (fp= fopen(fname,"rb+")) != 0 ) { - while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 ) - ; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + { + while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 ) + ; + } else fseek(fp,0,SEEK_END); } else fp = fopen(fname,"wb+"); printf("fname.(%s) fpos.%ld\n",fname,ftell(fp)); KOMODO_INITDONE = (uint32_t)time(NULL); diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 9578fce8e..186177f62 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -792,7 +792,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 void komodo_passport_iteration() { - static long lastpos[34]; static char userpass[33][1024]; + static long lastpos[34]; static char didinit,userpass[33][1024]; FILE *fp; int32_t baseid,isrealtime,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3]; cJSON *infoobj,*result; uint64_t RTmask = 0; while ( KOMODO_INITDONE == 0 ) { @@ -803,7 +803,7 @@ void komodo_passport_iteration() if ( ASSETCHAINS_SYMBOL[0] == 0 ) refid = 33; else refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0 - //printf("PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,refid); + printf("PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,refid); for (baseid=32; baseid>=0; baseid--) { sp = 0; @@ -847,6 +847,17 @@ void komodo_passport_iteration() } else { + if ( baseid < 32 && didinit == 0 ) + { + komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"komodostate"); + if ( (fp= fopen(fname,"rb+")) != 0 ) + { + while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 ) + ; + fclose(fp); + } + didinit = 1; + } komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"realtime"); if ( (fp= fopen(fname,"wb")) != 0 ) {