Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a3a7ca1cea
  1. 2
      iguana/iguana777.h
  2. 35
      iguana/iguana_bundles.c

2
iguana/iguana777.h

@ -42,7 +42,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_HEADPERCENTAGE 0.
#define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1
#define IGUANA_MAXPENDINGREQUESTS 1
#define IGUANA_MAXPENDINGREQUESTS 512
#define IGUANA_PENDINGREQUESTS 512
#define IGUANA_MINPENDBUNDLES 2
#define IGUANA_MAXPENDBUNDLES 64

35
iguana/iguana_bundles.c

@ -479,32 +479,31 @@ int32_t iguana_blocksmissing(struct iguana_info *coin,int32_t *nonzp,uint8_t mis
int32_t iguana_sendhashes(struct iguana_info *coin,struct iguana_peer *addr,int32_t msgtype,bits256 hashes[],int32_t n)
{
int32_t len; uint8_t *serialized;
if ( strcmp("BTC",coin->symbol) != 0 )
{
serialized = malloc((sizeof(int32_t) + sizeof(*hashes))*n + 1024);
if ( (len= iguana_getdata(coin,serialized,MSG_BLOCK,hashes,n)) > 0 )
if ( 0 && strcmp("BTC",coin->symbol) != 0 )
{
if ( len > (sizeof(int32_t) + sizeof(*hashes))*n + 1024 )
serialized = malloc((sizeof(int32_t) + sizeof(*hashes))*n + 1024);
if ( (len= iguana_getdata(coin,serialized,MSG_BLOCK,hashes,n)) > 0 )
{
printf("FATAL ERROR iguana_sendhashes: len.%d size.%ld\n",len,(sizeof(int32_t) + sizeof(*hashes))*n + 1024);
exit(-1);
}
iguana_send(coin,addr,serialized,len);
coin->numreqsent += n;
addr->pendblocks += n;
addr->pendtime = (uint32_t)time(NULL);
//printf("sendhashes[%d] -> %s\n",n,addr->ipaddr);
} else n = 0;
free(serialized);
if ( len > (sizeof(int32_t) + sizeof(*hashes))*n + 1024 )
{
printf("FATAL ERROR iguana_sendhashes: len.%d size.%ld\n",len,(sizeof(int32_t) + sizeof(*hashes))*n + 1024);
exit(-1);
}
iguana_send(coin,addr,serialized,len);
coin->numreqsent += n;
addr->pendblocks += n;
addr->pendtime = (uint32_t)time(NULL);
//printf("sendhashes[%d] -> %s\n",n,addr->ipaddr);
} else n = 0;
free(serialized);
}
else
{
int32_t i;
for (i=0; i<n; i++)
{
iguana_sendblockreqPT(coin,addr,0,-1,hashes[i],0);
//iguana_blockQ("test",coin,0,-1,hashes[i],0);
//iguana_sendblockreqPT(coin,addr,0,-1,hashes[i],0);
iguana_blockQ("test",coin,0,-1,hashes[i],0);
}
}
return(n);

Loading…
Cancel
Save