Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f4661d8d04
  1. 10
      iguana/iguana_blocks.c
  2. 13
      iguana/iguana_recv.c
  3. 8
      iguana/iguana_spendvectors.c

10
iguana/iguana_blocks.c

@ -552,9 +552,11 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
{
if ( memcmp(prev->RO.hash2.bytes,coin->blocks.hwmchain.RO.hash2.bytes,sizeof(bits256)) == 0 )
prev->mainchain = 1;
if ( prev->valid == 0 && iguana_blockvalidate(coin,&valid,prev,0) < 0 )
if ( bits256_nonz(prev->RO.hash2) == 0 || (prev->valid == 0 && iguana_blockvalidate(coin,&valid,prev,0) < 0) )
{
char str[65]; printf("(%s) notready v.%d m.%d h.%d\n",bits256_str(str,prev->RO.hash2),prev->valid,prev->mainchain,prev->height);
char str[65];
if ( 0 && bits256_nonz(prev->RO.hash2) != 0 )
printf("(%s) notready v.%d m.%d h.%d\n",bits256_str(str,prev->RO.hash2),prev->valid,prev->mainchain,prev->height);
return(0);
} else prev->valid = 1;
if ( prev->valid != 0 && prev->mainchain != 0 && prev->height >= 0 )
@ -574,11 +576,13 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
else
{
char str[65];
//if ( 0 && bits256_nonz(block->RO.prev_block) != 0 )
if ( bits256_nonz(block->RO.prev_block) != 0 )
{
printf("chainlink error: cant find prev.(%s)\n",bits256_str(str,block->RO.prev_block));
iguana_blockunmark(coin,block,0,-1,0);
//memset(&block->RO.prev_block.bytes,0,sizeof(block->RO.prev_block));
//getchar();
}
return(0);
}
//char str[65]; printf("extend? %s.h%d: %.15f vs %.15f ht.%d vs %d\n",bits256_str(str,block->RO.hash2),height,block->PoW,coin->blocks.hwmchain.PoW,height,coin->blocks.hwmchain.height);

13
iguana/iguana_recv.c

@ -76,21 +76,28 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
checkbp = 0, j = -2;
if ( (checkbp= iguana_bundlefind(coin,&checkbp,&j,hash2)) != 0 && j >= 0 && j < checkbp->n )
{
if ( checkbp->emitfinish != 0 || ((block= checkbp->blocks[j]) != 0 && block->txvalid != 0 && block->mainchain != 0) )
if ( checkbp->emitfinish != 0 || ((block= checkbp->blocks[j]) != 0 && block->txvalid != 0 && block->mainchain != 0 && block->valid != 0) )
{
//printf("found valid [%d:%d] in blockreqPT\n",checkbp->hdrsi,j);
return(0);
}
}
if ( 1 && coin->enableCACHE != 0 && iguana_speculativesearch(coin,&block,hash2) != 0 )
if ( 0 && coin->enableCACHE != 0 && iguana_speculativesearch(coin,&block,hash2) != 0 )
{
if ( block != 0 && block->hdrsi != 0 && block->bundlei != 0 )
{
//printf("found valid [%d:%d] in blockreqPT txvalid.%d\n",block!=0?block->hdrsi:-1,block!=0?block->bundlei:-1,block->txvalid);
if ( block->mainchain != 0 )
if ( block->mainchain != 0 && block->valid != 0 && block->txvalid != 0 )
{
/*if ( (bp= coin->bundles[block->bundlei]) != 0 )
{
bp->hashes[block->bundlei] = block->RO.hash2;
bp->blocks[block->bundlei] = block;
}*/
return(0);
}
}
}
if ( addr->msgcounts.verack == 0 )
{
printf("iguana_sendblockreq (%s) addrind.%d hasn't verack'ed yet\n",addr->ipaddr,addr->addrind);

8
iguana/iguana_spendvectors.c

@ -243,6 +243,11 @@ int32_t iguana_spendvectors(struct supernet_info *myinfo,struct iguana_info *coi
struct iguana_unspent *u,*spentU; struct iguana_txid *T; char str[65];
struct iguana_spend *S,*s; //void *fastfind = 0;
//printf("iguana_spendvectors.[%d] gen.%d ramchain data.%p txbits.%p\n",bp->hdrsi,bp->bundleheight,rdata,ramchain->txbits);
if ( ramchain->H.data == 0 )
{
printf("AUTO volatilesalloc [%d]\n",bp->hdrsi);
iguana_volatilesalloc(coin,ramchain,0);
}
if ( (rdata= ramchain->H.data) == 0 || (n= rdata->numspends) < 1 )
{
printf("iguana_spendvectors.[%d]: no rdata.%p %d\n",bp->hdrsi,rdata,n);
@ -251,9 +256,6 @@ int32_t iguana_spendvectors(struct supernet_info *myinfo,struct iguana_info *coi
B = RAMCHAIN_PTR(rdata,Boffset);
S = RAMCHAIN_PTR(rdata,Soffset);
T = RAMCHAIN_PTR(rdata,Toffset);
//B = (void *)(long)((long)rdata + rdata->Boffset);
//S = (void *)(long)((long)rdata + rdata->Soffset);
//T = (void *)(long)((long)rdata + rdata->Toffset);
if ( ramchain->Xspendinds != 0 )
{
bp->tmpspends = ramchain->Xspendinds;

Loading…
Cancel
Save