From 539c5b063ea537aef9fcb0106629c6f8fbb0f65a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 7 Jul 2016 08:24:54 -0300 Subject: [PATCH] test --- basilisk/basilisk_swap.c | 4 +-- deprecated/obsolete.h | 53 ++++++++++++++++++++++++++++++++++- iguana/iguana777.c | 56 ++----------------------------------- iguana/iguana_interpreter.c | 4 +-- iguana/iguana_sign.c | 8 ++++-- iguana/iguana_unspents.c | 2 +- iguana/iguana_volatiles.c | 2 +- 7 files changed, 66 insertions(+), 63 deletions(-) diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 7b3f93474..d8d3e204c 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -128,9 +128,9 @@ int32_t basilisk_rawtx_spend(struct supernet_info *myinfo,struct basilisk_swap * bitcoin_priv2wif(wifstr,*privkey2,rawtx->coin->chain->wiftype); jaddistr(privkeys,wifstr); } + V.suppress_pubkeys = dest->suppress_pubkeys; if ( userdata != 0 && userdatalen > 0 ) { - V.suppress_pubkeys = rawtx->suppress_pubkeys; memcpy(V.userdata,userdata,userdatalen); V.userdatalen = userdatalen; } @@ -150,7 +150,7 @@ int32_t basilisk_rawtx_spend(struct supernet_info *myinfo,struct basilisk_swap * jaddi(vins,item); jdelete(txobj,"vin"); jadd(txobj,"vin",vins); - printf("basilisk_rawtx_spend locktime.%u/%u for %s spendscript.%s -> %s\n",rawtx->locktime,dest->locktime,rawtx->name,hexstr,dest->name); + printf("basilisk_rawtx_spend locktime.%u/%u for %s spendscript.%s -> %s, suppress.%d\n",rawtx->locktime,dest->locktime,rawtx->name,hexstr,dest->name,dest->suppress_pubkeys); txobj = bitcoin_txoutput(txobj,dest->spendscript,dest->spendlen,dest->amount); if ( (rawtxbytes= bitcoin_json2hex(myinfo,rawtx->coin,&dest->txid,txobj,&V)) != 0 ) { diff --git a/deprecated/obsolete.h b/deprecated/obsolete.h index 46e3034fd..e0d721098 100755 --- a/deprecated/obsolete.h +++ b/deprecated/obsolete.h @@ -18451,6 +18451,57 @@ len = 0; dependents->cost = cost; return(0.); }*/ - + /*n = queue_size(&validateQ) / IGUANA_NUMHELPERS + 1; + printf("vQ is n.%d\n",n); + for (iter=0; iterbp) != 0 && (coin= ptr->coin) != 0 && coin->active != 0 ) + { + printf("helper.%d validate.[%d] %d vs %d\n",helperid,bp->hdrsi,coin->blocks.hwmchain.height/coin->chain->bundlesize,(coin->longestchain-1)/coin->chain->bundlesize); + if ( coin->blocks.hwmchain.height/coin->chain->bundlesize >= (coin->longestchain-1)/coin->chain->bundlesize ) + flag += iguana_bundlevalidate(coin,bp,0); + else + { + usleep(10000); + printf("requeue vQ.[%d]\n",bp->hdrsi); + iguana_validateQ(coin,bp); + } + } + else if ( coin->active != 0 ) + printf("helper validate missing param? %p %p\n",ptr->coin,ptr->bp); + myfree(ptr,ptr->allocsize); + flag++; + }*/ + + /*int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin) + { + struct exchange_info *exchange; int32_t i,n=0; struct iguana_peer *addr; char myipaddr[64]; + expand_ipbits(myipaddr,myinfo->myaddr.myipbits); + //printf("iguana_inv2poll exchange.%p %s maxpeers.%d\n",exchanges777_find("bitcoin"),coin->symbol,coin->MAXPEERS); + if ( coin != 0 && coin->peers != 0 && (exchange= exchanges777_find("bitcoin")) != 0 && strcmp(coin->symbol,"BTCD") == 0 ) + { + if ( time(NULL) > coin->lastinv2+10 ) + { + coin->lastinv2 = (uint32_t)time(NULL); + for (i=n=0; iMAXPEERS; i++) + { + addr = &coin->peers->active[i]; + if ( addr->supernet != 0 ) + { + //printf("iguana_inv2poll (%s) usock.%d dead.%u ready.%u ipbits.%u supernet.%d\n",addr->ipaddr,addr->usock,addr->dead,addr->ready,(uint32_t)addr->ipbits,addr->supernet); + if ( addr->usock >= 0 && addr->dead == 0 && addr->ready != 0 && addr->ipbits != 0 && strcmp(addr->ipaddr,myipaddr) != 0 ) + { + instantdex_inv2data(myinfo,coin,addr,exchange); + n++; + } + } + } + } + } + return(n); + }*/ #endif #endif diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 2d0781392..def6703b1 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -133,34 +133,6 @@ double iguana_metric(struct iguana_peer *addr,uint32_t now,double decay) return(metric); } -/*int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin) -{ - struct exchange_info *exchange; int32_t i,n=0; struct iguana_peer *addr; char myipaddr[64]; - expand_ipbits(myipaddr,myinfo->myaddr.myipbits); - //printf("iguana_inv2poll exchange.%p %s maxpeers.%d\n",exchanges777_find("bitcoin"),coin->symbol,coin->MAXPEERS); - if ( coin != 0 && coin->peers != 0 && (exchange= exchanges777_find("bitcoin")) != 0 && strcmp(coin->symbol,"BTCD") == 0 ) - { - if ( time(NULL) > coin->lastinv2+10 ) - { - coin->lastinv2 = (uint32_t)time(NULL); - for (i=n=0; iMAXPEERS; i++) - { - addr = &coin->peers->active[i]; - if ( addr->supernet != 0 ) - { - //printf("iguana_inv2poll (%s) usock.%d dead.%u ready.%u ipbits.%u supernet.%d\n",addr->ipaddr,addr->usock,addr->dead,addr->ready,(uint32_t)addr->ipbits,addr->supernet); - if ( addr->usock >= 0 && addr->dead == 0 && addr->ready != 0 && addr->ipbits != 0 && strcmp(addr->ipaddr,myipaddr) != 0 ) - { - instantdex_inv2data(myinfo,coin,addr,exchange); - n++; - } - } - } - } - } - return(n); -}*/ - int32_t iguana_peermetrics(struct supernet_info *myinfo,struct iguana_info *coin) { int32_t i,ind,n; double *sortbuf,sum; uint32_t now; struct iguana_peer *addr,*slowest = 0; @@ -632,30 +604,6 @@ void iguana_helper(void *arg) myfree(ptr,ptr->allocsize); } else break; } - /*n = queue_size(&validateQ) / IGUANA_NUMHELPERS + 1; - printf("vQ is n.%d\n",n); - for (iter=0; iterbp) != 0 && (coin= ptr->coin) != 0 && coin->active != 0 ) - { - printf("helper.%d validate.[%d] %d vs %d\n",helperid,bp->hdrsi,coin->blocks.hwmchain.height/coin->chain->bundlesize,(coin->longestchain-1)/coin->chain->bundlesize); - if ( coin->blocks.hwmchain.height/coin->chain->bundlesize >= (coin->longestchain-1)/coin->chain->bundlesize ) - flag += iguana_bundlevalidate(coin,bp,0); - else - { - usleep(10000); - printf("requeue vQ.[%d]\n",bp->hdrsi); - iguana_validateQ(coin,bp); - } - } - else if ( coin->active != 0 ) - printf("helper validate missing param? %p %p\n",ptr->coin,ptr->bp); - myfree(ptr,ptr->allocsize); - flag++; - }*/ if ( queue_size(&bundlesQ) > 1 ) allcurrent = 0; if ( flag != 0 ) @@ -758,7 +706,7 @@ void iguana_coinloop(void *arg) } if ( coin->bindsock >= 0 ) { - if ( coin->MAXPEERS > 1 && coin->peers->numranked < IGUANA_MAXPEERS/2 && now > coin->lastpossible ) + if ( coin->MAXPEERS > 1 && coin->peers->numranked < IGUANA_MAXPEERS/2 && now > coin->lastpossible+3 ) { //fprintf(stderr,"check possible\n"); if ( coin->peers->numranked > 0 && (now % 60) == 0 ) @@ -768,7 +716,7 @@ void iguana_coinloop(void *arg) } else { - if ( coin->MAXPEERS > 1 && coin->peers->numranked < ((7*coin->MAXPEERS)>>3) && now > coin->lastpossible ) + if ( coin->MAXPEERS > 1 && coin->peers->numranked < ((7*coin->MAXPEERS)>>3) && now > coin->lastpossible+10 ) { if ( coin->peers->numranked > 0 && (now % 60) == 0 ) iguana_send_ping(myinfo,coin,coin->peers->ranked[rand() % coin->peers->numranked]); diff --git a/iguana/iguana_interpreter.c b/iguana/iguana_interpreter.c index 2ed1b6cc4..5f09dc0fb 100755 --- a/iguana/iguana_interpreter.c +++ b/iguana/iguana_interpreter.c @@ -729,12 +729,12 @@ int32_t iguana_checksig(struct iguana_info *coin,struct iguana_stackdata pubkeya uint8_t pubkey[MAX_SCRIPT_ELEMENT_SIZE],sig[MAX_SCRIPT_ELEMENT_SIZE]; int32_t plen,siglen; plen = iguana_databuf(pubkey,pubkeyarg); siglen = iguana_databuf(sig,sigarg); - /*int32_t i; for (i=0; i 0 && siglen > 0 && siglen < 74 ) return(bitcoin_verify(coin->ctx,sig,siglen-1,sigtxid,pubkey,plen) == 0); return(0); diff --git a/iguana/iguana_sign.c b/iguana/iguana_sign.c index 146cd108e..2f9617def 100755 --- a/iguana/iguana_sign.c +++ b/iguana/iguana_sign.c @@ -328,6 +328,7 @@ bits256 bitcoin_sigtxid(struct iguana_info *coin,uint8_t *serialized,int32_t max revsigtxid = bits256_doublesha256(0,serialized,len); for (i=0; ivins[i].spendlen = vp->spendlen; vp->hashtype = iguana_vinscriptparse(coin,V,&sigsize,&pubkeysize,&p2shsize,&suffixlen,vp->spendscript,vp->spendlen); vp->suffixlen = suffixlen; - //printf("V %.8f (%s) spendscript.[%d]\n",dstr(vp->amount),vp->coinaddr,vp->spendlen); + printf("V %.8f (%s) spendscript.[%d]\n",dstr(vp->amount),vp->coinaddr,vp->spendlen); } } else @@ -756,6 +757,9 @@ int32_t iguana_vininfo_create(struct supernet_info *myinfo,struct iguana_info *c if ( (plen= bitcoin_pubkeylen(vp->signers[0].pubkey)) > 0 ) bitcoin_address(vp->coinaddr,coin->chain->pubtype,vp->signers[0].pubkey,plen); } + int32_t j; for (j=0; jspendlen; j++) + printf("%02x",vp->spendscript[j]); + printf(" <- spendscript vin.%d\n",i); if ( vp->coinaddr[i] != 0 && (waddr= iguana_waddresssearch(myinfo,&wacct,vp->coinaddr)) != 0 ) { vp->signers[0].privkey = waddr->privkey; diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 5e4c2b0d6..643a68717 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -184,7 +184,7 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r } else if ( pkind != 0 ) printf("[%d] not found pkind.%d vs num.%d RT.%d rdata.%p\n",i,pkind,rdata->numpkinds,bp->isRT,rdata); - } else printf("%s.[%d] error null rdata isRT.%d\n",coin->symbol,i,bp->isRT); + } else printf("%s.[%d] skip null rdata isRT.%d\n",coin->symbol,i,bp->isRT); } } return(0); diff --git a/iguana/iguana_volatiles.c b/iguana/iguana_volatiles.c index 9bd5c70fa..ffe8810a9 100755 --- a/iguana/iguana_volatiles.c +++ b/iguana/iguana_volatiles.c @@ -221,7 +221,7 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc coin->spendvectorsaved = 0; coin->started = 0; coin->active = 0; - } else printf("volatileupdate error null rdata [%d]\n",spentchain->height/coin->current->bundleheight); + } else printf("volatileupdate skip null rdata [%d]\n",spentchain->height/coin->current->bundleheight); return(-1); }