|
|
@ -1840,24 +1840,31 @@ int32_t iguana_realtime_update(struct iguana_info *coin) |
|
|
|
double startmillis0; static double totalmillis0; static int32_t num0; |
|
|
|
struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int32_t bundlei,i,n,flag=0; bits256 hash2; struct iguana_peer *addr; |
|
|
|
struct iguana_block *block=0; struct iguana_blockRO *B; struct iguana_ramchain *dest=0,blockR; |
|
|
|
bp = coin->current; |
|
|
|
if ( bp != 0 && coin->RTdatabad != 0 ) |
|
|
|
if ( coin->spendvectorsaved != 1 && coin->bundlescount-1 != coin->balanceswritten ) |
|
|
|
{ |
|
|
|
iguana_RTramchainfree(coin); |
|
|
|
iguana_RTramchainalloc("RTbundle",coin,bp); |
|
|
|
for (i=0; i<bp->hdrsi; i++) |
|
|
|
coin->spendvectorsaved = 1; |
|
|
|
return(0); |
|
|
|
//printf("RT mismatch %d != %d\n",coin->bundlescount-1,coin->balanceswritten);
|
|
|
|
} |
|
|
|
if ( coin->spendvectorsaved <= 1 ) |
|
|
|
return(0); |
|
|
|
for (i=0; i<coin->bundlescount-1; i++) |
|
|
|
{ |
|
|
|
if ( (bp= coin->bundles[i]) != 0 && bp->utxofinish == 0 ) |
|
|
|
{ |
|
|
|
if ( (bp= coin->bundles[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 ) |
|
|
|
{ |
|
|
|
printf("error generating spendvectors.[%d], exiting. just restart iguana\n",i); |
|
|
|
exit(-1); |
|
|
|
} |
|
|
|
} |
|
|
|
printf("error generating spendvectors.[%d], exiting. just restart iguana\n",i); |
|
|
|
exit(-1); |
|
|
|
} else printf("generated UTXO.[%d]\n",i); |
|
|
|
} |
|
|
|
} |
|
|
|
bp = coin->current; |
|
|
|
if ( bp != 0 && coin->RTdatabad != 0 ) |
|
|
|
{ |
|
|
|
iguana_RTramchainfree(coin); |
|
|
|
iguana_RTramchainalloc("RTbundle",coin,bp); |
|
|
|
} |
|
|
|
if ( bp != 0 && bp->hdrsi == coin->longestchain/coin->chain->bundlesize && bp->hdrsi == coin->balanceswritten && coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n && ((coin->RTheight <= coin->blocks.hwmchain.height && time(NULL) > bp->lastRT) || time(NULL) > bp->lastRT+10) ) |
|
|
|
{ |
|
|
|
if ( (block= bp->blocks[0]) == 0 || block->txvalid == 0 || block->mainchain == 0 ) |
|
|
|