From 6e0b54cfa4951f6d1a8bd9ef3f0dfa6d2096e970 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 7 Mar 2016 22:45:25 -0300 Subject: [PATCH] test --- iguana/iguana_ramchain.c | 22 ++++++++++++---------- iguana/main.c | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index f79d1bb93..d07e4ada3 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -501,7 +501,7 @@ uint8_t *iguana_ramchain_scriptdecode(struct iguana_info *coin,int32_t *metalenp uint32_t iguana_ramchain_pubkeyoffset(struct iguana_info *coin,RAMCHAIN_FUNC,int32_t createflag,uint32_t *pkindp,uint32_t *scriptoffsetp,uint8_t *pubkey,uint8_t rmd160[20]) { - uint32_t pkind,plen; struct iguana_kvitem *ptr; + uint32_t pkind; int32_t plen; struct iguana_kvitem *ptr; if ( (ptr= iguana_hashfind(ramchain,'P',rmd160)) == 0 ) { if ( createflag != 0 ) @@ -519,13 +519,13 @@ uint32_t iguana_ramchain_pubkeyoffset(struct iguana_info *coin,RAMCHAIN_FUNC,int if ( (plen= bitcoin_pubkeylen(pubkey)) > 0 ) { P[pkind].pubkeyoffset = *scriptoffsetp, *scriptoffsetp += plen; - int32_t i; for (i=0; i new offset.%d\n",plen,*scriptoffsetp); + // printf(" plen.%d -> new offset.%d\n",plen,*scriptoffsetp); memcpy(&Kspace[P[pkind].pubkeyoffset],pubkey,plen); } else { + int32_t i; for (i=0; iprevunspentind = A[pkind].lastunspentind; //for (i=0; i<20; i++) // printf("%02x",rmd160[i]); - printf(" U%d scriptoffset.%d pubkeyoffset.%d/%d type.%d pkind.%d\n",unspentind,ramchain->H.scriptoffset,pubkeyoffset,ramchain->H.data->scriptspace,type,pkind); + //printf(" U%d scriptoffset.%d pubkeyoffset.%d/%d type.%d pkind.%d\n",unspentind,ramchain->H.scriptoffset,pubkeyoffset,ramchain->H.data->scriptspace,type,pkind); if ( scriptlen > 0 && script != 0 ) { //for (i=0; iH.spendind++; s = &Sx[spendind]; pkind = unspentind = 0; - if ( (ptr= iguana_hashfind(ramchain,'T',prev_hash.bytes)) == 0 ) + if ( prev_vout >= 0 && (ptr= iguana_hashfind(ramchain,'T',prev_hash.bytes)) == 0 ) { external = 1; txidind = ramchain->externalind++; @@ -811,8 +811,10 @@ uint32_t iguana_ramchain_addspend(struct iguana_info *coin,RAMCHAIN_FUNC,bits256 return(0); } txidind |= (1 << 31); - } else txidind = ptr->hh.itemind; - if ( (external= ((txidind >> 31) & 1)) == 0 ) + } + else if ( ptr != 0 ) + txidind = ptr->hh.itemind; + if ( prev_vout >= 0 && (external= ((txidind >> 31) & 1)) == 0 ) { if ( txidind > 0 && txidind < ramchain->H.data->numtxids ) { diff --git a/iguana/main.c b/iguana/main.c index 19838fc9b..619c8032d 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1118,7 +1118,7 @@ void iguana_main(void *arg) sleep(1); char *str; //iguana_launchcoin(MYINFO.rpcsymbol,cJSON_Parse("{}")); - if ( 1 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":4,\"newcoin\":\"BTC\",\"active\":1}"),0)) != 0 ) + if ( 1 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":1}"),0)) != 0 ) { free(str); if ( 0 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1}"),0)) != 0 )