diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 13bd43915..7216e0003 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -941,7 +941,8 @@ int32_t iguana_bundlefinalize(struct iguana_info *coin,struct iguana_bundle *bp, /*if ( bp->hdrsi == 0 && iguana_peerblockrequest(coin,coin->blockspace,sizeof(coin->blockspace),0,bp->hashes[0],1) > 0 ) printf("GENESIS block validated\n"); else printf("GENESIS didnt validate bp.%p\n",bp);*/ - //iguana_bundlevalidate(coin,bp,1); + if ( strcmp("BTC",coin->symbol) != 0 ) + iguana_bundlevalidate(coin,bp,1); } else { diff --git a/iguana/iguana_tx.c b/iguana/iguana_tx.c index b15e46477..1268064b4 100755 --- a/iguana/iguana_tx.c +++ b/iguana/iguana_tx.c @@ -25,11 +25,14 @@ int32_t iguana_scriptdata(struct iguana_info *coin,uint8_t *scriptspace,long fileptr[2],char *fname,uint32_t scriptpos,int32_t scriptlen) { FILE *fp; int32_t retval = scriptlen; +#ifndef __PNACL__ if ( fileptr[0] == 0 ) fileptr[0] = (uint64_t)OS_mapfile(fname,&fileptr[1],0); if ( fileptr[0] != 0 && (scriptpos + scriptlen) <= fileptr[1] ) memcpy(scriptspace,(void *)(fileptr[0] + scriptpos),scriptlen); - else if ( (fp= fopen(fname,"rb")) != 0 ) + else +#endif + if ( (fp= fopen(fname,"rb")) != 0 ) { fseek(fp,scriptpos,SEEK_SET); if ( fread(scriptspace,1,scriptlen,fp) != scriptlen ) @@ -173,7 +176,7 @@ int32_t iguana_ramtxbytes(struct iguana_info *coin,uint8_t *serialized,int32_t m int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int32_t max,struct iguana_peer *addr,bits256 hash2,int32_t validatesigs) { - struct iguana_txid *tx,T; bits256 checktxid; int32_t i,len,total,bundlei=-2; struct iguana_block *block; struct iguana_msgblock msgB; bits256 *tree,checkhash2,merkle_root; struct iguana_bundle *bp=0; long tmp; //char str[65]; + struct iguana_txid *tx,T; bits256 checktxid; int32_t i,len,total,bundlei=-2; struct iguana_block *block; struct iguana_msgblock msgB; bits256 *tree,checkhash2,merkle_root; struct iguana_bundle *bp=0; long tmp; char str[65]; if ( (bp= iguana_bundlefind(coin,&bp,&bundlei,hash2)) != 0 && bundlei >= 0 && bundlei < bp->n ) { if ( (block= bp->blocks[bundlei]) != 0 ) @@ -200,7 +203,7 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int } else { - // printf("null tx error getting txi.%d [%d:%d]\n",i,bp->hdrsi,bundlei); + printf("null tx error getting txi.%d [%d:%d]\n",i,bp->hdrsi,bundlei); break; } } @@ -224,12 +227,12 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int return(iguana_queue_send(coin,addr,0,blockspace,"block",total,0,0)); else { - //printf("validated.[%d:%d] len.%d\n",bp->hdrsi,bundlei,total); + printf("validated.[%d:%d] len.%d\n",bp->hdrsi,bundlei,total); return(total); } } else printf("iguana_peerblockrequest: error merkle cmp tx.[%d] for ht.%d\n",i,bp->bundleheight+bundlei); } else printf("iguana_peerblockrequest: error merkle verify tx.[%d] for ht.%d\n",i,bp->bundleheight+bundlei); - } // else printf("iguana_peerblockrequest: error getting tx.[%d] for ht.%d block.%p main.%d ht.%d\n",i,bp->bundleheight+bundlei,block,block!=0?block->mainchain:-1,block!=0?block->height:-1); + } else printf("iguana_peerblockrequest: error getting tx.[%d] for ht.%d block.%p main.%d ht.%d\n",i,bp->bundleheight+bundlei,block,block!=0?block->mainchain:-1,block!=0?block->height:-1); } else { @@ -237,7 +240,7 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int printf("iguana_peerblockrequest: block.%p ht.%d mainchain.%d [%d:%d]\n",block,block->height,block->mainchain,bp->hdrsi,bundlei); else printf("iguana_peerblockrequest: block.%p [%d:%d]\n",block,bp->hdrsi,bundlei); } - } // else printf("iguana_peerblockrequest: cant find %s\n",bits256_str(str,hash2)); + } else printf("iguana_peerblockrequest: cant find %s\n",bits256_str(str,hash2)); return(-1); } diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 31ee73610..b8272fcb0 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -2014,7 +2014,7 @@ int32_t iguana_bundlevalidate(struct iguana_info *coin,struct iguana_bundle *bp, if ( bp->validated <= 1 || forceflag != 0 ) { sprintf(fname,"%s/%s/validated/%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight); - printf("validatefname.(%s)\n",fname); + //printf("validatefname.(%s)\n",fname); if ( (fp= fopen(fname,"rb")) != 0 ) { if ( forceflag == 0 ) @@ -2023,7 +2023,7 @@ int32_t iguana_bundlevalidate(struct iguana_info *coin,struct iguana_bundle *bp, { printf("error reading.(%s)\n",fname); total = bp->validated = 0; - } else printf("(%s) total.%d validated.%u\n",fname,(int32_t)total,bp->validated); + } //else printf("(%s) total.%d validated.%u\n",fname,(int32_t)total,bp->validated); } else OS_removefile(fname,1); fclose(fp); } @@ -2033,7 +2033,6 @@ int32_t iguana_bundlevalidate(struct iguana_info *coin,struct iguana_bundle *bp, blockspace = calloc(1,max); for (i=0; in; i++) { - printf("i.%d: request\n",i); if ( (len= iguana_peerblockrequest(coin,blockspace,max,0,bp->hashes[i],1)) < 0 ) { errs++;