jl777 8 years ago
parent
commit
4e6f4bd0e1
  1. 9
      iguana/iguana_ramchain.c
  2. 6
      iguana/iguana_tx.c
  3. 2
      includes/iguana_structs.h

9
iguana/iguana_ramchain.c

@ -2279,7 +2279,7 @@ struct iguana_ramchain *iguana_bundleload(struct supernet_info *myinfo,struct ig
{ {
static const bits256 zero; static const bits256 zero;
struct iguana_blockRO *B; struct iguana_txid *T; int32_t i,firsti = 1; char fname[512]; struct iguana_blockRO *B; struct iguana_txid *T; int32_t i,firsti = 1; char fname[512];
struct iguana_block *block,*prev,*prev2; struct iguana_ramchain *mapchain; struct iguana_ramchaindata *rdata; struct iguana_block *block,*prev,*prev2; struct iguana_ramchain *mapchain; struct iguana_ramchaindata *rdata; uint32_t firsttxidind;
if ( bp->emitfinish > 1 ) if ( bp->emitfinish > 1 )
return(ramchain); return(ramchain);
memset(ramchain,0,sizeof(*ramchain)); memset(ramchain,0,sizeof(*ramchain));
@ -2293,6 +2293,7 @@ struct iguana_ramchain *iguana_bundleload(struct supernet_info *myinfo,struct ig
B = RAMCHAIN_PTR(rdata,Boffset); B = RAMCHAIN_PTR(rdata,Boffset);
T = RAMCHAIN_PTR(rdata,Toffset); T = RAMCHAIN_PTR(rdata,Toffset);
prev = prev2 = 0; prev = prev2 = 0;
firsttxidind = 1;
for (i=0; i<bp->n; i++) for (i=0; i<bp->n; i++)
{ {
if ( (block= bp->blocks[i]) != 0 || (block= iguana_blockhashset("bundleload",coin,bp->bundleheight+i,bp->hashes[i],1)) != 0 ) if ( (block= bp->blocks[i]) != 0 || (block= iguana_blockhashset("bundleload",coin,bp->bundleheight+i,bp->hashes[i],1)) != 0 )
@ -2304,6 +2305,7 @@ struct iguana_ramchain *iguana_bundleload(struct supernet_info *myinfo,struct ig
} }
block->queued = 1; block->queued = 1;
block->txvalid = 1; block->txvalid = 1;
block->RO.firsttxidind = firsttxidind;
block->height = bp->bundleheight + i; block->height = bp->bundleheight + i;
//printf("bundleload bundlei.%d < height %d %d\n",i,block->height,i); //printf("bundleload bundlei.%d < height %d %d\n",i,block->height,i);
block->hdrsi = bp->hdrsi; block->hdrsi = bp->hdrsi;
@ -2311,8 +2313,10 @@ struct iguana_ramchain *iguana_bundleload(struct supernet_info *myinfo,struct ig
block->fpipbits = (uint32_t)calc_ipbits("127.0.0.1"); block->fpipbits = (uint32_t)calc_ipbits("127.0.0.1");
iguana_blockzcopyRO(coin->chain->zcash,&block->RO,0,B,i); iguana_blockzcopyRO(coin->chain->zcash,&block->RO,0,B,i);
//printf("%x ",(int32_t)B[i].hash2.ulongs[3]); //printf("%x ",(int32_t)B[i].hash2.ulongs[3]);
iguana_hash2set(coin,"bundleload",bp,i,block->RO.hash2);
bp->blocks[i] = block; bp->blocks[i] = block;
bp->hashes[i] = block->RO.hash2;
bp->firsttxidinds[i] = firsttxidind;
iguana_hash2set(coin,"bundleload",bp,i,block->RO.hash2);
if ( (prev= block->hh.prev) != 0 ) if ( (prev= block->hh.prev) != 0 )
{ {
prev2 = prev->hh.prev; prev2 = prev->hh.prev;
@ -2328,6 +2332,7 @@ struct iguana_ramchain *iguana_bundleload(struct supernet_info *myinfo,struct ig
//_iguana_chainlink(coin,block); //wrong context //_iguana_chainlink(coin,block); //wrong context
} }
prev2 = prev, prev = block; prev2 = prev, prev = block;
firsttxidind += block->RO.txn_count;
} }
} }
} }

6
iguana/iguana_tx.c

@ -156,13 +156,13 @@ struct iguana_txid *iguana_blocktx(struct iguana_info *coin,struct iguana_txid *
{ {
if ( (bp= coin->bundles[block->hdrsi]) != 0 ) if ( (bp= coin->bundles[block->hdrsi]) != 0 )
{ {
if ( (txidind= block->RO.firsttxidind) > 0 ) if ( (txidind= block->RO.firsttxidind) == bp->firsttxidinds[block->bundlei] )
{ {
if ( iguana_bundletx(coin,bp,block->bundlei,tx,txidind+i) == tx ) if ( iguana_bundletx(coin,bp,block->bundlei,tx,txidind+i) == tx )
return(tx); return(tx);
printf("error getting txidind.%d + i.%d from hdrsi.%d\n",txidind,i,block->hdrsi); printf("error getting txidind.%d + i.%d from hdrsi.%d\n",txidind,i,block->hdrsi);
return(0); return(0);
} else printf("iguana_blocktx null txidind [%d:%d] i.%d\n",block->hdrsi,block->bundlei,i); } else printf("iguana_blocktx null txidind [%d:%d] i.%d txidind.%d vs %d\n",block->hdrsi,block->bundlei,i,txidind,bp->firsttxidinds[block->bundlei]);
} else printf("iguana_blocktx no bp.[%d]\n",block->hdrsi); } else printf("iguana_blocktx no bp.[%d]\n",block->hdrsi);
} else printf("%s blocktx illegal height.%d or [%d:%d]\n",coin->symbol,block->height,block->hdrsi,block->bundlei); } else printf("%s blocktx illegal height.%d or [%d:%d]\n",coin->symbol,block->height,block->hdrsi,block->bundlei);
} else printf("i.%d vs txn_count.%d\n",i,block->RO.txn_count); } else printf("i.%d vs txn_count.%d\n",i,block->RO.txn_count);
@ -274,7 +274,7 @@ int32_t iguana_peerblockrequest(struct supernet_info *myinfo,struct iguana_info
{ {
if ( (tx= iguana_blocktx(coin,&T,block,i)) != 0 ) if ( (tx= iguana_blocktx(coin,&T,block,i)) != 0 )
{ {
printf("txi.%d i.%d o.%d %s\n",i,T.numvins,T.numvouts,bits256_str(str,T.txid)); //printf("ht.%d [%d:%d] txi.%d i.%d o.%d %s\n",block->height,block->hdrsi,block->bundlei,i,tx->numvins,tx->numvouts,bits256_str(str,tx->txid));
if ( (len= iguana_ramtxbytes(coin,&blockspace[sizeof(struct iguana_msghdr) + total],max - total,&checktxid,tx,block->height,0,0,validatesigs)) > 0 )//&& bits256_cmp(checktxid,T.txid) == 0 ) if ( (len= iguana_ramtxbytes(coin,&blockspace[sizeof(struct iguana_msghdr) + total],max - total,&checktxid,tx,block->height,0,0,validatesigs)) > 0 )//&& bits256_cmp(checktxid,T.txid) == 0 )
total += len; total += len;
else else

2
includes/iguana_structs.h

@ -380,7 +380,7 @@ struct iguana_bundle
double avetime,threshold,metric; uint64_t datasize,estsize; double avetime,threshold,metric; uint64_t datasize,estsize;
struct iguana_block *blocks[IGUANA_MAXBUNDLESIZE]; struct iguana_block *blocks[IGUANA_MAXBUNDLESIZE];
uint8_t *speculativecache[IGUANA_MAXBUNDLESIZE],haveblock[IGUANA_MAXBUNDLESIZE/3+1]; uint8_t *speculativecache[IGUANA_MAXBUNDLESIZE],haveblock[IGUANA_MAXBUNDLESIZE/3+1];
uint32_t issued[IGUANA_MAXBUNDLESIZE]; uint32_t issued[IGUANA_MAXBUNDLESIZE],firsttxidinds[IGUANA_MAXBUNDLESIZE];
bits256 prevbundlehash2,hashes[IGUANA_MAXBUNDLESIZE+1],nextbundlehash2,allhash,*speculative,validatehash; bits256 prevbundlehash2,hashes[IGUANA_MAXBUNDLESIZE+1],nextbundlehash2,allhash,*speculative,validatehash;
struct iguana_ramchain ramchain; uint8_t red,green,blue; struct iguana_ramchain ramchain; uint8_t red,green,blue;
struct iguana_spendvector *tmpspends; int32_t numtmpspends; struct iguana_spendvector *tmpspends; int32_t numtmpspends;

Loading…
Cancel
Save