diff --git a/iguana/iguana777.h b/iguana/iguana777.h index a49352244..4b2f0db94 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -471,7 +471,7 @@ struct iguana_info int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle; uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime; double backstopmillis; bits256 backstophash2; - int32_t initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,polltimeout,numreqtxids; bits256 reqtxids[64]; + int32_t initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,polltimeout,numreqtxids,allhashes; bits256 reqtxids[64]; void *launched,*started; uint64_t bloomsearches,bloomhits,bloomfalse,collisions; uint8_t blockspace[IGUANA_MAXPACKETSIZE + 8192]; struct OS_memspace blockMEM; struct iguana_blocks blocks; bits256 APIblockhash,APItxid; char *APIblockstr; diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index f00d0a521..c9d1ff924 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -865,9 +865,9 @@ uint32_t iguana_ramchain_addspend(struct iguana_info *coin,RAMCHAIN_FUNC,bits256 else { // struct iguana_spend { uint32_t spendtxidind,scriptoffset; int16_t prevout; uint16_t numsigs:4,numpubkeys:4,p2sh:1,sighash:4,external:1,sequenceid:2; } __attribute__((packed)); - //for (i=0; isequenceid = 1; else if ( sequence == 0xfffffffe ) @@ -1855,11 +1855,11 @@ int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain scriptlen = 0; if ( ramchain->expanded != 0 ) { - fprintf(stderr,"call vinscriptdecode\n"); + //fprintf(stderr,"call vinscriptdecode\n"); scriptlen = iguana_vinscriptdecode(coin,&metalen,&sequenceid,_script,&Kspace[ramchain->H.data->scriptspace],Kspace,&Sx[ramchain->H.spendind]); scriptdata = _script; prevout = iguana_ramchain_txid(coin,RAMCHAIN_ARG,&prevhash,&Sx[ramchain->H.spendind]); - fprintf(stderr,"from expanded iter\n"); + //fprintf(stderr,"from expanded iter\n"); if ( iguana_ramchain_addspend(coin,RAMCHAIN_ARG,prevhash,prevout,sequenceid,bp->hdrsi,scriptdata,scriptlen) == 0 ) { char str[65]; diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index cf3c873ca..be747cec6 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -288,10 +288,10 @@ void iguana_patch(struct iguana_info *coin,struct iguana_block *block) uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bits256 *blockhashes,int32_t num) { bits256 allhash; int32_t err,i,n; struct iguana_block *block,*prev; - if ( bits256_nonz(bp->allhash) > 0 && num >= coin->chain->bundlesize ) + if ( bits256_nonz(bp->allhash) > 0 && num >= coin->chain->bundlesize && bp->queued == 0 ) { vcalc_sha256(0,allhash.bytes,blockhashes[0].bytes,coin->chain->bundlesize * sizeof(*blockhashes)); - if ( memcmp(allhash.bytes,bp->allhash.bytes,sizeof(allhash)) == 0 && bp->queued == 0 ) + if ( memcmp(allhash.bytes,bp->allhash.bytes,sizeof(allhash)) == 0 ) { if ( bp->bundleheight > 0 ) prev = iguana_blockfind(coin,iguana_blockhash(coin,bp->bundleheight-1)); @@ -299,7 +299,10 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit for (i=n=0; ichain->bundlesize&&in; i++) { if ( (err= iguana_bundlehash2add(coin,&block,bp,i,blockhashes[i])) < 0 ) + { + printf("error adding blockhash allhashes hdrsi.%d i.%d\n",bp->hdrsi,i); return(err); + } if ( block != 0 && block == bp->blocks[i] ) { block->height = bp->bundleheight + i; @@ -310,10 +313,11 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit prev->hh.next = block; block->hh.prev = prev; } - } + } else printf("no allhashes block.%p or mismatch.%p\n",block,bp->blocks[i]); prev = block; } - printf("ALLHASHES FOUND! %d requested.%d\n",bp->bundleheight,n); + coin->allhashes++; + printf("ALLHASHES FOUND! %d allhashes.%d\n",bp->bundleheight,coin->allhashes); iguana_bundleQ(coin,bp,bp->n*5 + (rand() % 500)); return(bp->queued); }