Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0bd458b88f
  1. 2
      iguana/iguana777.h
  2. 14
      iguana/iguana_unspents.c
  3. 3
      iguana/main.c

2
iguana/iguana777.h

@ -797,7 +797,7 @@ int32_t iguana_Xspendmap(struct iguana_info *coin,struct iguana_ramchain *ramcha
void iguana_balancesQ(struct iguana_info *coin,struct iguana_bundle *bp);
int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t purgedist);
int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int32_t starti,int32_t max);
int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t incremental);
int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t startheight,int32_t endheight);
int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_bundle *bp,int32_t bundlei,bits256 hash2,int32_t iamthreadsafe);
int32_t iguana_blockreq(struct iguana_info *coin,int32_t height,int32_t priority);
int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp);

14
iguana/iguana_unspents.c

@ -20,8 +20,6 @@ int32_t iguana_utxoupdate(struct iguana_info *coin,uint16_t spent_hdrsi,uint32_t
{
struct iguana_hhutxo *hhutxo,*tmputxo; struct iguana_hhaccount *hhacct,*tmpacct;
uint8_t buf[sizeof(spent_hdrsi) + sizeof(uint32_t)];
printf("unexpected utxoupdate\n");
exit(-1);
if ( spent_hdrsi < 0 )
{
if ( coin->utxotable != 0 )
@ -44,6 +42,8 @@ int32_t iguana_utxoupdate(struct iguana_info *coin,uint16_t spent_hdrsi,uint32_t
}
return(0);
}
printf("unexpected utxoupdate\n");
exit(-1);
memcpy(&buf[sizeof(uint32_t)],(void *)&spent_hdrsi,sizeof(spent_hdrsi));
memcpy(buf,(void *)&spent_unspentind,sizeof(spent_unspentind));
HASH_FIND(hh,coin->utxotable,buf,sizeof(buf),hhutxo);
@ -440,9 +440,15 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp,int3
numtxid++;
}
if ( refheight < startheight )
{
printf("balancegen: refheight.%d < startheight.%d\n",refheight,startheight);
continue;
}
if ( refheight > endheight )
{
printf("balancegen: refheight.%d > endheight.%d\n",refheight,endheight);
break;
}
s = &S[spendind];
u = 0;
unspentind = 0;
@ -803,7 +809,7 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu
return(coin->balanceswritten);
}
int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t incremental)
int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t startheight,int32_t endheight)
{
uint32_t starttime,j,flag = 0; struct iguana_bundle *prevbp;
if ( bp->balancefinish > 1 )
@ -824,7 +830,7 @@ int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int
starttime = (uint32_t)time(NULL);
for (j=0; j<=bp->hdrsi; j++)
iguana_allocvolatile(coin,&coin->bundles[j]->ramchain);
if ( iguana_balancegen(coin,bp,bp->bundleheight,bp->bundleheight+bp->n-1) < 0 )
if ( iguana_balancegen(coin,bp,startheight,endheight) < 0 )
{
printf("GENERATE BALANCES ERROR ht.%d\n",bp->bundleheight);
exit(-1);

3
iguana/main.c

@ -358,7 +358,8 @@ void mainloop(struct supernet_info *myinfo)
iguana_realtime_update(coin);
if ( (ptr= queue_dequeue(&balancesQ,0)) != 0 )
{
iguana_balancecalc(ptr->coin,ptr->bp,0);
if ( ptr->coin != 0 && (bp= ptr->bp) != 0 )
iguana_balancecalc(ptr->coin,bp,bp->bundleheight,bp->bundleheight+bp->n-1);
myfree(ptr,ptr->allocsize);
}
}

Loading…
Cancel
Save