From 66de8404f796cd31f672a5503943539ec25946be Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 15:40:41 -0300 Subject: [PATCH 01/27] test --- iguana/iguana_realtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_realtime.c b/iguana/iguana_realtime.c index 7cf94d154..2527cced3 100755 --- a/iguana/iguana_realtime.c +++ b/iguana/iguana_realtime.c @@ -781,7 +781,7 @@ void iguana_RTnewblock(struct supernet_info *myinfo,struct iguana_info *coin,str } if ( block != 0 && coin->RTheight > 0 && coin->utxoaddrtable != 0 )//&& coin->RTheight <= coin->blocks.hwmchain.height ) { - if ( block->height <= (coin->RTheight - coin->minconfirms + 1) ) + if ( block->height < (coin->RTheight - coin->minconfirms + 1) ) return; if ( (block= iguana_blockfind("RTnew",coin,iguana_blockhash(coin,block->height-coin->minconfirms))) == 0 ) return; From 8a02dcab0fbfacb967d263afa83b0d6b3cdd9daa Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 15:54:01 -0300 Subject: [PATCH 02/27] test --- iguana/iguana777.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index dbbab44bf..89ebe2b39 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -627,7 +627,7 @@ int32_t iguana_coin_mainiter(struct supernet_info *myinfo,struct iguana_info *co iguana_alloctxbits(coin,&coin->bundles[j]->ramchain); sleep(3); }*/ - if ( (iguana_utxofinished(coin) < n || iguana_balancefinished(coin) < n || iguana_validated(coin) < n) ) + if ( iguana_utxofinished(coin) < n )//|| iguana_balancefinished(coin) < n || iguana_validated(coin) < n) ) { //printf("About to generate tables\n"), getchar(); iguana_fastfindreset(coin); From 3fa4d02a6cf6619e2e4a3b9366f923618a722c59 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 16:19:18 -0300 Subject: [PATCH 03/27] test --- iguana/iguana_unspents.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 2d1d57262..fb8d619ba 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -991,14 +991,16 @@ int32_t iguana_unspentfindjson(cJSON *destarray,cJSON *item) cJSON *iguana_RTlistunspent(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *argarray,int32_t minconf,int32_t maxconf,char *remoteaddr,int32_t includespends) { - int32_t i,j,m,n,numrmds,numunspents=0; char *coinaddr,*retstr; uint8_t *rmdarray; cJSON *vals,*unspents,*item,*array,*retjson,*retarray; bits256 hash; + uint64_t total = 0; int32_t i,j,m,n,numrmds,numunspents=0; char *coinaddr,*retstr; uint8_t *rmdarray; cJSON *vals,*unspents,*item,*array,*retjson,*retarray; bits256 hash; if ( coin->FULLNODE != 0 || coin->VALIDATENODE != 0 ) { retjson = cJSON_CreateArray(); rmdarray = iguana_rmdarray(myinfo,coin,&numrmds,argarray,0); - iguana_RTunspents(myinfo,coin,retjson,minconf,maxconf,rmdarray,numrmds,(1 << 30),0,&numunspents,remoteaddr,includespends); + total = iguana_RTunspents(myinfo,coin,retjson,minconf,maxconf,rmdarray,numrmds,(1 << 30),0,&numunspents,remoteaddr,includespends); if ( rmdarray != 0 ) free(rmdarray); + jaddnum(retjson,"total",dstr(total)); + jaddnum(retjson,"balance",dstr(total)); } else { From 1ef54ef7c8281750a78a322739d0b7fd8ab16e0b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 16:22:10 -0300 Subject: [PATCH 04/27] test --- iguana/iguana_spendvectors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index c99bb2b44..e442bac6a 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -634,7 +634,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co from_ro = 0; } } - if ( coin->longestchain <= coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) + if ( coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) { iguana_bundlestats(myinfo,coin,buf,IGUANA_DEFAULTLAG); return(coin->bundlescount); From 2e8ce206c6b58ed3f97fb793916101bbbee8a462 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 16:25:15 -0300 Subject: [PATCH 05/27] test --- iguana/iguana_spendvectors.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index e442bac6a..ab279527e 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -636,6 +636,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co } if ( coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) { + printf("SKIP checking volatile files %d > %d\n",coin->longestchain,coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms); iguana_bundlestats(myinfo,coin,buf,IGUANA_DEFAULTLAG); return(coin->bundlescount); } From 071730cf865fd811f5f6be92750ed52e681a884e Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 16:33:05 -0300 Subject: [PATCH 06/27] test --- iguana/iguana_spendvectors.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index ab279527e..2f8455b83 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -618,7 +618,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co struct sha256_vstate vstate,bstate; int32_t i,from_ro,numpkinds,numunspents; struct iguana_bundle *bp; struct iguana_block *block; uint32_t crc,filecrc; FILE *fp; char crcfname[512],str[65],str2[65],buf[2048]; from_ro = 1; - for (i=0; ibundlescount; i++)//balanceswritten; i++) + for (i=0; ibundlescount; i++) { if ( (bp= coin->bundles[i]) == 0 ) continue; @@ -634,6 +634,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co from_ro = 0; } } + printf("i.%d volatilesinit\n",i); if ( coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) { printf("SKIP checking volatile files %d > %d\n",coin->longestchain,coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms); @@ -790,7 +791,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits } } printf("%s i.%d bundlescount.%d\n",coin->symbol,i,coin->bundlescount); - if ( coin->balanceswritten > 1 ) + //if ( coin->balanceswritten > 1 ) coin->balanceswritten = iguana_volatilesinit(myinfo,coin); /*if ( coin->balanceswritten > 1 ) { @@ -804,7 +805,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits } }*/ printf("%s i.%d balanceswritten.%d\n",coin->symbol,i,coin->balanceswritten); - if ( coin->balanceswritten < coin->bundlescount ) + /*if ( coin->balanceswritten < coin->bundlescount ) { for (i=0*coin->balanceswritten; ibundlescount; i++) { @@ -817,7 +818,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits printf("iguana_bundlesQ %d to %d\n",coin->balanceswritten,coin->bundlescount); } if ( (coin->origbalanceswritten= coin->balanceswritten) > 0 ) - iguana_volatilesinit(myinfo,coin); + iguana_volatilesinit(myinfo,coin);*/ iguana_savehdrs(coin); iguana_fastlink(coin,coin->balanceswritten * coin->chain->bundlesize - 1); iguana_walkchain(coin,0); From 5fca4cc009cb162cae29824c186daa77a7d7876f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 17:05:04 -0300 Subject: [PATCH 07/27] test --- basilisk/basilisk_DEX.c | 15 ++++++++++++--- iguana/iguana_unspents.c | 2 -- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 5bdfbc126..6570f1bc9 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -413,7 +413,7 @@ ZERO_ARGS(InstantDEX,allcoins) STRING_ARG(InstantDEX,available,source) { - char *retstr; cJSON *vals,*balancejson,*retjson = 0; + char *retstr; uint64_t total = 0; int32_t i,n; cJSON *item,*vals,*unspents,*balancejson,*retjson = 0; if ( source != 0 && source[0] != 0 && (coin= iguana_coinfind(source)) != 0 ) { if ( myinfo->expiration != 0 ) @@ -423,11 +423,20 @@ STRING_ARG(InstantDEX,available,source) { if ( (retstr= basilisk_balances(myinfo,coin,0,0,GENESIS_PUBKEY,vals,"")) != 0 ) { - printf("available.(%s)\n",retstr); + //printf("available.(%s)\n",retstr); if ( (balancejson= cJSON_Parse(retstr)) != 0 ) { + if ( (unspents= jarray(&n,balancejson,"unspents")) != 0 ) + { + for (i=0; i Date: Tue, 20 Sep 2016 18:11:41 -0300 Subject: [PATCH 08/27] test --- basilisk/basilisk.c | 13 ++++++++----- basilisk/basilisk_DEX.c | 2 +- basilisk/basilisk_MSG.c | 2 +- basilisk/basilisk_tradebot.c | 2 +- iguana/iguana_json.c | 2 ++ iguana/iguana_unspents.c | 7 +++++-- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index b123cbeeb..f97e9e20d 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -206,15 +206,18 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ return(-1); } if ( basilisk_notarycmd(type) != 0 && myinfo->NOTARY.NUMRELAYS == 0 ) + { + printf("no notary nodes to send (%s) to\n",type); return(-1); + } //portable_mutex_lock(&myinfo->allcoins_mutex); alreadysent = calloc(IGUANA_MAXPEERS * IGUANA_MAXCOINS,sizeof(*alreadysent)); HASH_ITER(hh,myinfo->allcoins,coin,tmp) { if ( coin->peers == 0 ) continue; - //if ( basilisk_notarycmd(type) != 0 && strcmp(coin->symbol,"NOTARY") != 0 ) - // continue; + if ( basilisk_notarycmd(type) != 0 && strcmp(coin->symbol,"NOTARY") != 0 ) + continue; if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 ) cmd[0] = 's'; else cmd[0] = 'S'; @@ -230,7 +233,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ { s = 0; valid = (addr->supernet != 0); - if ( basilisk_notarycmd(type) != 0 ) + if ( basilisk_notarycmd(type) != 0 || (strcmp(type,"INF") == 0 && strcmp(coin->symbol,"NOTARY") == 0) ) { valid = 0; /*OS_randombytes((void *)&r2,sizeof(r2)); @@ -258,7 +261,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ } if ( s == n && valid == 1 && (destipaddr == 0 || strcmp(addr->ipaddr,destipaddr) == 0) ) { - //fprintf(stderr,"(%s).%u ",addr->ipaddr,coin->chain->portp2p); + fprintf(stderr,">>> (%s).%u ",addr->ipaddr,coin->chain->portp2p); //printf("n.%d/fanout.%d i.%d l.%d [%s].tag%u send %s.(%s) [%x] datalen.%d addr->supernet.%u basilisk.%u to (%s).%d destip.%s\n",n,fanout,i,l,cmd,*(uint32_t *)data,type,(char *)&data[4],*(int32_t *)&data[datalen-4],datalen,addr->supernet,addr->basilisk,addr->ipaddr,addr->A.port,destipaddr!=0?destipaddr:"broadcast"); if ( encryptflag != 0 && bits256_nonz(addr->pubkey) != 0 ) { @@ -805,7 +808,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo) memset(&issueR,0,sizeof(issueR)); if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 ) { - //printf("poll.(%s)\n",retstr); + printf("poll.(%s)\n",retstr); if ( (retjson= cJSON_Parse(retstr)) != 0 ) { if ( (outerarray= jarray(&n,retjson,"responses")) != 0 ) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 6570f1bc9..1f4bf2b75 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -456,7 +456,7 @@ STRING_ARG(InstantDEX,available,source) HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr) { uint8_t serialized[512]; struct basilisk_request R; cJSON *reqjson; uint32_t datalen=0,DEX_channel; - myinfo->DEXactive = (uint32_t)time(NULL) + BASILISK_TIMEOUT; + myinfo->DEXactive = (uint32_t)time(NULL) + 3*BASILISK_TIMEOUT; jadd64bits(vals,"minamount",jdouble(vals,"minprice") * jdouble(vals,"amount") * SATOSHIDEN); if ( jobj(vals,"srchash") == 0 ) jaddbits256(vals,"srchash",myinfo->myaddr.pubkey); diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index 2206bc4da..d634715b2 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -261,7 +261,7 @@ int32_t basilisk_channelsend(struct supernet_info *myinfo,bits256 hash,uint32_t jaddnum(valsobj,"msgid",msgid); jaddnum(valsobj,"duration",duration); jaddbits256(valsobj,"sender",myinfo->myaddr.persistent); - //char str[65]; printf("sendmessage.[%d] channel.%u msgid.%x -> %s numrelays.%d:%d\n",datalen,channel,msgid,bits256_str(str,hash),myinfo->NOTARY.NUMRELAYS,juint(valsobj,"fanout")); + char str[65]; printf("sendmessage.[%d] channel.%u msgid.%x -> %s numrelays.%d:%d\n",datalen,channel,msgid,bits256_str(str,hash),myinfo->NOTARY.NUMRELAYS,juint(valsobj,"fanout")); if ( (retstr= basilisk_sendmessage(myinfo,0,0,0,hash,valsobj,hexstr)) != 0 ) free(retstr); free_json(valsobj); diff --git a/basilisk/basilisk_tradebot.c b/basilisk/basilisk_tradebot.c index ae3dfa0dd..0885f4498 100755 --- a/basilisk/basilisk_tradebot.c +++ b/basilisk/basilisk_tradebot.c @@ -249,7 +249,7 @@ double basilisk_process_results(struct supernet_info *myinfo,struct basilisk_req if ( (hexdata= get_dataptr(0,&allocptr,&hexlen,hexspace,sizeof(hexspace),hexstr)) != 0 ) { basilisk_rwDEXquote(0,hexdata,&R); - //printf("[%d].(%s)\n",i,jprint(basilisk_requestjson(&R),1)); + printf("[%d].(%s)\n",i,jprint(basilisk_requestjson(&R),1)); } } else basilisk_parsejson(&R,item); if ( nonz != 0 ) diff --git a/iguana/iguana_json.c b/iguana/iguana_json.c index 69e1e4647..084142d4f 100755 --- a/iguana/iguana_json.c +++ b/iguana/iguana_json.c @@ -651,6 +651,8 @@ TWO_STRINGS(iguana,addnode,activecoin,ipaddr) struct iguana_peer *addr; int32_t i,n; if ( coin == 0 ) coin = iguana_coinfind(activecoin); + if ( strcmp(coin->symbol,"NOTARY") == 0 ) + basilisk_addrelay_info(myinfo,0,(uint32_t)calc_ipbits(ipaddr),GENESIS_PUBKEY); printf("coin.%p.[%s] addnode.%s -> %s\n",coin,coin!=0?coin->symbol:"",activecoin,ipaddr); if ( coin != 0 && coin->peers != 0 && ipaddr != 0 && is_ipaddr(ipaddr) != 0 ) { diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 684f0bd22..b6325ea51 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -366,8 +366,11 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r return(p); } 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 if ( coin->spendvectorsaved > 1 && bp != coin->current && bp->bundleheight < coin->firstRTheight ) - printf("%s.[%d] skip null rdata isRT.%d [%d]\n",coin->symbol,i,bp->isRT,coin->current!=0?coin->current->hdrsi:-1); + } + else if ( coin->spendvectorsaved > 1 && bp != coin->current && bp->bundleheight < coin->firstRTheight ) + { + //printf("%s.[%d] skip null rdata isRT.%d [%d]\n",coin->symbol,i,bp->isRT,coin->current!=0?coin->current->hdrsi:-1); + } } } return(0); From 9041c7a85f65d3291fcbb7a6609f88fd634ee4fe Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 18:24:24 -0300 Subject: [PATCH 09/27] test --- basilisk/basilisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index f97e9e20d..ebce1583c 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -261,7 +261,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ } if ( s == n && valid == 1 && (destipaddr == 0 || strcmp(addr->ipaddr,destipaddr) == 0) ) { - fprintf(stderr,">>> (%s).%u ",addr->ipaddr,coin->chain->portp2p); + //fprintf(stderr,">>> (%s).%u ",addr->ipaddr,coin->chain->portp2p); //printf("n.%d/fanout.%d i.%d l.%d [%s].tag%u send %s.(%s) [%x] datalen.%d addr->supernet.%u basilisk.%u to (%s).%d destip.%s\n",n,fanout,i,l,cmd,*(uint32_t *)data,type,(char *)&data[4],*(int32_t *)&data[datalen-4],datalen,addr->supernet,addr->basilisk,addr->ipaddr,addr->A.port,destipaddr!=0?destipaddr:"broadcast"); if ( encryptflag != 0 && bits256_nonz(addr->pubkey) != 0 ) { @@ -808,7 +808,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo) memset(&issueR,0,sizeof(issueR)); if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 ) { - printf("poll.(%s)\n",retstr); + //printf("poll.(%s)\n",retstr); if ( (retjson= cJSON_Parse(retstr)) != 0 ) { if ( (outerarray= jarray(&n,retjson,"responses")) != 0 ) From 12bc18615635160c12dbefc466df19e152aff9d7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 18:29:32 -0300 Subject: [PATCH 10/27] test --- basilisk/basilisk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index ebce1583c..915014299 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -804,7 +804,7 @@ void basilisk_p2p(void *_myinfo,void *_addr,char *senderip,uint8_t *data,int32_t void basilisk_requests_poll(struct supernet_info *myinfo) { - char *retstr; cJSON *outerarray,*retjson; int32_t i,n; struct basilisk_request issueR; double hwm = 0.; + char *retstr; uint8_t data[8192]; cJSON *outerarray,*retjson; int32_t datalen,i,n; struct basilisk_request issueR; double hwm = 0.; memset(&issueR,0,sizeof(issueR)); if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 ) { @@ -832,9 +832,11 @@ void basilisk_requests_poll(struct supernet_info *myinfo) } else //if ( issueR.quoteid == 0 ) { - printf("other req hwm %f\n",hwm); + printf("other req hwm %f >>>>>>>>>>> send response\n",hwm); issueR.quoteid = basilisk_quoteid(&issueR); issueR.desthash = myinfo->myaddr.persistent; + datalen = basilisk_rwDEXquote(1,data,&issueR); + basilisk_channelsend(myinfo,issueR.desthash,'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16),(uint32_t)time(NULL),data,datalen,0); if ( (retstr= basilisk_start(myinfo,&issueR,0)) != 0 ) free(retstr); } //else printf("basilisk_requests_poll unexpected hwm issueR\n"); From a9a4076e00c550fcb2574a0a374f721ae58c33f7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 18:45:50 -0300 Subject: [PATCH 11/27] test --- basilisk/basilisk_DEX.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 1f4bf2b75..17938e95d 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -432,11 +432,14 @@ STRING_ARG(InstantDEX,available,source) { item = jitem(unspents,i); if ( jobj(item,"unspent") != 0 ) + { total += jdouble(item,"amount") * SATOSHIDEN; + printf("(%s) -> %.8f\n",jprint(item,0),dstr(total)); + } } } retjson = cJSON_CreateObject(); - jaddnum(retjson,"result",total); + jaddnum(retjson,"result",dstr(total)); free_json(balancejson); } free(retstr); From 8a14f60c7b2d3c9edf875ab53c30ae48cddd059f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 18:49:19 -0300 Subject: [PATCH 12/27] test --- basilisk/basilisk_DEX.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 17938e95d..8e89e4ce2 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -423,7 +423,7 @@ STRING_ARG(InstantDEX,available,source) { if ( (retstr= basilisk_balances(myinfo,coin,0,0,GENESIS_PUBKEY,vals,"")) != 0 ) { - //printf("available.(%s)\n",retstr); + printf("available.(%s)\n",retstr); if ( (balancejson= cJSON_Parse(retstr)) != 0 ) { if ( (unspents= jarray(&n,balancejson,"unspents")) != 0 ) @@ -438,6 +438,7 @@ STRING_ARG(InstantDEX,available,source) } } } + printf("n.%d total %.8f\n",n,dstr(total)); retjson = cJSON_CreateObject(); jaddnum(retjson,"result",dstr(total)); free_json(balancejson); From 6079c7e3747a40aec65ad2c68b021a6467b4da28 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 18:56:43 -0300 Subject: [PATCH 13/27] test --- basilisk/basilisk_DEX.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 8e89e4ce2..45e125c20 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -438,6 +438,8 @@ STRING_ARG(InstantDEX,available,source) } } } +if ( total == 0 ) +total = .005; printf("n.%d total %.8f\n",n,dstr(total)); retjson = cJSON_CreateObject(); jaddnum(retjson,"result",dstr(total)); From df10c68ff8e0963ffe350d343f2091fefdbe4f3b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Sep 2016 19:00:26 -0300 Subject: [PATCH 14/27] test --- basilisk/basilisk_DEX.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 45e125c20..34b0ec787 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -439,11 +439,11 @@ STRING_ARG(InstantDEX,available,source) } } if ( total == 0 ) -total = .005; - printf("n.%d total %.8f\n",n,dstr(total)); +total = 500000; retjson = cJSON_CreateObject(); jaddnum(retjson,"result",dstr(total)); free_json(balancejson); + printf("n.%d total %.8f (%s)\n",n,dstr(total),jprint(retjson,0)); } free(retstr); } From 85d67274c7677b0c1287aa0c874eb86af4c07cf7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 05:47:32 -0300 Subject: [PATCH 15/27] test --- iguana/iguana_bundles.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 7c4372d42..1dd027813 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -217,9 +217,10 @@ int32_t iguana_bundlehash2add(struct iguana_info *coin,struct iguana_block **blo { if ( block->mainchain != 0 && (block->height % coin->chain->bundlesize) == bundlei && (block->height / coin->chain->bundlesize) == bp->hdrsi ) { - printf("would have bundle block override [%d:%d]\n",bp->hdrsi,bundlei); - //bp->blocks[bundlei] = block; - //bp->hashes[bundlei] = block->RO.hash2; + char str[65],str2[65]; + printf("bundle block override [%d:%d] %s <- %s\n",bp->hdrsi,bundlei,bits256_str(str,bp->blocks[bundlei]->RO.hash2),bits256_str(str2,block->RO.hash2)); + bp->blocks[bundlei] = block; + bp->hashes[bundlei] = block->RO.hash2; } else if ( block->mainchain == 0 ) { From 6c174ae5ad80325528a6ed6a7c9a49b341f9e8e1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 05:52:26 -0300 Subject: [PATCH 16/27] test --- iguana/iguana_spendvectors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index 2f8455b83..a95029b1a 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -635,7 +635,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co } } printf("i.%d volatilesinit\n",i); - if ( coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) + if ( strcmp("BTC",coin->symbol) == 0 && coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) { printf("SKIP checking volatile files %d > %d\n",coin->longestchain,coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms); iguana_bundlestats(myinfo,coin,buf,IGUANA_DEFAULTLAG); From 3c1389cbe55b89618e0f5a71f7224b2d0f2201bd Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 05:54:39 -0300 Subject: [PATCH 17/27] test --- iguana/iguana_spendvectors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index a95029b1a..85966c732 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -722,7 +722,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co bp->converted = bp->balancefinish = bp->validated = bp->utxofinish = (uint32_t)time(NULL); } } - coin->matchedfiles = 1; + coin->matchedfiles = strcmp(coin->symbol,"BTC") == 0; coin->spendvectorsaved = (uint32_t)time(NULL); coin->spendvalidated = 0; printf("%s UTXOGEN spendvectorsaved <- %u\n",coin->symbol,coin->spendvectorsaved); From 1e1bfc60a22609e23451b667c14ab5e76b8a106b Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:00:39 -0300 Subject: [PATCH 18/27] test --- iguana/iguana777.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 89ebe2b39..776cef640 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -1056,7 +1056,7 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, if ( coin->MAXMEM == 0 ) coin->MAXMEM = IGUANA_DEFAULTRAM; coin->MAXMEM *= (1024L * 1024 * 1024); - coin->enableCACHE = (strcmp("BTCD",coin->symbol) == 0); + coin->enableCACHE = 0;//(strcmp("BTCD",coin->symbol) == 0); if ( jobj(json,"cache") != 0 ) coin->enableCACHE = juint(json,"cache"); if ( (coin->polltimeout= juint(json,"poll")) <= 0 ) From 3629c764f47976afbd625f8c928d7e0740948e09 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:00:51 -0300 Subject: [PATCH 19/27] test --- iguana/iguana777.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 776cef640..89ebe2b39 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -1056,7 +1056,7 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, if ( coin->MAXMEM == 0 ) coin->MAXMEM = IGUANA_DEFAULTRAM; coin->MAXMEM *= (1024L * 1024 * 1024); - coin->enableCACHE = 0;//(strcmp("BTCD",coin->symbol) == 0); + coin->enableCACHE = (strcmp("BTCD",coin->symbol) == 0); if ( jobj(json,"cache") != 0 ) coin->enableCACHE = juint(json,"cache"); if ( (coin->polltimeout= juint(json,"poll")) <= 0 ) From d50b7ab49d6707ef25f5b72e27b06846c57de39d Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:03:07 -0300 Subject: [PATCH 20/27] test --- iguana/iguana_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 9b018cbd2..719b65a9e 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -127,7 +127,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr, iguana_send(coin,addr,serialized,len); if ( block != 0 ) block->issued = addr->pendtime; - if ( 0 && coin->current == bp ) + //if ( 0 && coin->current == bp ) printf("REQ.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks); } else printf("MSG_BLOCK null datalen.%d\n",len); return(len); From b4dc86a9a8af4350088c56a89a24702f206ae62e Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:05:27 -0300 Subject: [PATCH 21/27] test --- iguana/iguana_recv.c | 2 +- includes/iguana_defines.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 719b65a9e..9b018cbd2 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -127,7 +127,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr, iguana_send(coin,addr,serialized,len); if ( block != 0 ) block->issued = addr->pendtime; - //if ( 0 && coin->current == bp ) + if ( 0 && coin->current == bp ) printf("REQ.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks); } else printf("MSG_BLOCK null datalen.%d\n",len); return(len); diff --git a/includes/iguana_defines.h b/includes/iguana_defines.h index 30fcc841f..451944593 100755 --- a/includes/iguana_defines.h +++ b/includes/iguana_defines.h @@ -45,7 +45,7 @@ #define IGUANA_TAILPERCENTAGE 1.0 #define IGUANA_MAXPENDHDRS 1 #define IGUANA_BTCPENDINGREQUESTS 3 -#define IGUANA_PENDINGREQUESTS 512 +#define IGUANA_PENDINGREQUESTS 64 #define IGUANA_MINPENDBUNDLES 4 #define IGUANA_MAXPENDBUNDLES 64 #define IGUANA_RPCPORT 7778 From 1c8c79ef44eb3f3ddd9cd872d971a1bd3501c939 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:10:39 -0300 Subject: [PATCH 22/27] test --- iguana/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/main.c b/iguana/main.c index bc7c7bbe4..aa5798723 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -293,7 +293,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin { if ( coin != 0 ) { - if ( iguana_immediate(coin,immedmillis) != 0 ) + if ( immedmillis == 0 || iguana_immediate(coin,immedmillis) != 0 ) retjsonstr = SuperNET_jsonstr(myinfo,jsonstr,remoteaddr,port); else retjsonstr = clonestr("{\"error\":\"coin is busy processing\"}"); } else retjsonstr = SuperNET_jsonstr(myinfo,jsonstr,remoteaddr,port); From fbdea4b0d9b9efc7161aace8de74aa4fd528a8de Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:15:14 -0300 Subject: [PATCH 23/27] test --- iguana/iguana_spendvectors.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index 85966c732..af0e0f074 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -722,11 +722,14 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co bp->converted = bp->balancefinish = bp->validated = bp->utxofinish = (uint32_t)time(NULL); } } - coin->matchedfiles = strcmp(coin->symbol,"BTC") == 0; - coin->spendvectorsaved = (uint32_t)time(NULL); - coin->spendvalidated = 0; - printf("%s UTXOGEN spendvectorsaved <- %u\n",coin->symbol,coin->spendvectorsaved); - iguana_utxoaddr_gen(myinfo,coin,(coin->bundlescount - 1) * coin->chain->bundlesize); + if ( strcmp(coin->symbol,"BTC") == 0 ) + { + coin->matchedfiles = 1; + coin->spendvectorsaved = (uint32_t)time(NULL); + coin->spendvalidated = 0; + printf("LONGEST.%d %s UTXOGEN spendvectorsaved <- %u\n",coin->longestchain,coin->symbol,coin->spendvectorsaved); + iguana_utxoaddr_gen(myinfo,coin,(coin->bundlescount - 1) * coin->chain->bundlesize); + } } } else From 7fff220f1c2d02b678e3eecff8a32885285f0b6f Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:24:11 -0300 Subject: [PATCH 24/27] test --- iguana/iguana_spendvectors.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index af0e0f074..9cdbf861d 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -635,12 +635,12 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co } } printf("i.%d volatilesinit\n",i); - if ( strcmp("BTC",coin->symbol) == 0 && coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) + /*if ( strcmp("BTC",coin->symbol) == 0 && coin->longestchain > coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) { printf("SKIP checking volatile files %d > %d\n",coin->longestchain,coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms); iguana_bundlestats(myinfo,coin,buf,IGUANA_DEFAULTLAG); return(coin->bundlescount); - } + }*/ /*if ( i < coin->balanceswritten-1 ) { printf("TRUNCATE balances written.%d -> %d\n",coin->balanceswritten,i); @@ -707,7 +707,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co } else { - printf("%s MATCHED balancehash numhdrsi.%d crc.%08x\n",coin->symbol,coin->balanceswritten,crc); + printf("%s MATCHED balancehash numhdrsi.%d crc.%08x LONGEST.%d\n",coin->symbol,coin->balanceswritten,crc,coin->longestchain); if ( (fp= fopen(crcfname,"wb")) != 0 ) { if ( fwrite(&crc,1,sizeof(crc),fp) != sizeof(crc) || fwrite(&balancehash,1,sizeof(balancehash),fp) != sizeof(balancehash) || fwrite(&allbundles,1,sizeof(allbundles),fp) != sizeof(allbundles) ) From 82ae77d607ebc7fbab070e3195ec846700fb2aef Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:29:31 -0300 Subject: [PATCH 25/27] test --- iguana/iguana_spendvectors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index 9cdbf861d..cb7dca1c4 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -713,7 +713,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co if ( fwrite(&crc,1,sizeof(crc),fp) != sizeof(crc) || fwrite(&balancehash,1,sizeof(balancehash),fp) != sizeof(balancehash) || fwrite(&allbundles,1,sizeof(allbundles),fp) != sizeof(allbundles) ) printf("error writing.(%s)\n",crcfname); fclose(fp); - if ( coin->longestchain <= coin->bundlescount*coin->chain->bundlesize-coin->chain->minconfirms ) + if ( coin->longestchain <= (coin->bundlescount-1)*coin->chain->bundlesize-coin->chain->minconfirms ) { for (i=0; ibundlescount-1; i++) { From e3db655e46d5a7ed5a7c9024c46ee4deaab49be5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:38:21 -0300 Subject: [PATCH 26/27] test --- iguana/iguana_spendvectors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index cb7dca1c4..c00ba8388 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -713,7 +713,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co if ( fwrite(&crc,1,sizeof(crc),fp) != sizeof(crc) || fwrite(&balancehash,1,sizeof(balancehash),fp) != sizeof(balancehash) || fwrite(&allbundles,1,sizeof(allbundles),fp) != sizeof(allbundles) ) printf("error writing.(%s)\n",crcfname); fclose(fp); - if ( coin->longestchain <= (coin->bundlescount-1)*coin->chain->bundlesize-coin->chain->minconfirms ) + if ( (coin->longestchain+coin->chain->minconfirms)/coin->chain->bundlesize < coin->bundlescount*coin->chain->bundlesize ) { for (i=0; ibundlescount-1; i++) { @@ -730,7 +730,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co printf("LONGEST.%d %s UTXOGEN spendvectorsaved <- %u\n",coin->longestchain,coin->symbol,coin->spendvectorsaved); iguana_utxoaddr_gen(myinfo,coin,(coin->bundlescount - 1) * coin->chain->bundlesize); } - } + } else printf("(coin->longestchain+coin->chain->minconfirms)/coin->chain->bundlesize %d < %d coin->bundlescount*coin->chain->bundlesize\n",(coin->longestchain+coin->chain->minconfirms)/coin->chain->bundlesize,coin->bundlescount*coin->chain->bundlesize); } else { From da27eb4f60533d16d2ecac831fc3576f27b3a262 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 06:46:00 -0300 Subject: [PATCH 27/27] test --- iguana/iguana_spendvectors.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index c00ba8388..5228413a8 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -722,14 +722,11 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co bp->converted = bp->balancefinish = bp->validated = bp->utxofinish = (uint32_t)time(NULL); } } - if ( strcmp(coin->symbol,"BTC") == 0 ) - { - coin->matchedfiles = 1; - coin->spendvectorsaved = (uint32_t)time(NULL); - coin->spendvalidated = 0; - printf("LONGEST.%d %s UTXOGEN spendvectorsaved <- %u\n",coin->longestchain,coin->symbol,coin->spendvectorsaved); - iguana_utxoaddr_gen(myinfo,coin,(coin->bundlescount - 1) * coin->chain->bundlesize); - } + coin->matchedfiles = 1; + coin->spendvectorsaved = (uint32_t)time(NULL); + coin->spendvalidated = 0; + printf("LONGEST.%d %s UTXOGEN spendvectorsaved <- %u\n",coin->longestchain,coin->symbol,coin->spendvectorsaved); + iguana_utxoaddr_gen(myinfo,coin,(coin->bundlescount - 1) * coin->chain->bundlesize); } else printf("(coin->longestchain+coin->chain->minconfirms)/coin->chain->bundlesize %d < %d coin->bundlescount*coin->chain->bundlesize\n",(coin->longestchain+coin->chain->minconfirms)/coin->chain->bundlesize,coin->bundlescount*coin->chain->bundlesize); } else