Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6b45e35c4b
  1. 14
      iguana/iguana_unspents.c
  2. 15
      iguana/main.c

14
iguana/iguana_unspents.c

@ -347,7 +347,7 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp)
int32_t spendind,n,errs=0,emit=0; uint32_t unspentind,pkind,txidind; struct iguana_account *A2;
struct iguana_unspent *u,*spentU; struct iguana_spend *S,*s; struct iguana_ramchain *ramchain;
struct iguana_bundle *spentbp; struct iguana_txid *T,*nextT; int32_t hdrsi;
uint32_t numtxid,now,h,refheight; struct iguana_utxo *utxo;
uint32_t numtxid,now,h,refheight; struct iguana_utxo *utxo,*Uextras;
ramchain = &bp->ramchain;
//printf("BALANCEGEN.%d\n",bp->bundleheight);
if ( ramchain->H.data == 0 || (n= ramchain->H.data->numspends) < 1 )
@ -420,15 +420,7 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp)
now = (uint32_t)time(NULL);
if ( spentbp != 0 && unspentind > 0 && unspentind < spentbp->ramchain.H.data->numunspents )
{
if ( spentbp->ramchain.Uextras == 0 )
{
spentbp->ramchain.Uextras = calloc(sizeof(*spentbp->ramchain.Uextras),spentbp->ramchain.H.data->numunspents + 16);
}
if ( spentbp->ramchain.A == 0 )
{
spentbp->ramchain.A = calloc(sizeof(*spentbp->ramchain.A),spentbp->ramchain.H.data->numpkinds + 16);
}
if ( spentbp->ramchain.Uextras == 0 || (A2= spentbp->ramchain.A) == 0 )
if ( (Uextras= spentbp->ramchain.Uextras) == 0 || (A2= spentbp->ramchain.A) == 0 )
{
printf("null ptrs %p %p\n",spentbp->ramchain.Uextras,spentbp->ramchain.A);
errs++;
@ -439,7 +431,7 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp)
u = &spentU[unspentind];
if ( (pkind= u->pkind) != 0 && pkind < spentbp->ramchain.H.data->numpkinds )
{
utxo = &spentbp->ramchain.Uextras[unspentind];
utxo = &Uextras[unspentind];
if ( utxo->spentflag == 0 )
{
utxo->prevspendind = A2[pkind].lastind;

15
iguana/main.c

@ -342,6 +342,19 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu
{
for (hdrsi=0; hdrsi<numhdrsi; hdrsi++)
{
if ( (bp= coin->bundles[hdrsi]) == 0 || bp->ramchain.H.data == 0 )
{
printf("balance flush null bp[%d]??\n",hdrsi);
exit(-1);
}
if ( bp->ramchain.Uextras == 0 )
{
bp->ramchain.Uextras = calloc(sizeof(*bp->ramchain.Uextras),bp->ramchain.H.data->numunspents + 16);
}
if ( bp->ramchain.A == 0 )
{
bp->ramchain.A = calloc(sizeof(*bp->ramchain.A),bp->ramchain.H.data->numpkinds + 16);
}
Aptr = 0;
Uptr = 0;
numunspents = 0;
@ -368,7 +381,7 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu
{
bp->dirty = 0;
err = 0;
printf("saved (%s) and (%s)\n",fname,fname2);
printf("[%d] of %d saved (%s) and (%s)\n",hdrsi,numhdrsi,fname,fname2);
}
}
}

Loading…
Cancel
Save