diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 59d310642..a170ecb7b 100755 --- a/iguana/iguana_bundles.c +++ b/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); diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index ca053c081..dfc011908 100755 --- a/iguana/iguana_msg.c +++ b/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; iblockspace,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; } } } diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index ae637f4ec..4d517f3c6 100755 --- a/iguana/iguana_ramchain.c +++ b/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 ) diff --git a/iguana/iguana_tx.c b/iguana/iguana_tx.c index b0c67ea62..f63ca006d 100755 --- a/iguana/iguana_tx.c +++ b/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); diff --git a/iguana/main.c b/iguana/main.c index efa9e5e07..8b6f2e039 100755 --- a/iguana/main.c +++ b/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";