Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
94b7b765e6
  1. 3
      iguana/iguana777.h
  2. 7
      iguana/iguana_recv.c
  3. 37
      iguana/iguana_unspents.c

3
iguana/iguana777.h

@ -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 128
#define IGUANA_MINPENDBUNDLES 2
#define IGUANA_MAXPENDBUNDLES 256
#define IGUANA_RPCPORT 7778
@ -404,6 +404,7 @@ struct iguana_peer
int32_t supernet,dead,addrind,usock,lastheight,protover,relayflag,numpackets,numpings,ipv6,height,rank,pendhdrs,pendblocks,recvhdrs,lastlefti,validpub,othervalid,dirty[2],laggard;
double recvblocks,recvtotal;
int64_t allocated,freed;
bits256 RThashes[IGUANA_MAXBUNDLESIZE]; int32_t numRThashes;
struct msgcounts msgcounts;
struct OS_memspace RAWMEM,TXDATA,HASHMEM;
struct iguana_ramchain ramchain;

7
iguana/iguana_recv.c

@ -823,7 +823,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
//printf("FOUND speculative.%s BLOCKHASHES[%d] ht.%d\n",bits256_str(str,blockhashes[1]),num,bp->bundleheight);
if ( bp->speculative == 0 )
bp->speculative = mycalloc('s',bp->n+1,sizeof(*bp->speculative));
for (i=bp->numspec; i<num&&i<=bp->n; i++)
for (i=1; i<num&&i<=bp->n; i++)
{
bp->speculative[i] = blockhashes[i];
if ( bp->blocks[i] == 0 || bp->blocks[i]->issued == 0 )
@ -834,6 +834,11 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
}
bp->speculative[0] = bp->hashes[0];
bp->numspec = num <= bp->n+1 ? num : bp->n+1;
if ( bp == coin->current && (addr= req->addr) != 0 )
{
memcpy(addr->RThashes,blockhashes,bp->numspec * sizeof(*addr->RThashes));
addr->numRThashes = bp->numspec;
}
//iguana_blockQ(coin,0,-1,blockhashes[2],1);
}
}

37
iguana/iguana_unspents.c

@ -1914,23 +1914,6 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
n = 0;
if ( dest != 0 && flag != 0 && coin->RTheight >= coin->longestchain )
{
struct iguana_ramchain R; struct iguana_ramchaindata RDATA;
iguana_rdataset(&R,&RDATA,dest);
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,coin->RTstarti,coin->RTheight%bp->n,0) < 0 )
{
printf("RTutxo error -> RTramchainfree\n");
iguana_RTramchainfree(coin);
return(-1);
}
else
{
coin->RTstarti = (coin->RTheight % bp->n);
printf("spendvectors calculated to %d\n",coin->RTheight);
iguana_convert(coin,bp,dest);
printf("spendvectors converted to %d\n",coin->RTheight);
}
iguana_rdatarestore(&R,&RDATA,dest);
while ( block != 0 )
{
if ( bits256_cmp(iguana_blockhash(coin,coin->RTheight-n-1),block->RO.hash2) != 0 )
@ -1951,6 +1934,26 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
coin->RTgenesis = (uint32_t)time(NULL);
} else printf("RTgenesis failed to verify\n");
}
if ( coin->RTgenesis != 0 )
{
struct iguana_ramchain R; struct iguana_ramchaindata RDATA;
iguana_rdataset(&R,&RDATA,dest);
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,coin->RTstarti,coin->RTheight%bp->n,0) < 0 )
{
printf("RTutxo error -> RTramchainfree\n");
iguana_RTramchainfree(coin);
return(-1);
}
else
{
coin->RTstarti = (coin->RTheight % bp->n);
printf("spendvectors calculated to %d\n",coin->RTheight);
iguana_convert(coin,bp,dest);
printf("spendvectors converted to %d\n",coin->RTheight);
}
iguana_rdatarestore(&R,&RDATA,dest);
}
}
if ( dest != 0 && flag != 0 )
printf("<<<< flag.%d RT.%d:%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",flag,coin->RTheight,n,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize);

Loading…
Cancel
Save