Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ae3ea655f7
  1. 4
      iguana/iguana777.h
  2. 11
      iguana/iguana_init.c
  3. 22
      iguana/iguana_unspents.c

4
iguana/iguana777.h

@ -26,7 +26,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_SERIALIZE_SPENDVECTORGEN
//#define IGUANA_DISABLEPEERS
#define _IGUANA_MAXSTUCKTIME 10
#define IGUANA_MAXITERATIONS 2000
#define IGUANA_MAXITERATIONS 10000
#define IGUANA_DEFAULTLAG 20
#define IGUANA_MAXCOINS 64
@ -42,7 +42,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1
#define IGUANA_MAXPENDINGREQUESTS 64
#define IGUANA_PENDINGREQUESTS 512
#define IGUANA_PENDINGREQUESTS 64
#define IGUANA_MINPENDBUNDLES 2
#define IGUANA_MAXPENDBUNDLES 256
#define IGUANA_RPCPORT 7778

11
iguana/iguana_init.c

@ -441,7 +441,7 @@ void iguana_coinpurge(struct iguana_info *coin)
struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialheight,int32_t mapflags)
{
FILE *fp,*fp2; char fname[512],*symbol; int32_t iter;
FILE *fp; char fname[512],*symbol; int32_t iter;
coin->sleeptime = 10000;
symbol = coin->symbol;
if ( iguana_peerslotinit(coin,&coin->internaladdr,IGUANA_MAXPEERS,calc_ipbits("127.0.0.1:7777")) < 0 )
@ -471,10 +471,11 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
iguana_genesis(coin,coin->chain);
for (iter=coin->peers.numranked>8; iter<2; iter++)
{
sprintf(fname,"tmp/%s/%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
sprintf(fname,"confs/%s_%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
//sprintf(fname,"tmp/%s/%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
OS_compatible_path(fname);
printf("parsefile.%d %s\n",iter,fname);
if ( (fp= fopen(fname,"r")) == 0 )
/*if ( (fp= fopen(fname,"r")) == 0 )
{
sprintf(fname,"confs/%s_%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
OS_compatible_path(fname);
@ -498,8 +499,8 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
printf("%s is not used as tmp version is bigger\n",fname);
}
}
}
if ( fp != 0 )
}*/
if ( (fp= fopen(fname,"r")) != 0 )
{
iguana_parseline(coin,iter,fp);
fclose(fp);

22
iguana/iguana_unspents.c

@ -1982,11 +1982,25 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
int32_t iguana_realtime_update(struct iguana_info *coin)
{
double startmillis0; static double totalmillis0; static int32_t num0;
struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int32_t starti,bundlei,i,n,flag=0; bits256 hash2;
struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int32_t bundlei,i,n,flag=0; bits256 hash2; struct iguana_peer *addr;
struct iguana_block *block=0; struct iguana_blockRO *B; struct iguana_ramchain *dest=0,blockR;
starti = coin->RTheight % coin->chain->bundlesize;
if ( (bp= coin->current) != 0 && bp->hdrsi == coin->longestchain/coin->chain->bundlesize && bp->hdrsi == coin->balanceswritten && coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n && (coin->RTheight < coin->blocks.hwmchain.height-3 || time(NULL) > bp->lastRT) )//&& coin->blocks.hwmchain.height >= coin->longestchain-1 && coin->RTramchain.H.data->numblocks < bp->n )
//starti = coin->RTheight % coin->chain->bundlesize;
if ( (bp= coin->current) != 0 && bp->hdrsi == coin->longestchain/coin->chain->bundlesize && bp->hdrsi == coin->balanceswritten && coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n && (coin->RTheight <= coin->blocks.hwmchain.height || time(NULL) > bp->lastRT) )
{
if ( bits256_cmp(coin->RThash1,bp->hashes[1]) != 0 )
coin->RThash1 = bp->hashes[1];
bp->lastRT = (uint32_t)time(NULL);
if ( coin->peers.numranked > 0 && time(NULL) > coin->RThdrstime+10 )
{
iguana_RThdrs(coin,bp,coin->peers.numranked);
coin->RThdrstime = bp->lastRT;
for (i=0; i<coin->peers.numranked; i++)
{
if ( (addr= coin->peers.ranked[i]) != 0 )
printf("%d ",addr->numRThashes);
}
printf("RTheaders\n");
}
bp->lastRT = (uint32_t)time(NULL);
iguana_RTramchainalloc(coin,bp);
bp->isRT = 1;
@ -2032,7 +2046,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
n = 0;
if ( dest != 0 && flag != 0 && coin->RTheight >= coin->longestchain )
{
printf("ramchainiterate.[%d] ave %.2f micros, total %.2f seconds starti.%d num.%d\n",num0,(totalmillis0*1000.)/num0,totalmillis0/1000.,starti,coin->RTheight%bp->n);
printf("ramchainiterate.[%d] ave %.2f micros, total %.2f seconds starti.%d num.%d\n",num0,(totalmillis0*1000.)/num0,totalmillis0/1000.,coin->RTstarti,coin->RTheight%bp->n);
/*if ( iguana_spendvectors(coin,bp,dest,starti,coin->RTheight%bp->n,0) < 0 )
{
printf("RTutxo error -> RTramchainfree\n");

Loading…
Cancel
Save