Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
daea8025dd
  1. 3
      crypto777/inet.c
  2. 2
      iguana/iguana777.h
  3. 4
      iguana/iguana_realtime.c
  4. 72
      iguana/iguana_recv.c

3
crypto777/inet.c

@ -34,8 +34,11 @@ struct sockaddr_in6 {
u_long sin6_scope_id;
};
#else
#ifndef __MINGW
#include <arpa/inet.h>
#endif
#endif
#ifdef _WIN32
#ifdef AF_INET6
#undef AF_INET6

2
iguana/iguana777.h

@ -20,8 +20,10 @@
!defined(WIN32) && !defined(__SYMBIAN32__)
#define WIN32
#else
#ifndef __MINGW
#include <arpa/inet.h>
#endif
#endif
//#define BTC2_VERSION
#define BTC2_HARDFORK_HEIGHT 444444

4
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; height<lastheight; height++)
for (height=lastheight-100000; height<lastheight; height++)
{
if ( height < 0 )
height = 0;
@ -688,7 +688,7 @@ void iguana_RTnewblock(struct iguana_info *coin,struct iguana_block *block)
if ( (bp= coin->bundles[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

72
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; i<n; i++)
{
flag = 0;
if ( (bp= coin->current) != 0 )
{
for (j=0; j<bp->n; 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; i<num; i++)
{
flag = 0;
if ( (bp= coin->current) != 0 )
{
for (j=0; j<bp->n; 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);
}

Loading…
Cancel
Save