|
|
@ -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); |
|
|
|