Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
3b0efd5d76
  1. 2
      iguana/iguana_blocks.c
  2. 15
      iguana/iguana_ramchain.c

2
iguana/iguana_blocks.c

@ -416,7 +416,6 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
//printf("created last bundle ht.%d\n",bp->bundleheight);
iguana_blockreq(coin,block->height,1);
}
iguana_walkchain(coin);
}
else
{
@ -445,6 +444,7 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
//iguana_blockQ("mainchain",coin,bp,block->height % coin->chain->bundlesize,block->RO.hash2,0);
}
block->mainchain = 1;
iguana_walkchain(coin);
return(block);
}
}

15
iguana/iguana_ramchain.c

@ -2309,7 +2309,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
static int depth; static const bits256 zero;
RAMCHAIN_DESTDECLARE; RAMCHAIN_DECLARE; RAMCHAIN_ZEROES;
void **ptrs; long *filesizes; uint32_t *ipbits; char fname[1024];
struct iguana_ramchain *R,*mapchain,*dest,newchain; uint32_t fpipbits;
struct iguana_ramchain *R,*mapchain,*dest,newchain; uint32_t fpipbits; bits256 prevhash2;
int32_t i,starti,endi,bp_n,numtxids,valid,sigspace,pubkeyspace,numunspents,numspends,numpkinds,numexternaltxids,scriptspace; struct iguana_block *block; long fpos;
struct OS_memspace HASHMEM; int32_t err,j,num,hdrsi,bundlei,firsti= 1,retval = -1;
memset(&HASHMEM,0,sizeof(HASHMEM));
@ -2330,6 +2330,9 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
bp_n = (endi - starti + 1);
scriptspace = 1;
sigspace = pubkeyspace = 0;
if ( (block= bp->blocks[starti]) != 0 )
prevhash2 = block->RO.prev_block;
else memset(prevhash2.bytes,0,sizeof(prevhash2));
for (bundlei=starti,numtxids=numunspents=scriptspace=numspends=0; bundlei<=endi; bundlei++)
{
if ( coin->active == 0 )
@ -2337,7 +2340,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
iguana_bundlemapfree(coin,mem,&HASHMEM,ipbits,ptrs,filesizes,num,R,starti,endi);
return(-1);
}
if ( (block= bp->blocks[bundlei]) == 0 || bits256_nonz(block->RO.hash2) == 0 || memcmp(block->RO.hash2.bytes,bp->hashes[bundlei].bytes,sizeof(bits256)) != 0 ) // block != iguana_blockfind("bundlesave",coin,block->RO.hash2)
if ( (block= bp->blocks[bundlei]) == 0 || bits256_nonz(block->RO.hash2) == 0 || memcmp(block->RO.hash2.bytes,bp->hashes[bundlei].bytes,sizeof(bits256)) != 0 || bits256_cmp(block->RO.prev_block,prevhash2) != 0 ) // block != iguana_blockfind("bundlesave",coin,block->RO.hash2)
{
printf("block.%p error vs %p\n",block,iguana_blockfind("bundlesaveerr",coin,block->RO.hash2));
break;
@ -2355,9 +2358,15 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
//sigspace += sigsize;
//pubkeyspace += pubkeysize;
//printf("%x ",(uint32_t)block->RO.hash2.ulongs[3]);
// _iguana_ramchain_setptrs(MAPCHAIN_PTRS,mapchain->H.data);
_iguana_ramchain_setptrs(MAPCHAIN_PTRS,mapchain->H.data);
if ( bits256_cmp(B[0].hash2,block->RO.hash2) != 0 )
{
printf("mapped chain [%d:%d] hash2 mismatch\n",bp->hdrsi,bundlei);
break;
}
//printf("(%d %d).%d ",mapchain->H.data->numtxids,bp->blocks[bundlei]->RO.txn_count,numtxids);
//printf("%d ",numtxids);
prevhash2 = block->RO.hash2;
}
scriptspace += pubkeyspace*1.1 + sigspace*1.1;
//printf("mem.%p mapchain txid tables, scriptspace.%u sigspace.%u pubkeyspace.%u bundlei.%d/%d\n",mem,scriptspace,sigspace,pubkeyspace,bundlei,bp->n);

Loading…
Cancel
Save