jl777 8 years ago
parent
commit
bac682edf3
  1. 15
      iguana/iguana_bundles.c
  2. 2
      iguana/iguana_recv.c

15
iguana/iguana_bundles.c

@ -615,7 +615,7 @@ struct iguana_block *iguana_bundleblock(struct iguana_info *coin,bits256 *hash2p
int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp,int32_t priority,double mult) int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp,int32_t priority,double mult)
{ {
int32_t i,max,nonz,starti,lasti,firsti,lag,num,n=0; uint32_t now; bits256 hash2; double aveduration; struct iguana_peer *addr; struct iguana_block *block; int32_t i,max,nonz,starti,lasti,firsti,lag,num,n=0; uint32_t now; bits256 hash2; double aveduration; struct iguana_peer *addr; char str[65]; //struct iguana_block *block;
if ( coin->peers == 0 ) if ( coin->peers == 0 )
{ {
printf("%s has no peers\n",coin->symbol); printf("%s has no peers\n",coin->symbol);
@ -657,10 +657,10 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf
lasti = firsti = -1; lasti = firsti = -1;
for (i=nonz=0; i<bp->n; i++) for (i=nonz=0; i<bp->n; i++)
{ {
if ( (block= bp->blocks[i]) != 0 && block->txvalid != 0 && block->mainchain != 0 ) //if ( (block= bp->blocks[i]) != 0 && block->txvalid != 0 && block->mainchain != 0 )
continue;
//if ( GETBIT(bp->haveblock,i) != 0 )
// continue; // continue;
if ( GETBIT(bp->haveblock,i) != 0 )
continue;
nonz++; nonz++;
if ( firsti < 0 ) if ( firsti < 0 )
firsti = i; firsti = i;
@ -672,7 +672,8 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf
{ {
if ( (addr= coin->peers->ranked[rand() % max]) != 0 && addr->usock >= 0 && addr->dead == 0 ) //strcmp("BTC",coin->symbol) != 0 || (bp->issued[i] > 1 && now > bp->issued[i]+lag && if ( (addr= coin->peers->ranked[rand() % max]) != 0 && addr->usock >= 0 && addr->dead == 0 ) //strcmp("BTC",coin->symbol) != 0 || (bp->issued[i] > 1 && now > bp->issued[i]+lag &&
{ {
printf("reqPT "); if ( bp == coin->current )
printf("reqPT ");
iguana_sendblockreqPT(coin,0,bp,i,hash2,0); iguana_sendblockreqPT(coin,0,bp,i,hash2,0);
} }
struct iguana_blockreq *req = 0; struct iguana_blockreq *req = 0;
@ -684,7 +685,6 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf
queue_enqueue("missing",&coin->priorityQ,&req->DL,0); queue_enqueue("missing",&coin->priorityQ,&req->DL,0);
bp->issued[i] = 1; bp->issued[i] = 1;
n++; n++;
char str[65];
if ( bp == coin->current ) if ( bp == coin->current )
printf("%s issuemissing.[%d:%d]\n",bits256_str(str,hash2),bp->hdrsi,i); printf("%s issuemissing.[%d:%d]\n",bits256_str(str,hash2),bp->hdrsi,i);
} //else printf("[z%d] ",i); } //else printf("[z%d] ",i);
@ -692,7 +692,8 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf
} }
if ( firsti >= 0 )//&& bp == coin->current ) if ( firsti >= 0 )//&& bp == coin->current )
{ {
//printf("[%d] first missing.%d of %d\n",bp->hdrsi,firsti,nonz); if ( bp == coin->current )
printf("%s [%d] first missing.%d of %d\n",bits256_str(str,hash2),bp->hdrsi,firsti,nonz);
iguana_bundleblock(coin,&hash2,bp,firsti); iguana_bundleblock(coin,&hash2,bp,firsti);
if ( bits256_nonz(hash2) != 0 ) if ( bits256_nonz(hash2) != 0 )
{ {

2
iguana/iguana_recv.c

@ -124,7 +124,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
} }
if ( block != 0 ) if ( block != 0 )
block->issued = addr->pendtime; block->issued = addr->pendtime;
if ( coin->current == bp ) //if ( 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); 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); } else printf("MSG_BLOCK null datalen.%d\n",len);
return(len); return(len);

Loading…
Cancel
Save