This commit is contained in:
jl777
2017-11-04 05:25:59 +02:00
parent 08775bc1fa
commit 0cd5ab88aa

View File

@@ -1449,23 +1449,23 @@ void komodo_passport_iteration()
sp = 0; sp = 0;
isrealtime = 0; isrealtime = 0;
base = (char *)CURRENCIES[baseid]; base = (char *)CURRENCIES[baseid];
printf("PASSPORT %s baseid+1 %d refid.%d\n",ASSETCHAINS_SYMBOL,baseid+1,refid); //printf("PASSPORT %s baseid+1 %d refid.%d\n",ASSETCHAINS_SYMBOL,baseid+1,refid);
if ( baseid+1 != refid ) if ( baseid+1 != refid ) // only need to import state from a different coin
{ {
if ( baseid == 32 || strcmp(ASSETCHAINS_SYMBOL,base) == 0 ) if ( baseid == 32 ) // only care about KMD's state
{ {
refsp->RTmask &= ~(1LL << baseid); refsp->RTmask &= ~(1LL << baseid);
komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"komodostate"); komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"komodostate");
komodo_nameset(symbol,dest,base); komodo_nameset(symbol,dest,base);
sp = komodo_stateptrget(symbol); sp = komodo_stateptrget(symbol);
n = 0; n = 0;
if ( (filedata= OS_fileptr(&datalen,fname)) != 0 ) if ( lastpos[baseid] == 0 && (filedata= OS_fileptr(&datalen,fname)) != 0 )
{ {
fpos = 0; fpos = 0;
fprintf(stderr,"processing %s %ldKB\n",fname,datalen/1024); fprintf(stderr,"%s processing %s %ldKB\n",ASSETCHAINS_SYMBOL,fname,datalen/1024);
while ( komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest) >= 0 ) while ( komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest) >= 0 )
; ;
fprintf(stderr,"took %d seconds to process %s %ldKB\n",(int32_t)(time(NULL)-starttime),fname,datalen/1024); fprintf(stderr,"%s took %d seconds to process %s %ldKB\n",ASSETCHAINS_SYMBOL,(int32_t)(time(NULL)-starttime),fname,datalen/1024);
lastpos[baseid] = fpos; lastpos[baseid] = fpos;
free(filedata), filedata = 0; free(filedata), filedata = 0;
datalen = 0; datalen = 0;
@@ -1494,7 +1494,7 @@ void komodo_passport_iteration()
n++; n++;
} }
lastpos[baseid] = ftell(fp); lastpos[baseid] = ftell(fp);
if ( lastpos[baseid] == 0 && strcmp(symbol,"KMD") == 0 ) if ( 0 && lastpos[baseid] == 0 && strcmp(symbol,"KMD") == 0 )
printf("from.(%s) lastpos[%s] %ld isrt.%d\n",ASSETCHAINS_SYMBOL,CURRENCIES[baseid],lastpos[baseid],komodo_isrealtime(&ht)); printf("from.(%s) lastpos[%s] %ld isrt.%d\n",ASSETCHAINS_SYMBOL,CURRENCIES[baseid],lastpos[baseid],komodo_isrealtime(&ht));
} //else fprintf(stderr,"%s.%ld ",CURRENCIES[baseid],ftell(fp)); } //else fprintf(stderr,"%s.%ld ",CURRENCIES[baseid],ftell(fp));
fclose(fp); fclose(fp);