|
|
@ -1968,6 +1968,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru |
|
|
|
struct iguana_msgtx *tx; int32_t i,j,fpos,scriptsize,pubkeysize,sigsize,firsti=1,err,flag,scriptspace=0,bundlei = -2; |
|
|
|
char fname[1024]; uint8_t rmd160[20]; |
|
|
|
struct iguana_bundle *bp = 0; struct iguana_block *block; |
|
|
|
fprintf(stderr,"ramchaindata\n"); |
|
|
|
if ( iguana_bundlefind(coin,&bp,&bundlei,origtxdata->block.RO.hash2) == 0 ) |
|
|
|
{ |
|
|
|
if ( iguana_bundlefind(coin,&bp,&bundlei,origtxdata->block.RO.prev_block) == 0 ) |
|
|
@ -1976,7 +1977,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru |
|
|
|
bundlei++; |
|
|
|
else |
|
|
|
{ |
|
|
|
printf("error finding block\n"); |
|
|
|
printf("ramchain data: error finding block\n"); |
|
|
|
return(-1); |
|
|
|
} |
|
|
|
} |
|
|
@ -1984,17 +1985,17 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru |
|
|
|
// bp->hashes[bundlei] = origtxdata->block.RO.hash2;
|
|
|
|
if ( (block= bp->blocks[bundlei]) == 0 ) |
|
|
|
{ |
|
|
|
//char str[65]; printf("%d:%d has no block ptr %s\n",bp->hdrsi,bundlei,bits256_str(str,bp->hashes[bundlei]));
|
|
|
|
char str[65]; printf("%d:%d has no block ptr %s\n",bp->hdrsi,bundlei,bits256_str(str,bp->hashes[bundlei])); |
|
|
|
return(-1); |
|
|
|
} |
|
|
|
if ( block->fpipbits != 0 ) |
|
|
|
{ |
|
|
|
//printf("ramchaindata have %d:%d at %d\n",bp->hdrsi,bundlei,bp->fpos[bundlei]);
|
|
|
|
printf("ramchaindata have %d:%d at %d\n",bp->hdrsi,bundlei,block->fpos); |
|
|
|
return(block->fpos); |
|
|
|
} |
|
|
|
fpos = -1; |
|
|
|
scriptspace = iguana_scriptspaceraw(coin,&scriptsize,&sigsize,&pubkeysize,txarray,txn_count); |
|
|
|
//printf("bp.[%d:%d] <- scriptspace.%d expanded.%d\n",bp->hdrsi,bundlei,scriptspace,ramchain->expanded);
|
|
|
|
printf("bp.[%d:%d] <- scriptspace.%d expanded.%d\n",bp->hdrsi,bundlei,scriptspace,ramchain->expanded); |
|
|
|
if ( iguana_ramchain_init(ramchain,&addr->TXDATA,&addr->HASHMEM,1,txn_count,origtxdata->numunspents,origtxdata->numspends,0,0,scriptspace,0,1) == 0 ) |
|
|
|
return(-1); |
|
|
|
iguana_ramchain_link(ramchain,origtxdata->block.RO.hash2,origtxdata->block.RO.hash2,bp->hdrsi,bp->bundleheight+bundlei,bundlei,1,firsti,0); |
|
|
@ -2028,7 +2029,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru |
|
|
|
//printf(" msg spendind.%d\n",ramchain->H.spendind);
|
|
|
|
} |
|
|
|
} |
|
|
|
//char str[65]; printf("before height.%d num.%d:%d T.%d U.%d S.%d P.%d X.%d %s\n",ramchain->height,ramchain->numblocks,ramchain->H.data->numblocks,ramchain->H.txidind,ramchain->H.unspentind,ramchain->H.spendind,ramchain->pkind,ramchain->externalind,bits256_str(str,ramchain->H.data->firsthash2));
|
|
|
|
char str[65]; printf("before height.%d num.%d:%d T.%d U.%d S.%d P.%d X.%d %s\n",ramchain->height,ramchain->numblocks,ramchain->H.data->numblocks,ramchain->H.txidind,ramchain->H.unspentind,ramchain->H.spendind,ramchain->pkind,ramchain->externalind,bits256_str(str,ramchain->H.data->firsthash2)); |
|
|
|
iguana_ramchain_setsize(ramchain,ramchain->H.data,1); |
|
|
|
flag = 0; |
|
|
|
if ( ramchain->H.txidind != ramchain->H.data->numtxids || ramchain->H.unspentind != ramchain->H.data->numunspents || ramchain->H.spendind != ramchain->H.data->numspends ) |
|
|
@ -2093,6 +2094,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru |
|
|
|
} |
|
|
|
} else printf("ramchain verification error.%d hdrsi.%d bundlei.%d\n",err,bp->hdrsi,bundlei); |
|
|
|
} |
|
|
|
fprintf(stderr,"finished with hdrsi.%d ht.%d\n",bp->hdrsi,bp->bundleheight); |
|
|
|
ramchain->H.ROflag = 0; |
|
|
|
iguana_ramchain_free(ramchain,0); |
|
|
|
return(fpos); |
|
|
|