Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f925ef1496
  1. 3
      iguana/iguana777.h
  2. 2
      iguana/iguana_bundles.c
  3. 20
      iguana/iguana_unspents.c

3
iguana/iguana777.h

@ -43,7 +43,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_TAILPERCENTAGE 1.0 #define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define IGUANA_MAXPENDINGREQUESTS 64 #define IGUANA_MAXPENDINGREQUESTS 64
#define IGUANA_PENDINGREQUESTS 16 #define IGUANA_PENDINGREQUESTS 512
#define IGUANA_MINPENDBUNDLES 2 #define IGUANA_MINPENDBUNDLES 2
#define IGUANA_MAXPENDBUNDLES 32 #define IGUANA_MAXPENDBUNDLES 32
#define IGUANA_RPCPORT 7778 #define IGUANA_RPCPORT 7778
@ -855,6 +855,7 @@ int32_t iguana_blocksmissing(struct iguana_info *coin,int32_t *nonzp,uint8_t mis
FILE *myfopen(char *fname,char *mode); FILE *myfopen(char *fname,char *mode);
int32_t myfclose(FILE *fp); int32_t myfclose(FILE *fp);
void iguana_prefetch(struct iguana_info *coin,struct iguana_bundle *bp,int32_t width,int32_t flags); void iguana_prefetch(struct iguana_info *coin,struct iguana_bundle *bp,int32_t width,int32_t flags);
int32_t iguana_walkchain(struct iguana_info *coin);
extern int32_t HDRnet,netBLOCKS; extern int32_t HDRnet,netBLOCKS;

2
iguana/iguana_bundles.c

@ -787,7 +787,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp,int
datasize += block->RO.recvlen; datasize += block->RO.recvlen;
} }
} else printf("hash mismatch [%d:%d]\n",bp->hdrsi,bundlei); } else printf("hash mismatch [%d:%d]\n",bp->hdrsi,bundlei);
} else printf("[null %d:%d] ",bp->hdrsi,bundlei); } //else printf("[null %d:%d] ",bp->hdrsi,bundlei);
} }
} }
bp->numcached = bp->n - iguana_blocksmissing(coin,&avail,missings,0,0,bp,0); bp->numcached = bp->n - iguana_blocksmissing(coin,&avail,missings,0,0,bp,0);

20
iguana/iguana_unspents.c

@ -1894,7 +1894,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
//starti = coin->RTheight % coin->chain->bundlesize; //starti = coin->RTheight % coin->chain->bundlesize;
if ( (bp= coin->current) != 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 ( (bp= coin->current) != 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) )
{ {
printf("check longest.%d RTheight.%d hwm.%d\n",coin->longestchain,coin->RTheight,coin->blocks.hwmchain.height); //printf("check longest.%d RTheight.%d hwm.%d\n",coin->longestchain,coin->RTheight,coin->blocks.hwmchain.height);
if ( bits256_cmp(coin->RThash1,bp->hashes[1]) != 0 ) if ( bits256_cmp(coin->RThash1,bp->hashes[1]) != 0 )
coin->RThash1 = bp->hashes[1]; coin->RThash1 = bp->hashes[1];
bp->lastRT = (uint32_t)time(NULL); bp->lastRT = (uint32_t)time(NULL);
@ -1932,7 +1932,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
B = (void *)(long)((long)rdata + rdata->Boffset); B = (void *)(long)((long)rdata + rdata->Boffset);
bundlei = (coin->RTheight % coin->chain->bundlesize); bundlei = (coin->RTheight % coin->chain->bundlesize);
block = iguana_bundleblock(coin,&hash2,bp,bundlei); block = iguana_bundleblock(coin,&hash2,bp,bundlei);
printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p ramchain.%p\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],dest->H.data); //printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p ramchain.%p\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],dest->H.data);
if ( block != 0 && bits256_nonz(block->RO.prev_block) != 0 ) if ( block != 0 && bits256_nonz(block->RO.prev_block) != 0 )
{ {
iguana_blocksetcounters(coin,block,dest); iguana_blocksetcounters(coin,block,dest);
@ -1976,7 +1976,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
iguana_RTramchainfree(coin); iguana_RTramchainfree(coin);
return(-1); return(-1);
} else printf("spendvectors calculated to %d\n",coin->RTheight);*/ } else printf("spendvectors calculated to %d\n",coin->RTheight);*/
while ( block != 0 ) /*while ( block != 0 )
{ {
if ( bits256_cmp(iguana_blockhash(coin,coin->RTheight-n-1),block->RO.hash2) != 0 ) if ( bits256_cmp(iguana_blockhash(coin,coin->RTheight-n-1),block->RO.hash2) != 0 )
{ {
@ -1987,17 +1987,13 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
n++; n++;
if ( coin->RTgenesis != 0 && n >= bp->n ) if ( coin->RTgenesis != 0 && n >= bp->n )
break; break;
} }*/
if ( coin->RTgenesis == 0) if ( (n= iguana_walkchain(coin)) == coin->RTheight )
{ {
if ( n == coin->RTheight ) printf("RTgenesis verified\n");
{ coin->RTgenesis = (uint32_t)time(NULL);
printf("RTgenesis verified\n");
coin->RTgenesis = (uint32_t)time(NULL);
} else printf("RTgenesis failed to verify\n");
}
if ( coin->RTgenesis != 0 )
iguana_RTspendvectors(coin,bp,&coin->RTramchain); iguana_RTspendvectors(coin,bp,&coin->RTramchain);
} else printf("RTgenesis failed to verify n.%d vs %d\n",n,coin->RTheight);
} }
if ( dest != 0 && flag != 0 ) if ( dest != 0 && flag != 0 )
printf("<<<< flag.%d RT.%d:%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",flag,coin->RTheight,n,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize); printf("<<<< flag.%d RT.%d:%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",flag,coin->RTheight,n,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize);

Loading…
Cancel
Save