Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
8ace53a2fa
  1. 14
      iguana/iguana_msg.c

14
iguana/iguana_msg.c

@ -571,20 +571,20 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
{
int32_t reqvers,flag = 0;
addr->msgcounts.getblocks++;
len = iguana_rwnum(0,&data[sizeof(struct iguana_msghdr)],sizeof(uint32_t),&reqvers);
len += iguana_rwvarint32(0,&data[sizeof(struct iguana_msghdr) + len],(uint32_t *)&n);
len = iguana_rwnum(0,&data[0],sizeof(uint32_t),&reqvers);
len += iguana_rwvarint32(0,&data[len],(uint32_t *)&n);
for (i=0; i<10; i++)
printf("%02x ",data[i]);
printf("version.%d num blocks.%d recvlen.%d\n",reqvers,n,recvlen);
for (i=0; i<n; i++)
{
len += iguana_rwbignum(0,&data[sizeof(struct iguana_msghdr) + len],sizeof(bits256),hash2.bytes);
len += iguana_rwbignum(0,&data[len],sizeof(bits256),hash2.bytes);
if ( bits256_nonz(hash2) == 0 )
break;
if ( flag == 0 && iguana_peerblockrequest(coin,addr->blockspace,sizeof(addr->blockspace),addr,hash2,0) > 0 )
flag = 1;
}
len += iguana_rwbignum(0,&data[sizeof(struct iguana_msghdr) + len],sizeof(bits256),hash2.bytes);
len += iguana_rwbignum(0,&data[len],sizeof(bits256),hash2.bytes);
//len = recvlen;
}
}
@ -633,11 +633,11 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
else
{
addr->msgcounts.getheaders++;
len = iguana_rwnum(0,&data[sizeof(struct iguana_msghdr)],sizeof(uint32_t),&tmp);
len += iguana_rwvarint32(0,&data[sizeof(struct iguana_msghdr) + len],(uint32_t *)&n);
len = iguana_rwnum(0,&data[0],sizeof(uint32_t),&tmp);
len += iguana_rwvarint32(0,&data[len],(uint32_t *)&n);
for (i=nonz=0; i<n; i++)
{
len += iguana_rwbignum(0,&data[sizeof(struct iguana_msghdr) + len],sizeof(bits256),hash2.bytes);
len += iguana_rwbignum(0,&data[len],sizeof(bits256),hash2.bytes);
if ( bits256_nonz(hash2) == 0 )
break;
else if ( iguana_peerhdrrequest(coin,addr,hash2) > 0 )

Loading…
Cancel
Save