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