Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e06b2819c2
  1. 2
      iguana/iguana_bundles.c
  2. 9
      iguana/iguana_recv.c
  3. 13
      iguana/iguana_unspents.c

2
iguana/iguana_bundles.c

@ -415,7 +415,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
{
for (j=0; j<numpeers; j++)
{
if ( (addr= coin->peers.ranked[j]) != 0 && addr->dead == 0 && addr->usock >= 0 )
if ( (addr= coin->peers.ranked[j]) != 0 && addr->dead == 0 && addr->usock >= 0 && addr->msgcounts.verack != 0 )
{
now = (uint32_t)time(NULL);
for (i=j,k=doneval=maxval=0; i<bp->n&&k<sizeof(hashes)/sizeof(*hashes); i+=numpeers)

9
iguana/iguana_recv.c

@ -1319,12 +1319,11 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
int32_t iguana_processrecv(struct iguana_info *coin) // single threaded
{
int32_t newhwm = 0,flag = 0;
//fprintf(stderr,"process coin->recvQ\n");
int32_t newhwm = 0,hwmheight,flag = 0;
hwmheight = coin->blocks.hwmchain.height;
flag += iguana_processrecvQ(coin,&newhwm);
//fprintf(stderr,"iguana_reqhdrs\n");
flag += iguana_reqhdrs(coin);
//fprintf(stderr,"iguana_reqblocks\n");
//flag += iguana_reqblocks(coin);
if ( hwmheight != coin->blocks.hwmchain.height )
flag = 1;
return(flag);
}

13
iguana/iguana_unspents.c

@ -856,15 +856,15 @@ void iguana_RTramchainfree(struct iguana_info *coin)
void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp)
{
uint32_t i,changed = 0; struct iguana_ramchain *dest = &coin->RTramchain; struct iguana_blockRO *B;
if ( coin->RTramchain.H.data != 0 )
if ( dest->H.data != 0 )
{
i = 0;
if ( coin->RTheight != bp->bundleheight + coin->RTramchain.H.data->numblocks )
if ( coin->RTheight != bp->bundleheight + dest->H.data->numblocks )
changed++;
else
{
B = (void *)(long)((long)coin->RTramchain.H.data + coin->RTramchain.H.data->Boffset);
for (i=0; i<coin->RTramchain.H.data->numblocks; i++)
B = (void *)(long)((long)dest->H.data + dest->H.data->Boffset);
for (i=0; i<dest->H.data->numblocks; i++)
if ( bits256_cmp(B[i].hash2,bp->hashes[i]) != 0 )
{
char str[65],str2[65]; printf("mismatched hash2 at %d %s vs %s\n",bp->bundleheight+i,bits256_str(str,B[i].hash2),bits256_str(str2,bp->hashes[i]));
@ -874,7 +874,7 @@ void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp)
}
if ( changed != 0 )
{
printf("RTramchain changed %d bundlei.%d | coin->RTheight %d != %d bp->bundleheight + %d coin->RTramchain.H.data->numblocks\n",coin->RTheight,i,coin->RTheight,bp->bundleheight, coin->RTramchain.H.data->numblocks);
printf("RTramchain changed %d bundlei.%d | coin->RTheight %d != %d bp->bundleheight + %d coin->RTramchain.H.data->numblocks\n",coin->RTheight,i,coin->RTheight,bp->bundleheight,dest->H.data->numblocks);
//coin->RTheight = coin->balanceswritten * coin->chain->bundlesize;
iguana_RTramchainfree(coin);
}
@ -886,6 +886,7 @@ void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp)
dest->H.txidind = dest->H.unspentind = dest->H.spendind = dest->pkind = dest->H.data->firsti;
dest->externalind = dest->H.stacksize = 0;
dest->H.scriptoffset = 1;
printf("ALLOC RTramchain %p\n");
}
}
@ -897,6 +898,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
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 )
{
iguana_RTramchainalloc(coin,bp);
printf("RTheight.%d rdata.%p\n",coin->RTheight,dest->H.data);
while ( (rdata= coin->RTramchain.H.data) != 0 && coin->RTheight <= coin->blocks.hwmchain.height)
{
dest = &coin->RTramchain;
@ -929,6 +931,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
flag++;
if ( iguana_RTutxo(coin,bp,dest,bundlei) < 0 )
{
printf("RTutxo error -> RTramchainfree\n");
iguana_RTramchainfree(coin);
return(-1);
}

Loading…
Cancel
Save