Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b191dae88f
  1. 2
      iguana/iguana777.c
  2. 4
      iguana/iguana777.h
  3. 11
      iguana/iguana_ramchain.c
  4. 23
      iguana/iguana_recv.c
  5. 5
      iguana/iguana_scripts.c
  6. 4
      iguana/main.c

2
iguana/iguana777.c

@ -294,7 +294,7 @@ int32_t iguana_helpertask(FILE *fp,struct OS_memspace *mem,struct OS_memspace *m
}
else if ( ptr->type == 'E' )
{
printf("emitQ coin.%p bp.%p\n",ptr->coin,ptr->bp);
//printf("emitQ coin.%p bp.%p\n",ptr->coin,ptr->bp);
if ( iguana_bundlesaveHT(coin,mem,memB,bp,ptr->starttime) == 0 )
{
bp->emitfinish = (uint32_t)time(NULL);

4
iguana/iguana777.h

@ -33,9 +33,9 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_HEIGHT 200
#define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 512 //64
#define _IGUANA_MAXPENDING 8 //64
#define _IGUANA_MAXBUNDLES 8
#define IGUANA_BUNDLELOOP 100
#define IGUANA_BUNDLELOOP 7
#define IGUANA_RPCPORT 7778
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)

11
iguana/iguana_ramchain.c

@ -1929,7 +1929,7 @@ int32_t iguana_scriptspaceraw(struct iguana_info *coin,int32_t *scriptspacep,int
int32_t iguana_ramchain_scriptspace(struct iguana_info *coin,int32_t *sigspacep,int32_t *pubkeyspacep,struct iguana_ramchain *ramchain)
{
RAMCHAIN_DECLARE;
int32_t j,sigspace,pubkeyspace,scriptlen,p2shsize,pubkeysize,sigsize,scriptspace,suffixlen;
int32_t j,p2shspace,sigspace,pubkeyspace,scriptlen,p2shsize,pubkeysize,sigsize,scriptspace,suffixlen;
uint32_t sequence,spendind,unspentind; struct vin_info V; uint8_t _script[IGUANA_MAXSCRIPTSIZE];
struct iguana_txid *tx; struct iguana_ramchaindata *rdata; uint8_t *scriptdata;
_iguana_ramchain_setptrs(RAMCHAIN_PTRS,ramchain->H.data);
@ -1939,7 +1939,7 @@ int32_t iguana_ramchain_scriptspace(struct iguana_info *coin,int32_t *sigspacep,
printf("iguana_ramchain_scriptspace cant iterate without data and requires simple ramchain\n");
return(-1);
}
sigspace = pubkeyspace = scriptspace = 0;
sigspace = pubkeyspace = scriptspace = p2shspace = 0;
for (ramchain->H.txidind=rdata->firsti; ramchain->H.txidind<rdata->numtxids; ramchain->H.txidind++)
{
tx = &T[ramchain->H.txidind];
@ -1958,7 +1958,7 @@ int32_t iguana_ramchain_scriptspace(struct iguana_info *coin,int32_t *sigspacep,
{
iguana_vinscriptparse(coin,&V,&sigsize,&pubkeysize,&p2shsize,&suffixlen,scriptdata,scriptlen);
scriptspace += tx->numvins * 16; // for metascripts
scriptspace += p2shsize;
p2shspace += p2shsize;
if ( sequence != 0 && sequence != 0xffffffff && sequence != 0xfffffffe )
scriptspace += sizeof(sequence);
sigspace += sigsize;
@ -1968,7 +1968,8 @@ int32_t iguana_ramchain_scriptspace(struct iguana_info *coin,int32_t *sigspacep,
}
}
*sigspacep = sigspace, *pubkeyspacep = pubkeyspace;
return(scriptspace);
printf("scriptspace.%d p2shspace.%d sigspace.%d pubkeyspace.%d\n",scriptspace,p2shspace,sigspace,pubkeyspace);
return(scriptspace + p2shspace);
}
long iguana_ramchain_data(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)
@ -2406,7 +2407,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
printf("error mapping hdrsi.%d bundlei.%d\n",bp->hdrsi,bundlei);
return(-1);
}
//printf("iguana_bundlesaveHT -> total (%d %d %d) scriptspace.%d (pubkeys.%d sigs.%d)\n",numtxids,numunspents,numspends,scriptspace,pubkeyspace,sigspace);
printf("iguana_bundlesaveHT -> total (%d %d %d) scriptspace.%d (pubkeys.%d sigs.%d)\n",numtxids,numunspents,numspends,scriptspace,pubkeyspace,sigspace);
numpkinds = numunspents;
numexternaltxids = numspends;
dest = &bp->ramchain;

23
iguana/iguana_recv.c

@ -790,7 +790,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
{
uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(uint32_t)*32 + sizeof(bits256)];
char *hashstr=0; bits256 hash2; uint32_t now; struct iguana_block *block; struct iguana_blockreq *req=0;
struct iguana_bundle *bp; struct iguana_peer *ptr; int32_t priority,i,m,z,pend,limit,height=-1,bundlei,datalen,flag = 0;
struct iguana_bundle *bp; struct iguana_peer *ptr; int32_t hdrsi,bundlei,gap,priority,i,m,z,pend,limit,height=-1,datalen,flag = 0;
if ( addr->msgcounts.verack == 0 )
return(0);
now = (uint32_t)time(NULL);
@ -873,7 +873,26 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
flag++;
myfree(req,sizeof(*req));
}
else if ( (bp= addr->bp) != 0 && bp->rank != 0 && addr->pendblocks < limit )
else if ( addr->rank > 1 )
{
gap = addr->rank * coin->peers.numranked;
for (i=0; i<coin->peers.numranked; i++,gap++)
{
hdrsi = (coin->blocks.hwmchain.height + gap) / coin->chain->bundlesize;
if ( (bp= coin->bundles[hdrsi]) != 0 )
{
bundlei = (coin->blocks.hwmchain.height + gap) % coin->chain->bundlesize;
if ( (block= bp->blocks[bundlei]) != 0 && block->fpipbits == 0 && block->queued == 0 )
{
printf("near hwm gap.%d peer.%s ranked.%d [%d:%d] pending.%d\n",gap,addr->ipaddr,bp->rank,bp->hdrsi,i,addr->pendblocks);
block->numrequests++;
iguana_sendblockreqPT(coin,addr,bp,bundlei,block->RO.hash2,1);
break;
}
}
}
}
if ( (bp= addr->bp) != 0 && bp->rank != 0 && addr->pendblocks < limit )
{
for (i=0; i<bp->n; i++)
if ( (block= bp->blocks[i]) != 0 && block->numrequests == bp->minrequests && block->fpipbits == 0 && block->queued == 0 )

5
iguana/iguana_scripts.c

@ -718,7 +718,7 @@ int32_t bitcoin_scriptget(struct iguana_info *coin,int32_t *hashtypep,int32_t *s
if ( scriptsig[n] == 0x4c )
vp->p2shlen = scriptsig[n+1], n += 2;
else vp->p2shlen = ((uint32_t)scriptsig[n+1] + ((uint32_t)scriptsig[n+2] << 8)), n += 3;
printf("opcode.%02x %02x %02x scriptlen.%d\n",scriptsig[n],scriptsig[n+1],scriptsig[n+2],vp->p2shlen);
printf("p2sh opcode.%02x %02x %02x scriptlen.%d\n",scriptsig[n],scriptsig[n+1],scriptsig[n+2],vp->p2shlen);
if ( vp->p2shlen < IGUANA_MAXSCRIPTSIZE )
{
memcpy(vp->p2shscript,&scriptsig[n],vp->p2shlen);
@ -750,7 +750,10 @@ int32_t iguana_vinscriptparse(struct iguana_info *coin,struct vin_info *vp,int32
return(-1);
}
if ( vp->type == IGUANA_SCRIPT_P2SH )
{
*p2shsizep = vp->p2shlen + 1 + (vp->p2shlen >= 0xfd)*2;
printf("P2SHSIZE.%d\n",*p2shsizep);
}
return(hashtype);
}

4
iguana/main.c

@ -1114,7 +1114,7 @@ void iguana_main(void *arg)
iguana_launch(iguana_coinadd("BTCD",0),"iguana_coins",iguana_coins,coinargs,IGUANA_PERMTHREAD);
else if ( 1 )
{
#ifdef __APPLE__
//#ifdef __APPLE__
sleep(1);
char *str;
//iguana_launchcoin(MYINFO.rpcsymbol,cJSON_Parse("{}"));
@ -1136,7 +1136,7 @@ void iguana_main(void *arg)
//iguana_coinfind("BTC")->active = iguana_coinfind("BTCD")->active = 0;
}
sleep(1);
#endif
//#endif
}
if ( arg != 0 )
SuperNET_JSON(&MYINFO,cJSON_Parse(arg),0);

Loading…
Cancel
Save