jl777 8 years ago
parent
commit
59de57ce9a
  1. 21
      iguana/iguana_ramchain.c

21
iguana/iguana_ramchain.c

@ -1030,10 +1030,13 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
return(-1); return(-1);
} }
OS_compatible_path(fname); OS_compatible_path(fname);
#ifdef __PNACL__ static portable_mutex_t mutex; static int didinit;
//static portable_mutex_t mutex; if ( didinit == 0 )
//portable_mutex_lock(&mutex); {
#endif portable_mutex_init(&mutex);
didinit = 1;
}
portable_mutex_lock(&mutex);
if ( (fp= fopen(fname,"wb")) == 0 ) if ( (fp= fopen(fname,"wb")) == 0 )
printf("iguana_ramchain_save: couldnt create.(%s) errno.%d\n",fname,errno); printf("iguana_ramchain_save: couldnt create.(%s) errno.%d\n",fname,errno);
else if ( coin->peers != 0 ) else if ( coin->peers != 0 )
@ -1057,9 +1060,7 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
fclose(fp); fclose(fp);
//sleep(3); //sleep(3);
} }
#ifdef __PNACL__ portable_mutex_unlock(&mutex);
//portable_mutex_unlock(&mutex);
#endif
return(fpos); return(fpos);
} }
@ -1914,7 +1915,7 @@ long iguana_ramchain_data(struct supernet_info *myinfo,struct iguana_info *coin,
block->RO.recvlen = 0; block->RO.recvlen = 0;
} }
} }
else if ( coin->chain->zcash == 0 ) else //if ( coin->chain->zcash == 0 )
{ {
if ( (err= iguana_ramchain_verify(coin,ramchain)) == 0 ) if ( (err= iguana_ramchain_verify(coin,ramchain)) == 0 )
{ {
@ -1958,7 +1959,7 @@ long iguana_ramchain_data(struct supernet_info *myinfo,struct iguana_info *coin,
fpos = -1; fpos = -1;
} }
} }
else /*else
{ {
FILE *fp; struct iguana_ramchaindata tmp; FILE *fp; struct iguana_ramchaindata tmp;
if ( (fp= fopen(fname,"wb")) != 0 ) if ( (fp= fopen(fname,"wb")) != 0 )
@ -1972,7 +1973,7 @@ long iguana_ramchain_data(struct supernet_info *myinfo,struct iguana_info *coin,
} else iguana_ramchain_saveaction(fname,RAMCHAIN_ARG,fp,&tmp,1,ramchain->H.scriptoffset,zcash); } else iguana_ramchain_saveaction(fname,RAMCHAIN_ARG,fp,&tmp,1,ramchain->H.scriptoffset,zcash);
fclose(fp); fclose(fp);
} }
} }*/
} }
if ( fpos < 0 && block != 0 ) if ( fpos < 0 && block != 0 )
iguana_blockunmark(coin,block,bp,bundlei,1); iguana_blockunmark(coin,block,bp,bundlei,1);

Loading…
Cancel
Save