From ae66699a613333dd223455528688ff204258a3b0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 11 May 2016 16:49:25 -0500 Subject: [PATCH] test --- iguana/iguana_accept.c | 9 +++++---- iguana/iguana_msg.c | 20 ++++---------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/iguana/iguana_accept.c b/iguana/iguana_accept.c index 8a57c67c2..7586bf3bb 100755 --- a/iguana/iguana_accept.c +++ b/iguana/iguana_accept.c @@ -178,7 +178,7 @@ void iguana_msgrequestQ(struct iguana_info *coin,struct iguana_peer *addr,int32_ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_info *coin) { - struct iguana_peermsgrequest *msg; struct instantdex_accept *ap; int32_t height,len,flag = 0; bits256 checktxid; struct iguana_txid *tx,T; + struct iguana_peermsgrequest *msg; struct instantdex_accept *ap; int32_t height,len,flag = 0; bits256 checktxid; struct iguana_txid *tx,T; struct iguana_peer *addr; if ( (msg= queue_dequeue(&coin->msgrequestQ,0)) != 0 ) { flag = 1; @@ -187,11 +187,12 @@ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_in char str[65]; printf("send type.%d %s -> (%s)\n",msg->type,bits256_str(str,msg->hash2),msg->addr->ipaddr); if ( msg->type == MSG_BLOCK ) { - if ( coin->RELAYNODE != 0 || coin->VALIDATENODE ) + if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) { - if ( (len= iguana_peerblockrequest(coin,&coin->blockspace[sizeof(struct iguana_msghdr)],sizeof(coin->blockspace),0,msg->hash2,0)) > 0 ) + if ( (addr= msg->addr) != 0 && (len= iguana_peerblockrequest(coin,&coin->blockspace[sizeof(struct iguana_msghdr)],(int32_t)(sizeof(coin->blockspace) - sizeof(struct iguana_msghdr)),0,msg->hash2,0)) > 0 ) { - iguana_queue_send(coin,msg->addr,0,coin->blockspace,"block",len,0,0); + printf("block len.%d -> (%s)\n",len,addr->ipaddr); + iguana_queue_send(coin,addr,0,coin->blockspace,"block",len,0,0); } } } diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 01bd96648..9b3cdcd9b 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -455,18 +455,6 @@ int32_t iguana_gentxarray(struct iguana_info *coin,struct OS_memspace *mem,struc { if ( (n= iguana_rwtx(0,mem,&data[len],&tx[i],recvlen - len,&tx[i].txid,coin->chain->hastimestamp,strcmp(coin->symbol,"VPN")==0)) < 0 ) break; - if ( 0 && bits256_cmp(tx[i].txid,bits256_conv("091c99b7b7f9b83ad2385c45b342ed5dd57035d15ff812262a3ceb3f1b291a5a")) == 0 ) - { - int32_t j; for (j=0; len+jchain->hastimestamp,strcmp(coin->symbol,"VPN")==0)) < 0 ) - { - - } - debugtest = 0;*/ - } numvouts += tx[i].tx_out; numvins += tx[i].tx_in; len += n; @@ -575,7 +563,7 @@ int32_t iguana_intvectors(struct iguana_info *coin,struct iguana_peer *addr,int3 int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struct OS_memspace *rawmem,struct OS_memspace *txmem,struct OS_memspace *hashmem,struct iguana_msghdr *H,uint8_t *data,int32_t recvlen) { uint8_t serialized[16384]; char *retstr; struct supernet_info *myinfo = SuperNET_MYINFO(0); - int32_t i,retval,ishost,delay,srvmsg,bloom,sendlen=0,intvectors,len= -100; uint64_t nonce,x; bits256 hash2; + int32_t i,n,retval,ishost,delay,srvmsg,bloom,sendlen=0,intvectors,len= -100; uint64_t nonce,x; bits256 hash2; bloom = intvectors = srvmsg = -1; if ( addr != 0 ) { @@ -629,9 +617,9 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc addr->msgcounts.block++; iguana_memreset(rawmem), iguana_memreset(txmem); memset(&txdata,0,sizeof(txdata)); - if ( (len= iguana_gentxarray(coin,rawmem,&txdata,&len,data,recvlen)) == recvlen ) + if ( (n= iguana_gentxarray(coin,rawmem,&txdata,&len,data,recvlen)) == recvlen ) iguana_gotblockM(coin,addr,&txdata,rawmem->ptr,H,data,recvlen); - else printf("parse error block txn_count.%d, len.%d vs recvlen.%d from.(%s)\n",txdata.block.RO.txn_count,len,recvlen,addr->ipaddr); + else printf("parse error block txn_count.%d, n.%d len.%d vs recvlen.%d from.(%s)\n",txdata.block.RO.txn_count,n,len,recvlen,addr->ipaddr); } else len = iguana_peergetrequest(coin,addr,data,recvlen,1); } } @@ -831,7 +819,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc //for (i=0; icommand,"addr") != 0 ) - printf("%s.%s len mismatch %d != %d\n",addr!=0?addr->ipaddr:"local",H->command,len,recvlen); + printf("%s %s.%s len mismatch %d != %d\n",coin->symbol,addr!=0?addr->ipaddr:"local",H->command,len,recvlen); } else if ( len != recvlen ) {