Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
54850c29ac
  1. 5
      iguana/iguana_bundles.c
  2. 9
      iguana/iguana_msg.c
  3. 3
      iguana/iguana_ramchain.c
  4. 3
      iguana/iguana_tx.c
  5. 2
      iguana/main.c

5
iguana/iguana_bundles.c

@ -343,7 +343,10 @@ struct iguana_bundle *iguana_bundlecreate(struct iguana_info *coin,int32_t *bund
}
*bundleip = 0;
bits256_str(str,bundlehash2);
char dirname[1024]; sprintf(dirname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,bp->bundleheight), OS_ensure_directory(dirname);
char dirname[1024]; int32_t subdir;
subdir = bp->bundleheight / IGUANA_SUBDIRDIVISOR;
sprintf(dirname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,subdir), OS_ensure_directory(dirname);
sprintf(dirname,"%s/%s/%d/%d",GLOBAL_TMPDIR,coin->symbol,subdir,bp->bundleheight), OS_ensure_directory(dirname);
//sprintf(dirname,"DB/%s/%d",coin->symbol,bp->bundleheight), OS_ensure_directory(dirname);
//printf("%s ht.%d alloc.[%d] new hdrs.%s\n",coin->symbol,bp->bundleheight,coin->bundlescount,bits256_str(str,bp->hashes[0]));
iguana_bundlehash2add(coin,0,bp,0,bundlehash2);

9
iguana/iguana_msg.c

@ -569,16 +569,19 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
}
else
{
int32_t flag = 0;
addr->msgcounts.getblocks++;
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);
printf("version.%d num blocks.%d\n",tmp,n);
for (i=0; i<n; i++)
{
len += iguana_rwbignum(0,&data[sizeof(struct iguana_msghdr) + len],sizeof(bits256),hash2.bytes);
iguana_peerblockrequest(coin,addr->blockspace,sizeof(addr->blockspace),addr,hash2,0);
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 = recvlen;
}
}
}

3
iguana/iguana_ramchain.c

@ -2602,7 +2602,8 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
sprintf(dirname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,bp->bundleheight), OS_portable_rmdir(dirname,1);
}
sleep(1);
iguana_bundleload(coin,&newchain,bp,0);
if ( iguana_bundleload(coin,&newchain,bp,0) == 0 )
retval = -1;
newchain.A = 0;
}
if ( coin->active != 0 )

3
iguana/iguana_tx.c

@ -244,7 +244,10 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int
if ( bits256_cmp(merkle_root,block->RO.merkle_root) == 0 )
{
if ( addr != 0 )
{
printf("Send block.%d to %s\n",total,addr->ipaddr);
return(iguana_queue_send(coin,addr,0,blockspace,"block",total,0,0));
}
else
{
//printf("validated.[%d:%d] len.%d\n",bp->hdrsi,bundlei,total);

2
iguana/main.c

@ -68,7 +68,7 @@ int32_t HDRnet,netBLOCKS;
cJSON *API_json;
#ifdef __PNACL__
char GLOBAL_TMPDIR[512] = "/DB/tmp";
char GLOBAL_TMPDIR[512] = "/tmp";
char GLOBAL_DBDIR[512] = "/DB";
char GLOBAL_HELPDIR[512] = "/DB/help";
char GLOBAL_VALIDATEDIR[512] = "/DB/purgeable";

Loading…
Cancel
Save