Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0392894a67
  1. 2
      iguana/iguana777.c
  2. 2
      iguana/iguana777.h
  3. 15
      iguana/iguana_unspents.c

2
iguana/iguana777.c

@ -369,7 +369,7 @@ int32_t iguana_helperA(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
if ( strcmp("BTC",coin->symbol) == 0 || iguana_bundlevalidate(coin,bp,0) == bp->n ) //
{
retval = 0;
if ( bp->utxofinish > 1 || (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag)) >= 0 )
if ( bp->utxofinish > 1 || (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag,0)) >= 0 )
{
if ( retval > 0 )
{

2
iguana/iguana777.h

@ -824,7 +824,7 @@ uint32_t iguana_sparseaddpk(uint8_t *bits,int32_t width,uint32_t tablesize,uint8
int32_t iguana_vinscriptparse(struct iguana_info *coin,struct vin_info *vp,uint32_t *sigsizep,uint32_t *pubkeysizep,uint32_t *p2shsizep,uint32_t *suffixp,uint8_t *vinscript,int32_t scriptlen);
void iguana_parsebuf(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_msghdr *H,uint8_t *buf,int32_t len);
int32_t _iguana_calcrmd160(struct iguana_info *coin,struct vin_info *vp);
int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,struct iguana_ramchain *ramchain,int32_t starti,int32_t numblocks,int32_t convertflag);
int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,struct iguana_ramchain *ramchain,int32_t starti,int32_t numblocks,int32_t convertflag,int32_t iterate);
int32_t iguana_balancegen(struct iguana_info *coin,int32_t incremental,struct iguana_bundle *bp,int32_t startheight,int32_t endheight,int32_t startemit);
int32_t iguana_bundlevalidate(struct iguana_info *coin,struct iguana_bundle *bp,int32_t forceflag);
void iguana_validateQ(struct iguana_info *coin,struct iguana_bundle *bp);

15
iguana/iguana_unspents.c

@ -1384,10 +1384,10 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
return(retval);
}
int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,struct iguana_ramchain *ramchain,int32_t starti,int32_t numblocks,int32_t convertflag)
int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,struct iguana_ramchain *ramchain,int32_t starti,int32_t numblocks,int32_t convertflag,int32_t iterate)
{
static uint64_t total,emitted;
int32_t spendind,n=0,txidind,errs=0,emit=0,i,j,k; double startmillis; bits256 prevhash;
int32_t iter,spendind,n=0,txidind,errs=0,emit=0,i,j,k; double startmillis; bits256 prevhash;
uint32_t spent_unspentind,spent_pkind,now,starttime; struct iguana_ramchaindata *rdata;
struct iguana_bundle *spentbp; struct iguana_blockRO *B; struct iguana_spendvector *ptr;
struct iguana_unspent *u,*spentU; struct iguana_txid *T; char str[65]; struct iguana_spend *S,*s;
@ -1415,9 +1415,11 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,st
if ( 0 && strcmp(coin->symbol,"BTC") == 0 )
printf("start UTXOGEN.%d max.%d ptr.%p millis.%.3f\n",bp->bundleheight,n,ptr,startmillis);
starttime = (uint32_t)time(NULL);
iguana_ramchain_prefetch(coin,&bp->ramchain,3);
for (iter=0; iter<=iterate; iter++)
{
txidind = B[starti].firsttxidind;
spendind = B[starti].firstvin;
iguana_ramchain_prefetch(coin,&bp->ramchain,3);
for (i=starti; i<numblocks; i++)
{
if ( txidind != B[i].firsttxidind || spendind != B[i].firstvin )
@ -1454,6 +1456,8 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,st
printf("found prevhash using slow, not fast\n");
}
}
if ( iterate != 0 && prevhash.bytes[31] != iter )
continue;
if ( bits256_nonz(prevhash) == 0 )
continue;
if ( spentbp != 0 && spentbp->ramchain.H.data != 0 )
@ -1534,6 +1538,7 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,st
printf("spendvectors: spendind.%d != bp numspends %d/%d\n",spendind,ramchain->H.spendind,ramchain->H.data->numspends);
errs++;
}
}
if ( errs == 0 && emit >= 0 )
{
emitted += emit;
@ -2294,7 +2299,7 @@ void iguana_RTspendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
if ( (lasti= (coin->RTheight - ((coin->RTheight/bp->n)*bp->n))) >= bp->n-1 )
lasti = bp->n - 1;
orignumemit = bp->numtmpspends;
if ( iguana_spendvectors(coin,bp,&coin->RTramchain,coin->RTstarti,lasti,0) < 0 )
if ( iguana_spendvectors(coin,bp,&coin->RTramchain,coin->RTstarti,lasti,0,0xff) < 0 )
{
printf("RTutxo error -> RTramchainfree\n");
coin->RTdatabad = 1;
@ -2337,7 +2342,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
{
if ( (bp= coin->bundles[i]) != 0 && (i > 0 && bp->utxofinish == 0) )
{
if ( iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,0) < 0 )
if ( iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,0,0) < 0 )
{
printf("error generating spendvectors.[%d], exiting. just restart iguana\n",i);
exit(-1);

Loading…
Cancel
Save