From 9b2f039c8829933c62f1eee7044bf059897d338a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 3 Nov 2016 16:33:23 -0300 Subject: [PATCH] test --- iguana/iguana_msg.c | 2 +- iguana/iguana_ramchain.c | 4 ++-- iguana/iguana_recv.c | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 0a4b703ac..420de999d 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -976,7 +976,7 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s if ( (n= iguana_gentxarray(myinfo,coin,rawmem,&txdata,&len,data,recvlen)) == recvlen || n == recvlen-1 ) { len = n; - iguana_gotblockM(myinfo,coin,addr,&txdata,rawmem->ptr,H,data,recvlen,fromcache,coin->chain->zcash); + iguana_gotblockM(myinfo,coin,addr,&txdata,rawmem->ptr,H,data,recvlen,fromcache,0*coin->chain->zcash); } else { diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 8f710d419..ae9425f66 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1821,10 +1821,10 @@ int32_t iguana_ramchain_iterate(struct supernet_info *myinfo,struct iguana_info long iguana_ramchain_data(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,struct iguana_txblock *origtxdata,struct iguana_msgtx *txarray,int32_t txn_count,uint8_t *data,int32_t recvlen,struct iguana_bundle *bp,struct iguana_block *block,uint8_t zcash) { int32_t verifyflag = 0; - RAMCHAIN_DECLARE; struct iguana_ramchain R,*mapchain,*ramchain = &addr->ramchain; struct iguana_msgtx *tx; char fname[1024]; uint8_t rmd160[20]; struct iguana_ramchaindata *rdata; int32_t i,j,fpos,pubkeysize,sigsize,hdrsi,subdir,firsti=1,err,flag,bundlei; uint32_t scriptspace,stackspace; struct iguana_blockRO RO; + RAMCHAIN_DECLARE; struct iguana_ramchain R,*mapchain,*ramchain = &addr->ramchain; struct iguana_msgtx *tx; char fname[1024]; uint8_t rmd160[20]; struct iguana_ramchaindata *rdata; int32_t i,j,fpos,pubkeysize,sigsize,hdrsi,subdir,firsti=1,err,flag,bundlei=-1; uint32_t scriptspace,stackspace; struct iguana_blockRO RO; if ( block == 0 || bp == 0 || addr == 0 || (block != 0 && (bundlei= block->bundlei) < 0) ) { - //printf("iguana_ramchain_data: null ptr %p %p %p\n",block,bp,addr); + printf("iguana_ramchain_data: null ptr %p %p %p bundlei.%d\n",block,bp,addr,bundlei); return(-1); } #ifdef __PNACL__ diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 746f0c317..26764a123 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -795,7 +795,7 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru //printf("negative speculative return %s\n",bits256_str(str,origtxdata->zblock.RO.hash2)); return; } - if ( 0 && bp == coin->current ) + if ( bp == coin->current ) { if ( block == 0 ) block = iguana_blockhashset("noblock",coin,bp->bundleheight+bundlei,origtxdata->zblock.RO.hash2,1); @@ -808,7 +808,7 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru } if ( (block= bp->blocks[bundlei]) == 0 || bits256_nonz(bp->hashes[bundlei]) == 0 ) { - //printf("SET [%d:%d]\n",bp->hdrsi,bundlei); + printf("SET [%d:%d]\n",bp->hdrsi,bundlei); //iguana_hash2set(coin,"noblock",bp,bundlei,origtxdata->zblock.RO.hash2); bp->hashes[bundlei] = origtxdata->zblock.RO.hash2; if ( bp->speculative != 0 ) @@ -819,8 +819,9 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru iguana_RTgotblock(coin,origtxdata->zblock.RO.hash2,data,&recvlen,&numtx); if ( block != 0 ) { - if ( block->height < 0 ) - block->bundlei = -1; + block->hdrsi = bp->hdrsi; + block->bundlei = bundlei; + block->height = bp->hdrsi*coin->chain->bundlesize + bundlei; block->txvalid = 1; block->RO.txn_count = origtxdata->zblock.RO.txn_count; if ( block->fpipbits != 0 && block->fpos >= 0 ) @@ -1649,7 +1650,8 @@ struct iguana_bundlereq *iguana_recvblock(struct supernet_info *myinfo,struct ig coin->longestchain = prevblock->height+1; } else iguana_blockQ("prev",coin,0,-1,origblock->RO.prev_block,1); } - //printf("%s received.(%s) %s\n",coin->symbol,bits256_str(str,origblock->RO.hash2),addr->ipaddr); + if ( 0 && block != 0 ) + printf("%s received.(%s) [%d:%d]\n",coin->symbol,bits256_str(str,origblock->RO.hash2),block->hdrsi,block->bundlei); if ( (bp= iguana_bundleset(myinfo,coin,&block,&bundlei,(struct iguana_block *)origblock)) != 0 && bp == coin->current && block != 0 && bp->speculative != 0 && bundlei >= 0 ) { if ( 0 && strcmp("BTCD",coin->symbol) == 0 )