Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
655bc39773
  1. 6
      iguana/iguana_bundles.c
  2. 2
      iguana/iguana_ramchain.c
  3. 9
      iguana/iguana_unspents.c

6
iguana/iguana_bundles.c

@ -376,7 +376,7 @@ void iguana_bundlepurgefiles(struct iguana_info *coin,struct iguana_bundle *bp)
{
static bits256 zero;
char fname[1024]; int32_t hdrsi,m,j; uint32_t ipbits;
if ( bp->emitfinish > coin->startutc && bp->purgetime == 0 && time(NULL) > bp->emitfinish+30 )
if ( bp->purgetime == 0 && time(NULL) > bp->emitfinish+30 )
{
for (j=m=0; j<sizeof(coin->peers.active)/sizeof(*coin->peers.active); j++)
{
@ -644,7 +644,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp,int
{
int32_t bundlei,numhashes,avail,numsaved,numrecv,minrequests; uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1];
int64_t datasize; struct iguana_block *block;
if ( bp->emitfinish > coin->startutc )
if ( bp->emitfinish > 1 )
{
bp->numhashes = bp->numsaved = bp->numcached = bp->numrecv = bp->n;
return(bp->datasize);
@ -688,7 +688,7 @@ int32_t iguana_bundlefinish(struct iguana_info *coin,struct iguana_bundle *bp)
return(0);
#endif
for (i=0; i<bp->hdrsi; i++)
if ( (prevbp= coin->bundles[i]) == 0 || prevbp->emitfinish < coin->startutc || prevbp->utxofinish == 0 )
if ( (prevbp= coin->bundles[i]) == 0 || prevbp->emitfinish <= 1 || prevbp->utxofinish == 0 )
break;
if ( bp->hdrsi < coin->blocks.hwmchain.height/coin->chain->bundlesize && i == bp->hdrsi && time(NULL) > bp->emitfinish+10 )//&& coin->emitbusy <= 4 )
{

2
iguana/iguana_ramchain.c

@ -2496,7 +2496,7 @@ void iguana_ramchainmerge(struct iguana_info *coin) // jl777: verify prev/next h
while ( bp != 0 && (nextbp= bp->nextbp) != 0 )
{
n++;
if ( nextbp != 0 && bp != 0 && bp->emitfinish > coin->startutc && nextbp->emitfinish > coin->startutc && bp->mergefinish == 0 && nextbp->mergefinish == 0 && bp->ramchain.datasize + nextbp->ramchain.datasize < IGUANA_MAXRAMCHAINSIZE )
if ( nextbp != 0 && bp != 0 && bp->emitfinish > 1 && nextbp->emitfinish > 1 && bp->mergefinish == 0 && nextbp->mergefinish == 0 && bp->ramchain.datasize + nextbp->ramchain.datasize < IGUANA_MAXRAMCHAINSIZE )
{
if ( total == 0 || (bp->ramchain.datasize + nextbp->ramchain.datasize) < total )
{

9
iguana/iguana_unspents.c

@ -344,7 +344,7 @@ int32_t iguana_ramchain_spendtxid(struct iguana_info *coin,uint32_t *unspentindp
ind = s->spendtxidind;
external = (ind >> 31) & 1;
ind &= ~(1 << 31);
printf("s.%p ramchaintxid vout.%x spendtxidind.%d isext.%d ext.%d ind.%d\n",s,s->prevout,ind,s->external,external,ind);
//printf("s.%p ramchaintxid vout.%x spendtxidind.%d isext.%d ext.%d ind.%d\n",s,s->prevout,ind,s->external,external,ind);
if ( s->prevout < 0 )
return(-1);
if ( s->external != 0 && s->external == external && ind < numexternaltxids )
@ -367,12 +367,11 @@ struct iguana_txid *iguana_txidfind(struct iguana_info *coin,int32_t *heightp,st
uint8_t *TXbits; struct iguana_txid *T; uint32_t txidind; int32_t i,j;
struct iguana_bundle *bp; struct iguana_ramchain *ramchain; struct iguana_block *block;
*heightp = -1;
printf("txid search lasthdrsi.%d RT.%p\n",lasthdrsi,&coin->RTramchain);
if ( lasthdrsi < 0 )
return(0);
for (i=lasthdrsi; i>=0; i--)
{
printf("search.[%d] %p finish.%u vs %u\n",i,coin->bundles[i],coin->bundles[i]!=0?coin->bundles[i]->emitfinish:-1,coin->startutc);
//printf("search.[%d] %p finish.%u vs %u\n",i,coin->bundles[i],coin->bundles[i]!=0?coin->bundles[i]->emitfinish:-1,coin->startutc);
if ( (bp= coin->bundles[i]) != 0 && bp->emitfinish > 1 )
{
ramchain = (bp->isRT != 0) ? &coin->RTramchain : &bp->ramchain;
@ -380,7 +379,7 @@ struct iguana_txid *iguana_txidfind(struct iguana_info *coin,int32_t *heightp,st
{
TXbits = (void *)(long)((long)ramchain->H.data + ramchain->H.data->TXoffset);
T = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Toffset);
printf("[%p] search bp.%p TXbits.%p T.%p %d %d\n",ramchain,bp,TXbits,T,(int32_t)ramchain->H.data->TXoffset,(int32_t)ramchain->H.data->Toffset);
//printf("[%p] search bp.%p TXbits.%p T.%p %d %d\n",ramchain,bp,TXbits,T,(int32_t)ramchain->H.data->TXoffset,(int32_t)ramchain->H.data->Toffset);
if ( (txidind= iguana_sparseaddtx(TXbits,ramchain->H.data->txsparsebits,ramchain->H.data->numtxsparse,txid,T,0,ramchain)) > 0 )
{
//printf("found txidind.%d\n",txidind);
@ -414,7 +413,7 @@ struct iguana_bundle *iguana_externalspent(struct iguana_info *coin,bits256 *pre
struct iguana_bundle *spentbp=0; struct iguana_txid *T,TX,*tp; bits256 *X; bits256 prev_hash;
X = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Xoffset);
T = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Toffset);
printf("external X.%p %ld num.%d\n",X,(long)ramchain->H.data->Xoffset,(int32_t)ramchain->H.data->numexternaltxids);
//printf("external X.%p %ld num.%d\n",X,(long)ramchain->H.data->Xoffset,(int32_t)ramchain->H.data->numexternaltxids);
sequenceid = s->sequenceid;
hdrsi = spent_hdrsi;
*unspentindp = 0;

Loading…
Cancel
Save