Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
d7658ed351
  1. 2
      iguana/iguana777.h
  2. 10
      iguana/iguana_ramchain.c
  3. 12
      iguana/iguana_recv.c

2
iguana/iguana777.h

@ -471,7 +471,7 @@ struct iguana_info
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle; int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle;
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime; uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime;
double backstopmillis; bits256 backstophash2; 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; void *launched,*started;
uint64_t bloomsearches,bloomhits,bloomfalse,collisions; uint8_t blockspace[IGUANA_MAXPACKETSIZE + 8192]; struct OS_memspace blockMEM; 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; struct iguana_blocks blocks; bits256 APIblockhash,APItxid; char *APIblockstr;

10
iguana/iguana_ramchain.c

@ -865,9 +865,9 @@ uint32_t iguana_ramchain_addspend(struct iguana_info *coin,RAMCHAIN_FUNC,bits256
else 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)); // 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; i<vinscriptlen; i++) for (i=0; i<vinscriptlen; i++)
// printf("%02x",vinscript[i]); printf("%02x",vinscript[i]);
//printf(" SAVE vinscript\n"); printf(" SAVE vinscript\n");
if ( sequence == 0xffffffff ) if ( sequence == 0xffffffff )
s->sequenceid = 1; s->sequenceid = 1;
else if ( sequence == 0xfffffffe ) else if ( sequence == 0xfffffffe )
@ -1855,11 +1855,11 @@ int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain
scriptlen = 0; scriptlen = 0;
if ( ramchain->expanded != 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]); scriptlen = iguana_vinscriptdecode(coin,&metalen,&sequenceid,_script,&Kspace[ramchain->H.data->scriptspace],Kspace,&Sx[ramchain->H.spendind]);
scriptdata = _script; scriptdata = _script;
prevout = iguana_ramchain_txid(coin,RAMCHAIN_ARG,&prevhash,&Sx[ramchain->H.spendind]); 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 ) if ( iguana_ramchain_addspend(coin,RAMCHAIN_ARG,prevhash,prevout,sequenceid,bp->hdrsi,scriptdata,scriptlen) == 0 )
{ {
char str[65]; char str[65];

12
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) 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; 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)); 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 ) if ( bp->bundleheight > 0 )
prev = iguana_blockfind(coin,iguana_blockhash(coin,bp->bundleheight-1)); 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; i<coin->chain->bundlesize&&i<bp->n; i++) for (i=n=0; i<coin->chain->bundlesize&&i<bp->n; i++)
{ {
if ( (err= iguana_bundlehash2add(coin,&block,bp,i,blockhashes[i])) < 0 ) 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); return(err);
}
if ( block != 0 && block == bp->blocks[i] ) if ( block != 0 && block == bp->blocks[i] )
{ {
block->height = bp->bundleheight + 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; prev->hh.next = block;
block->hh.prev = prev; block->hh.prev = prev;
} }
} } else printf("no allhashes block.%p or mismatch.%p\n",block,bp->blocks[i]);
prev = block; 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)); iguana_bundleQ(coin,bp,bp->n*5 + (rand() % 500));
return(bp->queued); return(bp->queued);
} }

Loading…
Cancel
Save