Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
49b131b229
  1. 26
      iguana/iguana_bundles.c
  2. 4
      iguana/iguana_recv.c

26
iguana/iguana_bundles.c

@ -666,25 +666,21 @@ int32_t iguana_bundleissuemissing(struct iguana_info *coin,struct iguana_bundle
iguana_bundleblock(coin,&hash2,bp,i);
if ( bits256_nonz(hash2) != 0 )
{
if ( (addr= coin->peers->ranked[rand() % max]) != 0 && addr->usock >= 0 && addr->dead == 0 )
if ( (priority > 2 || bp->numsaved > bp->n-10) && (addr= coin->peers->ranked[rand() % max]) != 0 && addr->usock >= 0 && addr->dead == 0 )
{
struct iguana_blockreq *req = 0;
if ( 0 && bp == coin->current )
printf("iguana_bundleissuemissing.[%d:%d]\n",bp->hdrsi,i);
if ( priority > 2 || bp->numsaved > bp->n-10 )
iguana_sendblockreqPT(coin,0,bp,i,hash2,0);
else
{
req = mycalloc('y',1,sizeof(*req));
req->hash2 = hash2;
req->bp = bp;
req->height = bp->bundleheight + i;
req->bundlei = i;
queue_enqueue("missing",&coin->priorityQ,&req->DL,0);
}
bp->issued[i] = 1;
n++;
iguana_sendblockreqPT(coin,0,bp,i,hash2,0);
}
struct iguana_blockreq *req = 0;
req = mycalloc('y',1,sizeof(*req));
req->hash2 = hash2;
req->bp = bp;
req->height = bp->bundleheight + i;
req->bundlei = i;
queue_enqueue("missing",&coin->priorityQ,&req->DL,0);
bp->issued[i] = 1;
n++;
}
}
}

4
iguana/iguana_recv.c

@ -73,7 +73,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
return(0);
if ( memcmp(lastreq.bytes,hash2.bytes,sizeof(hash2)) == 0 || memcmp(lastreq2.bytes,hash2.bytes,sizeof(hash2)) == 0 )
{
printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr);
//printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr);
if ( iamthreadsafe == 0 && (rand() % 10) != 0 )
return(0);
}
@ -126,7 +126,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
bp->issued[bundlei] = addr->pendtime;
if ( block != 0 )
block->issued = addr->pendtime;
//if ( 0 && coin->current == bp )
if ( 0 && coin->current == bp )
printf("REQ.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks);
} else printf("MSG_BLOCK null datalen.%d\n",len);
return(len);

Loading…
Cancel
Save