diff --git a/crypto777/inet.c b/crypto777/inet.c index bd0b8769d..6579bd6be 100755 --- a/crypto777/inet.c +++ b/crypto777/inet.c @@ -34,8 +34,11 @@ struct sockaddr_in6 { u_long sin6_scope_id; }; #else +#ifndef __MINGW #include #endif +#endif + #ifdef _WIN32 #ifdef AF_INET6 #undef AF_INET6 diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 959537910..98b1e3855 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -20,8 +20,10 @@ !defined(WIN32) && !defined(__SYMBIAN32__) #define WIN32 #else +#ifndef __MINGW #include #endif +#endif //#define BTC2_VERSION #define BTC2_HARDFORK_HEIGHT 444444 diff --git a/iguana/iguana_realtime.c b/iguana/iguana_realtime.c index 7c05f6e6d..c1f12fe8c 100755 --- a/iguana/iguana_realtime.c +++ b/iguana/iguana_realtime.c @@ -572,7 +572,7 @@ void iguana_RTpurge(struct iguana_info *coin,int32_t lastheight) { int32_t hdrsi,bundlei,height,numtx=0,recvlen=-1; struct iguana_bundle *bp; printf("start RTpurge from %d\n",lastheight - coin->chain->bundlesize*10); - for (height=lastheight-coin->chain->bundlesize*10; heightbundles[hdrsi]) != 0 && (addblock= bp->blocks[bundlei]) != 0 && addblock->height == coin->RTheight+i ) { if ( iguana_RTblockadd(coin,addblock) < 0 ) - return; + break; coin->lastRTheight = addblock->height; } else diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 83277d36d..85d227780 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -572,7 +572,7 @@ void iguana_gotheadersM(struct iguana_info *coin,struct iguana_peer *addr,struct void iguana_gotblockhashesM(struct iguana_info *coin,struct iguana_peer *addr,bits256 *blockhashes,int32_t n) { - struct iguana_bundlereq *req; int32_t i,num,j,flag; struct iguana_bundle *bp; + struct iguana_bundlereq *req; int32_t num; if ( addr != 0 ) { addr->recvhdrs++; @@ -593,32 +593,7 @@ void iguana_gotblockhashesM(struct iguana_info *coin,struct iguana_peer *addr,bi queue_enqueue("recvQ",&coin->recvQ,&req->DL,0); if ( strcmp("BTC",coin->symbol) != 0 ) { - if ( coin->RTheight > 0 ) - { - for (i=1; icurrent) != 0 ) - { - for (j=0; jn; j++) - { - if ( j < bp->numspec && bp->speculative != 0 && bits256_cmp(bp->speculative[j],blockhashes[i]) == 0 ) - { - flag = 1; - break; - } - if ( bits256_cmp(bp->hashes[j],blockhashes[i]) == 0 ) - { - flag = 1; - break; - } - } - } - if ( flag == 0 ) - iguana_sendblockreqPT(coin,addr,0,-1,blockhashes[i],0); - } - } - else if ( n > coin->chain->bundlesize ) + if ( n > coin->chain->bundlesize ) iguana_sendblockreqPT(coin,addr,0,-1,blockhashes[1],0); } } @@ -1205,6 +1180,49 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct iguana_blockQ("recvhash7",coin,0,-7,blockhashes[1],1); iguana_blockQ("recvhash7",coin,0,-7,blockhashes[num-1],1); } + if ( coin->RTheight > 0 ) + { + int32_t j,flag; + for (i=1; icurrent) != 0 ) + { + for (j=0; jn; j++) + { + if ( j < bp->numspec && bp->speculative != 0 && bits256_cmp(bp->speculative[j],blockhashes[i]) == 0 ) + { + flag = 1; + if ( (block= iguana_blockfind("hashspec",coin,blockhashes[i])) != 0 ) + { + if ( block->mainchain != 0 && block->txvalid != 0 && block->hdrsi != bp->hdrsi ) + { + printf("found [%d:%d] in [%d:%d]'s place\n",block->hdrsi,block->bundlei,bp->hdrsi,j); + memset(&bp->speculative[j],0,sizeof(bp->speculative[j])); + } + } + break; + } + if ( bits256_cmp(bp->hashes[j],blockhashes[i]) == 0 ) + { + flag = 1; + if ( (block= iguana_blockfind("hashspec",coin,blockhashes[i])) != 0 ) + { + if ( block->mainchain != 0 && block->txvalid != 0 && block->hdrsi != bp->hdrsi ) + { + printf("found [%d:%d] in [%d:%d]'s place\n",block->hdrsi,block->bundlei,bp->hdrsi,j); + memset(&bp->hashes[j],0,sizeof(bp->hashes[j])); + bp->blocks[j] = 0; + } + } + break; + } + } + } + if ( flag == 0 ) + iguana_sendblockreqPT(coin,addr,0,-1,blockhashes[i],0); + } + } return(req); }