]> Git Repo - VerusCoin.git/blobdiff - src/komodo_gateway.h
Test
[VerusCoin.git] / src / komodo_gateway.h
index 5f00c1227ba879c2b56db278503b23a98245de73..4f5abb2fc6bae2bcae76b7a0ae86d91bf3c0906c 100644 (file)
@@ -270,11 +270,11 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che
     if ( seed == 0 && checkvalue != 0 )
     {
         ratio = ((value << 6) / checkvalue);
-        if ( ratio >= 62 && ratio <= 66 )
+        if ( ratio >= 60 && ratio <= 67 )
             return(0);
         else
         {
-            if ( kmdheight >= 238000 )
+            if ( ASSETCHAINS_SYMBOL[0] != 0 )
                 printf("ht.%d ignore mismatched %s value %lld vs checkvalue %lld -> ratio.%d\n",kmdheight,symbol,(long long)value,(long long)checkvalue,ratio);
             return(-1);
         }
@@ -652,7 +652,7 @@ void komodo_passport_iteration();
 int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing
 {
     static uint256 array[64]; static int32_t numbanned,indallvouts;
-    int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[64],otherheights[64]; uint256 hash,txids[64]; char symbol[16],base[16]; uint16_t vouts[64]; int8_t baseids[64]; uint8_t *script,opcode,rmd160s[64*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax; struct komodo_state *sp;
+    int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[16],base[16]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp;
     activation = 235300;
     if ( *(int32_t *)&array[0] == 0 )
         numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
@@ -846,7 +846,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
         }
         else if ( baseid == CZK )
         {
-            if ( height == 1084 || height == 1085 || height == 1086 || height == 778 || height == 1079 || height == 1054 || height == 1032 || height == 121 || height == 1030 || height == 182 || height == 876 || height == 873 || height == 871 || height == 184 || height == 862 || height == 185 || height == 861 || height == 186 || height == 838 || height == 238 || height == 242 || height == 246 || height == 248 || height == 250 || height == 251 || height == 256 || height == 282 || height == 322 || height == 343 || height == 433 || height == 323 || height == 276 )
+            if ( height < 1000 || height == 1084 || height == 1085 || height == 1086 || height == 778 || height == 1079 || height == 1054 || height == 1032 || height == 121 || height == 1030 || height == 182 || height == 876 || height == 873 || height == 871 || height == 184 || height == 862 || height == 185 || height == 861 || height == 186 || height == 838 || height == 238 || height == 242 || height == 246 || height == 248 || height == 250 || height == 251 || height == 256 || height == 282 || height == 322 || height == 343 || height == 433 || height == 323 || height == 276 )
                 return(0);
         }
         else if ( baseid == HUF )
@@ -916,10 +916,10 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
         {
             for (i=1; i<n-1; i++)
             {
-                if ( ASSETCHAINS_SYMBOL[0] != 0 && (sp= komodo_stateptrget(CURRENCIES[baseids[i-1]])) != 0 )
+                if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && (sp= komodo_stateptrget(ASSETCHAINS_SYMBOL)) != 0 && strcmp(CURRENCIES[baseids[i-1]],ASSETCHAINS_SYMBOL) == 0 )
                 {
                     int32_t rtflag = 0;
-                    while ( (sp->RTmask & (1LL << baseids[i-1])) == 0 )
+                    while ( (sp->RTmask & (1LL << 32)) == 0 )
                     {
                         if ( rtflag == 0 )
                             printf("[%s] skip checkdeposit.%s not RT %llx\n",ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i-1]],(long long)sp->RTmask);
@@ -1059,20 +1059,23 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
             PAX_pubkey(0,&opretbuf[1],&addrtype,rmd160,base,&shortflag,&fiatoshis);
             bitcoin_address(coinaddr,addrtype,rmd160,20);
             checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis);
+            if ( komodo_paxcmp(base,kmdheight,value,checktoshis,kmdheight < 225000 ? seed : 0) != 0 )
+                checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,height,base,fiatoshis);
             typestr = "deposit";
+            if ( 0 && strcmp("NOK",base) == 0 )
+            {
+                printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",ASSETCHAINS_SYMBOL,base,height,kmdheight);
+                printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed);
+                for (i=0; i<32; i++)
+                    printf("%02x",((uint8_t *)&txid)[i]);
+                printf(" <- txid.v%u ",vout);
+                for (i=0; i<33; i++)
+                    printf("%02x",pubkey33[i]);
+                printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height);
+            }
             if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 && (kmdheight > 195000 || kmdheight <= height) )
             {
                 didstats = 0;
-                if ( 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
-                {
-                    printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed);
-                    for (i=0; i<32; i++)
-                        printf("%02x",((uint8_t *)&txid)[i]);
-                    printf(" <- txid.v%u ",vout);
-                    for (i=0; i<33; i++)
-                        printf("%02x",pubkey33[i]);
-                    printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height);
-                }
                 if ( komodo_paxcmp(base,kmdheight,value,checktoshis,kmdheight < 225000 ? seed : 0) == 0 )
                 {
                     if ( (pax= komodo_paxfind(txid,vout,'D')) == 0 )
@@ -1130,9 +1133,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
                     if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,ASSETCHAINS_SYMBOL) == 0) ) //seed != 0 &&
                         printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed);
                 }
