Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0f78938223
  1. 2
      crypto777/iguana_OS.c
  2. 29
      iguana/iguana_bundles.c
  3. 2
      iguana/iguana_ramchain.c
  4. 2
      iguana/iguana_wallet.c
  5. 2
      iguana/main.c

2
crypto777/iguana_OS.c

@ -532,7 +532,7 @@ void OS_remove_directory(char *dirname)
sprintf(buf,"rmdir %s",dirname);
if ( system(buf) != 0 )
{
printf("error doing (%s)\n",buf);
//printf("error doing (%s)\n",buf);
sprintf(buf,"rm %s/*",dirname);
if ( system(buf) != 0 )
printf("error doing (%s)\n",buf);

29
iguana/iguana_bundles.c

@ -419,29 +419,29 @@ struct iguana_txid *iguana_bundletx(struct iguana_info *coin,struct iguana_bundl
void iguana_bundlepurgefiles(struct iguana_info *coin,struct iguana_bundle *bp)
{
static const bits256 zero;
char fname[1024]; FILE *fp; int32_t hdrsi,j,m = 0; uint32_t ipbits = 0;
char fname[1024]; FILE *fp; int32_t subdir,hdrsi,j,m = 0; uint32_t ipbits = 0;
if ( bp->purgetime == 0 && time(NULL) > bp->emitfinish+30 )
{
printf("purged hdrsi.[%d] lag.%ld\n",bp->hdrsi,time(NULL) - bp->emitfinish);
for (j=m=0; j<bp->n; j++)
{
//if ( (ipbits= (uint32_t)coin->peers.active[j].ipbits) != 0 )
if ( iguana_peerfname(coin,&hdrsi,GLOBAL_TMPDIR,fname,ipbits,bp->hashes[j],zero,1,1) >= 0 )
{
if ( iguana_peerfname(coin,&hdrsi,GLOBAL_TMPDIR,fname,ipbits,bp->hashes[j],zero,1,1) >= 0 )
if ( (fp= fopen(fname,"rb")) != 0 )
{
if ( (fp= fopen(fname,"rb")) != 0 )
{
printf("purge.(%s)\n",fname);
fclose(fp);
if ( OS_removefile(fname,0) > 0 )
coin->peers.numfiles--, m++;
}
printf("purge.(%s)\n",fname);
fclose(fp);
if ( OS_removefile(fname,0) > 0 )
coin->peers.numfiles--, m++;
}
else printf("error removing.(%s)\n",fname);
}
else printf("error removing.(%s)\n",fname);
}
//sprintf(dirname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,bp->bundleheight), OS_remove_directory(dirname);
subdir = bp->bundleheight / IGUANA_SUBDIRDIVISOR;
sprintf(fname,"%s/%s/%d/%d",GLOBAL_TMPDIR,coin->symbol,subdir,bp->bundleheight), OS_remove_directory(fname);
printf("purged hdrsi.[%d] subdir.%d lag.%ld\n",bp->hdrsi,subdir,time(NULL) - bp->emitfinish);
bp->purgetime = (uint32_t)time(NULL);
if ( subdir > 2 )
sprintf(fname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,subdir-2), OS_remove_directory(fname);
}
}
@ -1208,8 +1208,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag)
{
numemit++;
//printf("finished.[%d]\n",bp->hdrsi);
if ( firstgap != 0 && bp->hdrsi > firstgap->hdrsi-3 && firstgap->validated > 1 )
iguana_bundlepurgefiles(coin,firstgap);
iguana_bundlepurgefiles(coin,bp);
}
}
else

2
iguana/iguana_ramchain.c

@ -2621,7 +2621,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
if ( retval == 0 )
{
//char dirname[1024];
printf("delete %d files hdrs.%d retval.%d bp_n.%d\n",num,bp->hdrsi,retval,bp_n);
printf("delete %d files hdrs.[%d] retval.%d bp_n.%d\n",num,bp->hdrsi,retval,bp_n);
if ( iguana_bundleload(coin,&newchain,bp,0) == 0 )
retval = -1;
else if ( bp_n == bp->n && bp->n == coin->chain->bundlesize && bp->hdrsi < coin->bundlescount-3 )

2
iguana/iguana_wallet.c

@ -184,7 +184,7 @@ void iguana_walletlock(struct supernet_info *myinfo)
memset(&myinfo->persistent_priv,0,sizeof(myinfo->persistent_priv));
memset(myinfo->secret,0,sizeof(myinfo->secret));
memset(myinfo->permanentfile,0,sizeof(myinfo->permanentfile));
printf("wallet locked\n");
//printf("wallet locked\n");
}
uint8_t *iguana_rmdarray(struct iguana_info *coin,int32_t *numrmdsp,cJSON *array,int32_t firsti)

2
iguana/main.c

@ -415,7 +415,7 @@ void mainloop(struct supernet_info *myinfo)
while ( 1 )
{
//printf("main iteration\n");
if ( myinfo->expiration != 0 && time(NULL) > myinfo->expiration )
if ( myinfo->expiration != 0 && time(NULL) > myinfo->expiration && myinfo->secret[0] != 0 )
iguana_walletlock(myinfo);
flag = 0;
isRT = 1;

Loading…
Cancel
Save