Browse Source

Test

etomic
jl777 7 years ago
parent
commit
2cd41e6a43
  1. 8
      iguana/exchanges/LP_cache.c

8
iguana/exchanges/LP_cache.c

@ -106,14 +106,19 @@ int32_t LP_cacheitem(struct iguana_info *coin,struct LP_transaction *tx,long rem
long LP_cacheptrs_init(FILE **wfp,struct iguana_info *coin) long LP_cacheptrs_init(FILE **wfp,struct iguana_info *coin)
{ {
char fname[1024]; FILE *fp; long n,fsize=0,len = 0; uint8_t *ptr = 0; char fname[1024]; FILE *fp; int32_t flag = 0; long n,fsize=0,len = 0; uint8_t *ptr = 0;
sprintf(fname,"%s/UNSPENTS/%s.SPV",GLOBAL_DBDIR,coin->symbol), OS_portable_path(fname); sprintf(fname,"%s/UNSPENTS/%s.SPV",GLOBAL_DBDIR,coin->symbol), OS_portable_path(fname);
fp = fopen(fname,"rb"); fp = fopen(fname,"rb");
if ( ((*wfp)= OS_appendfile(fname)) != 0 ) if ( ((*wfp)= OS_appendfile(fname)) != 0 )
{ {
if ( fp != 0 ) if ( fp != 0 )
{ {
fseek(fp,0,SEEK_END);
if ( ftell(fp) > sizeof(struct LP_transaction) )
flag = 1;
fclose(fp); fclose(fp);
if ( flag != 0 )
{
ptr = OS_portable_mapfile(fname,&fsize,0); ptr = OS_portable_mapfile(fname,&fsize,0);
while ( len < fsize ) while ( len < fsize )
{ {
@ -129,6 +134,7 @@ long LP_cacheptrs_init(FILE **wfp,struct iguana_info *coin)
} }
} }
} }
}
return(fsize); return(fsize);
} }

Loading…
Cancel
Save