-            } else if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
-                printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",ASSETCHAINS_SYMBOL,base,height,kmdheight);
-        }
+            } //else printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",ASSETCHAINS_SYMBOL,base,height,kmdheight);
+        } //else printf("unsupported size.%d for opreturn D\n",opretlen);
     }
     else if ( opretbuf[0] == 'I' )
     {
@@ -1145,7 +1147,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
                 {
                     if ( baseids[i] < 0 )
                     {
-                        printf("%d of %d illegal baseid.%d\n",i,n,baseids[i]);
+                        static uint32_t counter;
+                        if ( counter++ < 3 )
+                            printf("%d of %d illegal baseid.%d, this can be ignored\n",i,n,baseids[i]);
                         continue;
                     }
                     bitcoin_address(coinaddr,60,&rmd160s[i*20],20);
@@ -1347,12 +1351,196 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
     return(typestr);
 }
 
+int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long *fposp,long datalen,char *symbol,char *dest);
+
+void komodo_stateind_set(struct komodo_state *sp,uint32_t *inds,int32_t n,uint8_t *filedata,long datalen,char *symbol,char *dest)
+{
+    uint8_t func; long fpos;
+    //komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest);
+    // scan backwards to set all the sp-> fields to the current valid value
+}
+
+void *OS_loadfile(char *fname,uint8_t **bufp,long *lenp,long *allocsizep)
+{
+    FILE *fp;
+    long  filesize,buflen = *allocsizep;
+    uint8_t *buf = *bufp;
+    *lenp = 0;
+    if ( (fp= fopen(fname,"rb")) != 0 )
+    {
+        fseek(fp,0,SEEK_END);
+        filesize = ftell(fp);
+        if ( filesize == 0 )
+        {
+            fclose(fp);
+            *lenp = 0;
+            printf("OS_loadfile null size.(%s)\n",fname);
+            return(0);
+        }
+        if ( filesize > buflen )
+        {
+            *allocsizep = filesize;
+            *bufp = buf = (uint8_t *)realloc(buf,(long)*allocsizep+64);
+        }
+        rewind(fp);
+        if ( buf == 0 )
+            printf("Null buf ???\n");
+        else
+        {
+            if ( fread(buf,1,(long)filesize,fp) != (unsigned long)filesize )
+                printf("error reading filesize.%ld\n",(long)filesize);
+            buf[filesize] = 0;
+        }
+        fclose(fp);
+        *lenp = filesize;
+        //printf("loaded.(%s)\n",buf);
+    } //else printf("OS_loadfile couldnt load.(%s)\n",fname);
+    return(buf);
+}
+
+uint8_t *OS_fileptr(long *allocsizep,char *fname)
+{
+    long filesize = 0; uint8_t *buf = 0; void *retptr;
+    *allocsizep = 0;
+    retptr = OS_loadfile(fname,&buf,&filesize,allocsizep);
+    return((uint8_t *)retptr);
+}
+
+long komodo_stateind_validate(struct komodo_state *sp,char *indfname,uint8_t *filedata,long datalen,uint32_t *prevpos100p,uint32_t *indcounterp,char *symbol,char *dest)
+{
+    FILE *fp; long fsize,lastfpos=0,fpos=0; uint8_t *inds,func; int32_t i,n; uint32_t offset,tmp,prevpos100 = 0;
+    *indcounterp = *prevpos100p = 0;
+    if ( (inds= OS_fileptr(&fsize,indfname)) != 0 )
+    {
+        lastfpos = 0;
+        fprintf(stderr,"inds.%p validate %s fsize.%ld datalen.%ld n.%ld lastfpos.%ld\n",inds,indfname,fsize,datalen,fsize / sizeof(uint32_t),lastfpos);
+        if ( (fsize % sizeof(uint32_t)) == 0 )
+        {
+            n = (int32_t)(fsize / sizeof(uint32_t));
+            for (i=0; i<n; i++)
+            {
+                memcpy(&tmp,&inds[i * sizeof(uint32_t)],sizeof(uint32_t));
+                if ( 0 && i > n-10 )
+                    printf("%d: tmp.%08x [%c] prevpos100.%u\n",i,tmp,tmp&0xff,prevpos100);
+                if ( (i % 100) == 0 )
+                    prevpos100 = tmp;
+                else
+                {
+                    func = (tmp & 0xff);
+                    offset = (tmp >> 8);
+                    fpos = prevpos100 + offset;
+                    if ( lastfpos >= datalen || filedata[lastfpos] != func )
+                    {
+                        printf("validate.%d error (%u %d) prev100 %u -> fpos.%ld datalen.%ld [%d] (%c) vs (%c) lastfpos.%ld\n",i,offset,func,prevpos100,fpos,datalen,lastfpos < datalen ? filedata[lastfpos] : -1,func,filedata[lastfpos],lastfpos);
+                        return(-1);
+                    }
+                }
+                lastfpos = fpos;
+            }
+            *indcounterp = n;
+            *prevpos100p = prevpos100;
+            if ( sp != 0 )
+                komodo_stateind_set(sp,(uint32_t *)inds,n,filedata,fpos,symbol,dest);
+            printf("free inds.%p %s validated[%d] fpos.%ld datalen.%ld, offset %ld vs fsize.%ld\n",inds,indfname,i,fpos,datalen,i * sizeof(uint32_t),fsize);
+            free(inds);
+            return(fpos);
+        } else printf("wrong filesize %s %ld\n",indfname,fsize);
+    }
+    free(inds);
+    fprintf(stderr,"indvalidate return -1\n");
+    return(-1);
+}
+
+long komodo_indfile_update(FILE *indfp,uint32_t *prevpos100p,long lastfpos,long newfpos,uint8_t func,uint32_t *indcounterp)
+{
+    uint32_t tmp;
+    if ( indfp != 0 )
+    {
+        tmp = ((uint32_t)(newfpos - *prevpos100p) << 8) | (func & 0xff);
+        if ( ftell(indfp)/sizeof(uint32_t) != *indcounterp )
+            printf("indfp fpos %ld -> ind.%ld vs counter.%u\n",ftell(indfp),ftell(indfp)/sizeof(uint32_t),*indcounterp);
+        fprintf(stderr,"ftell.%ld indcounter.%u lastfpos.%ld newfpos.%ld func.%02x\n",ftell(indfp),*indcounterp,lastfpos,newfpos,func);
+        fwrite(&tmp,1,sizeof(tmp),indfp), (*indcounterp)++;
+        if ( (*indcounterp % 100) == 0 )
+        {
+            *prevpos100p = (uint32_t)newfpos;
+            fwrite(prevpos100p,1,sizeof(*prevpos100p),indfp), (*indcounterp)++;
+        }
+    }
+    return(newfpos);
+}
+
+int32_t komodo_faststateinit(struct komodo_state *sp,char *fname,char *symbol,char *dest)
+{
+    FILE *indfp; char indfname[1024]; uint8_t *filedata; long validated=-1,datalen,fpos,lastfpos; uint32_t tmp,prevpos100,indcounter,starttime; int32_t func,finished = 0;
+    starttime = (uint32_t)time(NULL);
+    safecopy(indfname,fname,sizeof(indfname)-4);
+    strcat(indfname,".ind");
+    if ( (filedata= OS_fileptr(&datalen,fname)) != 0 )
+    {
+        if ( datalen >= (1LL << 32) || GetArg("-genind",0) != 0 || (validated= komodo_stateind_validate(0,indfname,filedata,datalen,&prevpos100,&indcounter,symbol,dest)) < 0 )
+        {
+            lastfpos = fpos = 0;
+            indcounter = prevpos100 = 0;
+            if ( (indfp= fopen(indfname,"wb")) != 0 )
+                fwrite(&prevpos100,1,sizeof(prevpos100),indfp), indcounter++;
+            fprintf(stderr,"processing %s %ldKB, validated.%ld\n",fname,datalen/1024,validated);
+            while ( (func= komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 )
+            {
+                lastfpos = komodo_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter);
+            }
+            if ( indfp != 0 )
+            {
+                fclose(indfp);
+                if ( (fpos= komodo_stateind_validate(0,indfname,filedata,datalen,&prevpos100,&indcounter,symbol,dest)) < 0 )
+                    printf("unexpected komodostate.ind validate failure %s datalen.%ld\n",indfname,datalen);
+                else printf("%s validated fpos.%ld\n",indfname,fpos);
+            }
+            finished = 1;
+            fprintf(stderr,"took %d seconds to process %s %ldKB\n",(int32_t)(time(NULL)-starttime),fname,datalen/1024);
+        }
+        else if ( validated > 0 )
+        {
+            if ( (indfp= fopen(indfname,"rb+")) != 0 )
+            {
+                lastfpos = fpos = validated;
+                fprintf(stderr,"datalen.%ld validated %ld -> indcounter %u, prevpos100 %u offset.%ld\n",datalen,validated,indcounter,prevpos100,indcounter * sizeof(uint32_t));
+                if ( fpos < datalen )
+                {
+                    fseek(indfp,indcounter * sizeof(uint32_t),SEEK_SET);
+                    if ( ftell(indfp) == indcounter * sizeof(uint32_t) )
+                    {
+                        while ( (func= komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 )
+                        {
+                            lastfpos = komodo_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter);
+                            if ( lastfpos != fpos )
+                                fprintf(stderr,"unexpected lastfpos.%ld != %ld\n",lastfpos,fpos);
+                        }
+                    }
+                    fclose(indfp);
+                }
+                printf("call validate datalen.%ld\n",datalen);
+                if ( komodo_stateind_validate(sp,indfname,filedata,datalen,&prevpos100,&indcounter,symbol,dest) < 0 )
+                    printf("unexpected komodostate.ind validate failure %s datalen.%ld\n",indfname,datalen);
+                else
+                {
+                    printf("%s validated updated from validated.%ld to %ld new.[%ld] -> indcounter %u, prevpos100 %u offset.%ld\n",indfname,validated,fpos,fpos-validated,indcounter,prevpos100,indcounter * sizeof(uint32_t));
+                    finished = 1;
+                }
+            }
+        } else printf("komodo_faststateinit unexpected case\n");
+        printf("free filedata.%p\n",filedata);
+        free(filedata);
+        return(finished == 1);
+    }
+    return(-1);
+}
+
 void komodo_passport_iteration()
 {
-    static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime;
-    int32_t maxseconds = 30;
-    FILE *fp; int32_t baseid,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0;
-    //printf("PASSPORT.(%s)\n",ASSETCHAINS_SYMBOL);
+    static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime,callcounter;
+    int32_t maxseconds = 10;
+    FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0;
     expired = 0;
     while ( KOMODO_INITDONE == 0 )
     {
@@ -1361,9 +1549,14 @@ void komodo_passport_iteration()
     }
     refsp = komodo_stateptr(symbol,dest);
     if ( ASSETCHAINS_SYMBOL[0] == 0 )
+    {
         refid = 33;
+        limit = 10000000;
+        jumblr_iteration();
+    }
     else
     {
+        limit = 10000000;
         refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0
         if ( refid == 0 )
         {
@@ -1377,13 +1570,9 @@ void komodo_passport_iteration()
         return;
     }*/
     starttime = (uint32_t)time(NULL);
-    if ( starttime == lasttime )
-    {
-        usleep(1000);
-        return;
-    }
+    if ( callcounter++ < 1 )
+        limit = 10000;
     lasttime = starttime;
-    //printf("PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,refid);
     for (baseid=32; baseid>=0; baseid--)
     {
         if ( time(NULL) >= starttime+maxseconds )
@@ -1391,26 +1580,39 @@ void komodo_passport_iteration()
         sp = 0;
         isrealtime = 0;
         base = (char *)CURRENCIES[baseid];
-        if ( baseid+1 != refid )
+        //printf("PASSPORT %s baseid+1 %d refid.%d\n",ASSETCHAINS_SYMBOL,baseid+1,refid);
+        if ( baseid+1 != refid ) // only need to import state from a different coin
         {
-            if ( baseid == 32 || ASSETCHAINS_SYMBOL[0] == 0 )
+            if ( baseid == 32 ) // only care about KMD's state
             {
                 refsp->RTmask &= ~(1LL << baseid);
                 komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"komodostate");
                 komodo_nameset(symbol,dest,base);
                 sp = komodo_stateptrget(symbol);
                 n = 0;
-                if ( (fp= fopen(fname,"rb")) != 0 && sp != 0 )
+                if ( lastpos[baseid] == 0 && (filedata= OS_fileptr(&datalen,fname)) != 0 )
+                {
+                    fpos = 0;
+                    fprintf(stderr,"%s processing %s %ldKB\n",ASSETCHAINS_SYMBOL,fname,datalen/1024);
+                    while ( komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest) >= 0 )
+                        lastfpos = fpos;
+                    fprintf(stderr,"%s took %d seconds to process %s %ldKB\n",ASSETCHAINS_SYMBOL,(int32_t)(time(NULL)-starttime),fname,datalen/1024);
+                    lastpos[baseid] = lastfpos;
+                    free(filedata), filedata = 0;
+                    datalen = 0;
+                }
+                else if ( (fp= fopen(fname,"rb")) != 0 && sp != 0 )
                 {
                     fseek(fp,0,SEEK_END);
+                    //fprintf(stderr,"couldnt OS_fileptr(%s), freading %ldKB\n",fname,ftell(fp)/1024);
                     if ( ftell(fp) > lastpos[baseid] )
                     {
                         if ( ASSETCHAINS_SYMBOL[0] != 0 )
                             printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",ASSETCHAINS_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]);
                         fseek(fp,lastpos[baseid],SEEK_SET);
-                        while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < 1000 )
+                        while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < limit )
                         {
-                            if ( n == 999 )
+                            if ( n == limit-1 )
                             {
                                 if ( time(NULL) < starttime+maxseconds )
                                     n = 0;
@@ -1423,23 +1625,24 @@ void komodo_passport_iteration()
                             n++;
                         }
                         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));
                     } //else fprintf(stderr,"%s.%ld ",CURRENCIES[baseid],ftell(fp));
                     fclose(fp);
-                } //else printf("error.(%s) %p\n",fname,sp);
+                } else fprintf(stderr,"load error.(%s) %p\n",fname,sp);
                 komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"realtime");
                 if ( (fp= fopen(fname,"rb")) != 0 )
                 {
                     if ( fread(buf,1,sizeof(buf),fp) == sizeof(buf) )
                     {
                         sp->CURRENT_HEIGHT = buf[0];
-                        if ( buf[0] != 0 && buf[0] >= buf[1] && buf[2] > time(NULL)-300 )
+                        if ( buf[0] != 0 && buf[0] >= buf[1] && buf[2] > time(NULL)-60 )
                         {
                             isrealtime = 1;
                             RTmask |= (1LL << baseid);
                             memcpy(refsp->RTbufs[baseid+1],buf,sizeof(refsp->RTbufs[baseid+1]));
-                        } else if ( KOMODO_PAX != 0 && (time(NULL)-buf[2]) > 1800 && ASSETCHAINS_SYMBOL[0] != 0 )
+                        }
+                        else if ( KOMODO_PAX != 0 && (time(NULL)-buf[2]) > 60 && ASSETCHAINS_SYMBOL[0] != 0 )
                             fprintf(stderr,"[%s]: %s not RT %u %u %d\n",ASSETCHAINS_SYMBOL,base,buf[0],buf[1],(int32_t)(time(NULL)-buf[2]));
                     } //else fprintf(stderr,"%s size error RT\n",base);
                     fclose(fp);
This page took 0.037485 seconds and 4 git commands to generate.