jl777 8 years ago
parent
commit
f6e101ddf4
  1. 13
      iguana/iguana777.c
  2. 31
      iguana/iguana_txidfind.c
  3. 1
      includes/iguana_funcs.h

13
iguana/iguana777.c

@ -619,15 +619,24 @@ int32_t iguana_coin_mainiter(struct supernet_info *myinfo,struct iguana_info *co
//printf("%s n.%d emitfinished.%d coin->spendvectorsaved %d\n",coin->symbol,n,iguana_emitfinished(myinfo,coin,1),coin->spendvectorsaved); //printf("%s n.%d emitfinished.%d coin->spendvectorsaved %d\n",coin->symbol,n,iguana_emitfinished(myinfo,coin,1),coin->spendvectorsaved);
if ( iguana_emitfinished(myinfo,coin,1) >= n ) if ( iguana_emitfinished(myinfo,coin,1) >= n )
{ {
if ( coin->PREFETCHLAG >= 0 && coin->fastfind == 0 ) /*if ( coin->PREFETCHLAG >= 0 && coin->fastfind == 0 )
{ {
for (j=0; j<n; j++) for (j=0; j<n; j++)
if ( coin->bundles[j] != 0 ) if ( coin->bundles[j] != 0 )
iguana_alloctxbits(coin,&coin->bundles[j]->ramchain); iguana_alloctxbits(coin,&coin->bundles[j]->ramchain);
sleep(3); sleep(3);
} }*/
if ( iguana_validated(coin) < n || iguana_utxofinished(coin) < n || iguana_balancefinished(coin) < n ) if ( iguana_validated(coin) < n || iguana_utxofinished(coin) < n || iguana_balancefinished(coin) < n )
{ {
iguana_fastfindreset(coin);
iguana_fastfindcreate(coin);
if ( coin->fastfind == 0 )
{
for (j=0; j<n; j++)
if ( coin->bundles[j] != 0 )
iguana_alloctxbits(coin,&coin->bundles[j]->ramchain);
sleep(3);
}
coin->spendvectorsaved = 1; coin->spendvectorsaved = 1;
printf("update volatile data, need.%d vs utxo.%d balances.%d validated.%d\n",n,iguana_utxofinished(coin),iguana_balancefinished(coin),iguana_validated(coin)); printf("update volatile data, need.%d vs utxo.%d balances.%d validated.%d\n",n,iguana_utxofinished(coin),iguana_balancefinished(coin),iguana_validated(coin));
} }

31
iguana/iguana_txidfind.c

@ -452,9 +452,26 @@ static int _bignum_cmp(const void *a,const void *b)
return(0); return(0);
} }
int32_t iguana_fastfindreset(struct iguana_info *coin)
{
int32_t i,n = 0;
for (i=0; i<0x100; i++)
{
if ( coin->fast[i] != 0 )
munmap(coin->fast[i],coin->fastsizes[i]), n++;
if( coin->fasttables[i] != 0 )
free(coin->fasttables[i]);
coin->fast[i] = 0;
coin->fastsizes[i] = 0;
coin->fasttables[i] = 0;
}
coin->fastfind = 0;
return(n);
}
uint32_t iguana_fastfindinit(struct iguana_info *coin) uint32_t iguana_fastfindinit(struct iguana_info *coin)
{ {
int32_t i,j,iter,num,tablesize,*hashtable; uint8_t *sorted; char fname[1024]; int32_t i,iter,num,tablesize,*hashtable; uint8_t *sorted; char fname[1024];
//if ( strcmp("BTC",coin->symbol) != 0 ) //if ( strcmp("BTC",coin->symbol) != 0 )
// return(0); // return(0);
if ( coin->fastfind != 0 ) if ( coin->fastfind != 0 )
@ -500,17 +517,7 @@ uint32_t iguana_fastfindinit(struct iguana_info *coin)
coin->fastfind = (uint32_t)time(NULL); coin->fastfind = (uint32_t)time(NULL);
printf("initialized fastfind.%s iter.%d\n",coin->symbol,iter); printf("initialized fastfind.%s iter.%d\n",coin->symbol,iter);
return(coin->fastfind); return(coin->fastfind);
} } else iguana_fastfindreset(coin);
else
{
for (j=0; j<i; j++)
{
munmap(coin->fast[i],coin->fastsizes[i]);
free(coin->fasttables[i]);
coin->fast[i] = 0;
coin->fastsizes[i] = 0;
}
}
} }
return(0); return(0);
} }

1
includes/iguana_funcs.h

@ -451,6 +451,7 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc
void iguana_utxoaddrs_purge(struct iguana_info *coin); void iguana_utxoaddrs_purge(struct iguana_info *coin);
int32_t iguana_utxoupdate(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t spent_unspentind,uint32_t spent_pkind,uint64_t spent_value,uint32_t spendind,uint32_t fromheight,uint8_t *rmd160); int32_t iguana_utxoupdate(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t spent_unspentind,uint32_t spent_pkind,uint64_t spent_value,uint32_t spendind,uint32_t fromheight,uint8_t *rmd160);
int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info *coin,uint64_t *totalp,struct iguana_outpoint *unspents,int32_t max,uint64_t required,int32_t minconf,cJSON *addresses,char *remoteaddr); int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info *coin,uint64_t *totalp,struct iguana_outpoint *unspents,int32_t max,uint64_t required,int32_t minconf,cJSON *addresses,char *remoteaddr);
int32_t iguana_fastfindreset(struct iguana_info *coin);
int64_t iguana_unspentset(struct supernet_info *myinfo,struct iguana_info *coin); int64_t iguana_unspentset(struct supernet_info *myinfo,struct iguana_info *coin);
int32_t iguana_txidfastfind(struct iguana_info *coin,int32_t *heightp,bits256 txid,int32_t lasthdrsi); int32_t iguana_txidfastfind(struct iguana_info *coin,int32_t *heightp,bits256 txid,int32_t lasthdrsi);
uint8_t iguana_addrtype(struct iguana_info *coin,uint8_t script_type); uint8_t iguana_addrtype(struct iguana_info *coin,uint8_t script_type);

Loading…
Cancel
Save