From 14c8faa4d617521c46125aa5e2a628fe2974ff57 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 9 Oct 2017 23:40:56 +0300 Subject: [PATCH 001/346] Extra margin for deposit --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index fe2a2fc2f..d61cafe5f 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -489,7 +489,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; - if ( (mini= LP_nearest_utxovalue(coin->electrum == 0,utxos,m,targetval2)) >= 0 ) + if ( (mini= LP_nearest_utxovalue(coin->electrum == 0,utxos,m,targetval2 * 1.01)) >= 0 ) { if ( up != 0 && (up2= utxos[mini]) != 0 ) { From 735624a27ffdf77aadfa03da75c4cb3022df9a5c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 00:39:18 +0300 Subject: [PATCH 002/346] 10 sec electrum timeout --- iguana/exchanges/LP_nativeDEX.c | 4 ++++ iguana/exchanges/LP_socket.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0d7d1917d..73f07350c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,6 +19,10 @@ // LP_nativeDEX.c // marketmaker // +// n41r0j [12:21 AM] +// when i remove funds from my smart addresses, the first time i do ./inv, it shows up empty, but after that, the old values come back +//[12:23] a restart of client fixes it though + // SPV at tx level // stats, fix pricearray // sign packets diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 8bb30cfd7..9fda77bda 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -26,7 +26,7 @@ //#include //#endif -#define ELECTRUM_TIMEOUT 5 +#define ELECTRUM_TIMEOUT 10 int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port) { From 79b2ea4054ab64a33a8050c793b1f2acb4945d01 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 00:57:03 +0300 Subject: [PATCH 003/346] Test --- iguana/exchanges/LP_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 9fda77bda..a56737148 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -501,7 +501,7 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON { cJSON *retjson=0; struct iguana_info *coin = LP_coinfind(symbol); //printf("electrum.%s/%s listunspent last.(%s lag %d)\n",ep->symbol,coin->symbol,coin->lastunspent,(int32_t)(time(NULL) - coin->unspenttime)); - if ( 1 || strcmp(coin->lastunspent,addr) != 0 || time(NULL) > coin->unspenttime+30 ) + if ( strcmp(coin->lastunspent,addr) != 0 || time(NULL) > coin->unspenttime+30 ) { if ( (retjson= electrum_strarg(symbol,ep,retjsonp,"blockchain.address.listunspent",addr,ELECTRUM_TIMEOUT)) != 0 ) { From 87d95da15cb75bb8cf11cc4e41fe020dd46beff4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 00:58:22 +0300 Subject: [PATCH 004/346] Test --- iguana/exchanges/LP_utxos.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 5e702286f..9d6ab89f5 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -436,7 +436,10 @@ cJSON *LP_inventory(char *symbol) myipaddr = LP_mypeer->ipaddr; else myipaddr = "127.0.0.1"; if ( (coin= LP_coinfind(symbol)) != 0 ) + { + coin->unspenttime = (uint32_t)time(NULL) - 777; LP_listunspent_both(symbol,coin->smartaddr); + } HASH_ITER(hh,G.LP_utxoinfos[iambob],utxo,tmp) { char str[65]; From 12389444576b0186d5a78bfeefd4cec8489c1d38 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 01:26:43 +0300 Subject: [PATCH 005/346] Test --- iguana/exchanges/LP_ordermatch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index d61cafe5f..154c05eb9 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -557,7 +557,7 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,struct LP_utxoinfo *utxo,cJ { if ( (pair= LP_nanobind(ctx,pairstr)) >= 0 ) { - LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-qp->txfee,rel,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-2*qp->txfee,rel,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); printf("call swapinit\n"); swap = LP_swapinit(1,0,privkey,&qp->R,qp); printf("swapinit.%p\n",swap); @@ -667,7 +667,7 @@ char *LP_connectedalice(cJSON *argjson) // alice //timeout = 1; //nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); //nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); - LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); + LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-2*Q.txfee,Q.destcoin,Q.destsatoshis-2*Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); swap = LP_swapinit(0,0,Q.privkey,&Q.R,&Q); swap->N.pair = pairsock; autxo->S.swap = swap; @@ -875,7 +875,7 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q if ( price <= maxprice ) { price = LP_query(ctx,myipaddr,mypubsock,"connect",qp); - LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-qp->txfee,qp->destcoin,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-2*qp->txfee,qp->destcoin,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); expiration = (uint32_t)time(NULL) + timeout; while ( time(NULL) < expiration ) { From f0492858f7d5b6b360b352bb4f1b95abaa2684c1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 01:30:37 +0300 Subject: [PATCH 006/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 154c05eb9..53fd437f0 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -316,12 +316,12 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str if ( strcmp(autxo->coinaddr,qp->destaddr) != 0 ) return(-10); } - if ( autxo != 0 && destvalue < qp->desttxfee+qp->destsatoshis ) + if ( autxo != 0 && destvalue < 2*qp->desttxfee+qp->destsatoshis ) { printf("destvalue %.8f destsatoshis %.8f is too small txfee %.8f?\n",dstr(destvalue),dstr(qp->destsatoshis),dstr(qp->desttxfee)); return(-11); } - if ( butxo != 0 && srcvalue < qp->txfee+qp->satoshis ) + if ( butxo != 0 && srcvalue < 2*qp->txfee+qp->satoshis ) { printf("srcvalue %.8f [%.8f] satoshis %.8f is too small txfee %.8f?\n",dstr(srcvalue),dstr(srcvalue) - dstr(qp->txfee+qp->satoshis),dstr(qp->satoshis),dstr(qp->txfee)); return(-33); From 0962cfc4d9d76392e16e9e4e8cce6ba7005238c9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 01:41:11 +0300 Subject: [PATCH 007/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 73f07350c..4abddda35 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -23,7 +23,7 @@ // when i remove funds from my smart addresses, the first time i do ./inv, it shows up empty, but after that, the old values come back //[12:23] a restart of client fixes it though -// SPV at tx level +// SPV at tx level and limit SPV proofing // stats, fix pricearray // sign packets // dPoW security From ee09ad921d4a7f29a6caf46598ce8dd1bb6984bf Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 10:35:39 +0300 Subject: [PATCH 008/346] Test --- iguana/exchanges/LP_remember.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index c5e5b059e..f0ec76fa9 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1126,7 +1126,7 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) for (i=0; i Date: Tue, 10 Oct 2017 10:42:34 +0300 Subject: [PATCH 009/346] Test --- iguana/exchanges/LP_remember.c | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index f0ec76fa9..b18468fe5 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1044,21 +1044,26 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) //,statebits; int32_t optionduration; struct basilisk_request R; bits256 privkey; retjson = cJSON_CreateObject(); array = cJSON_CreateArray(); - sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); - if ( (fp= fopen(fname,"rb")) != 0 ) + if ( origrequestid != 0 && origquoteid != 0 ) { - //struct basilisk_swap *swap; - int32_t flag = 0; - while ( fread(&requestid,1,sizeof(requestid),fp) == sizeof(requestid) && fread("eid,1,sizeof(quoteid),fp) == sizeof(quoteid) ) + if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 ) + jaddi(array,item); + } + else + { + sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); + if ( (fp= fopen(fname,"rb")) != 0 ) { - flag = 0; - for (i=0; i> 32); - q = (uint32_t)G.LP_skipstatus[i]; - if ( r == requestid && q == quoteid ) + flag = 0; + for (i=0; i> 32); + q = (uint32_t)G.LP_skipstatus[i]; + if ( r == requestid && q == quoteid ) { item = cJSON_CreateObject(); jaddstr(item,"status","realtime"); @@ -1066,21 +1071,17 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) jaddnum(item,"quoteid",q); jaddi(array,item); flag = 1; + break; } - break; } - } - if ( flag == 0 ) - { - if ( (item= basilisk_remember(KMDtotals,BTCtotals,requestid,quoteid)) != 0 ) + if ( flag == 0 ) { - jaddi(array,item); - //if ( (status= jstr(item,"status")) != 0 && strcmp(status,"pending") == 0 ) - // break; + if ( (item= basilisk_remember(KMDtotals,BTCtotals,requestid,quoteid)) != 0 ) + jaddi(array,item); } } + fclose(fp); } - fclose(fp); } jaddstr(retjson,"result","success"); jadd(retjson,"swaps",array); From c6f0dd4e355b8e4ad4e52723af1b7b07cc1ed248 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 10:46:26 +0300 Subject: [PATCH 010/346] Test --- iguana/exchanges/LP_remember.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index b18468fe5..78aa697aa 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1046,8 +1046,10 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) array = cJSON_CreateArray(); if ( origrequestid != 0 && origquoteid != 0 ) { + printf("orig req.%u q.%u\n",origrequestid,origquoteid); if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 ) jaddi(array,item); + printf("got.(%s)\n",jprint(item,0)); } else { @@ -1120,6 +1122,7 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) char *liststr,*retstr = 0; cJSON *retjson,*array,*item; int32_t i,n; if ( (liststr= basilisk_swaplist(requestid,quoteid)) != 0 ) { + printf("swapentry.(%s)\n",liststr); if ( (retjson= cJSON_Parse(liststr)) != 0 ) { if ( (array= jarray(&n,retjson,"swaps")) != 0 ) From cd94697ab5bcde622e9817cd868d0b0f0d401348 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 11:18:03 +0300 Subject: [PATCH 011/346] Test --- iguana/exchanges/LP_remember.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 78aa697aa..e65362b3c 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -742,12 +742,12 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( ctx == 0 ) ctx = bitcoin_ctx(); if ( (rswap.iambob= LP_rswap_init(&rswap,requestid,quoteid)) < 0 ) - return(0); + return(cJSON_Parse("{\"error\":\"couldnt initialize rswap, are all coins active?\"}")); LP_swap_load(&rswap); memset(zero.bytes,0,sizeof(zero)); Adest = Bdest = AAdest = ABdest = 0; if ( rswap.bobcoin[0] == 0 || rswap.alicecoin[0] == 0 || strcmp(rswap.bobcoin,rswap.src) != 0 || strcmp(rswap.alicecoin,rswap.dest) != 0 ) - return(0); + return(cJSON_Parse("{\"error\":\"mismatched bob/alice vs src/dest coins??\"}")); alice = LP_coinfind(rswap.alicecoin); bob = LP_coinfind(rswap.bobcoin); rswap.Atxfee = LP_txfeecalc(alice,rswap.Atxfee); From 2ef15d5d465ccfb83feb767f677a706ccf486368 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 11:29:35 +0300 Subject: [PATCH 012/346] Test --- iguana/exchanges/LP_remember.c | 62 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index e65362b3c..948281c42 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -334,7 +334,6 @@ int32_t basilisk_isbobcoin(int32_t iambob,int32_t ind) } } -// add blocktrail presence requirement for BTC int32_t basilisk_swap_isfinished(int32_t iambob,bits256 *txids,int32_t *sentflags,bits256 paymentspent,bits256 Apaymentspent,bits256 depositspent) { int32_t i,n = 0; @@ -615,7 +614,8 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t } } } - rswap->origfinishedflag = rswap->finishedflag = 1; + rswap->origfinishedflag = basilisk_swap_isfinished(rswap->iambob,rswap->txids,rswap->sentflags,rswap->paymentspent,rswap->Apaymentspent,rswap->depositspent); + rswap->finishedflag = rswap->origfinishedflag; free(fstr); } return(rswap->iambob); @@ -752,42 +752,42 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti bob = LP_coinfind(rswap.bobcoin); rswap.Atxfee = LP_txfeecalc(alice,rswap.Atxfee); rswap.Btxfee = LP_txfeecalc(bob,rswap.Btxfee); - //printf("%s %.8f txfee, %s %.8f txfee\n",alicecoin,dstr(Atxfee),bobcoin,dstr(Btxfee)); - //printf("privAm.(%s) %p/%p\n",bits256_str(str,privAm),Adest,AAdest); - //printf("privBn.(%s) %p/%p\n",bits256_str(str,privBn),Bdest,ABdest); - if ( rswap.finishedflag == 0 && rswap.bobcoin[0] != 0 && rswap.alicecoin[0] != 0 ) + if ( rswap.iambob == 0 ) { - if ( rswap.iambob == 0 ) + if ( alice != 0 ) { - if ( alice != 0 ) - { - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - AAdest = rswap.Adestaddr; - } - if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) - { - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); - Adest = rswap.destaddr; - } + bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); + AAdest = rswap.Adestaddr; } - else + if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { - if ( bob != 0 ) - { - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); - Bdest = rswap.destaddr; - } - if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) - { - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - ABdest = rswap.Adestaddr; - } + bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); + Adest = rswap.destaddr; } - if ( bob == 0 || alice == 0 ) + } + else + { + if ( bob != 0 ) { - printf("Bob.%p is null or Alice.%p is null\n",bob,alice); - return(0); + bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); + Bdest = rswap.destaddr; + } + if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) + { + bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); + ABdest = rswap.Adestaddr; } + } + if ( bob == 0 || alice == 0 ) + { + printf("Bob.%p is null or Alice.%p is null\n",bob,alice); + return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); + } + printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); + printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); + printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); + if ( rswap.finishedflag == 0 && rswap.bobcoin[0] != 0 && rswap.alicecoin[0] != 0 ) + { if ( alice->inactive != 0 || bob->inactive != 0 ) { printf("Alice.%s inactive.%u or Bob.%s inactive.%u\n",rswap.alicecoin,alice->inactive,rswap.bobcoin,bob->inactive); From 2aab2758ab49de21f15ff7102e5b66402d1ea3f1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 11:35:08 +0300 Subject: [PATCH 013/346] Test --- iguana/exchanges/LP_remember.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 948281c42..9781ecfa3 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -747,7 +747,10 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti memset(zero.bytes,0,sizeof(zero)); Adest = Bdest = AAdest = ABdest = 0; if ( rswap.bobcoin[0] == 0 || rswap.alicecoin[0] == 0 || strcmp(rswap.bobcoin,rswap.src) != 0 || strcmp(rswap.alicecoin,rswap.dest) != 0 ) + { + printf("BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest); return(cJSON_Parse("{\"error\":\"mismatched bob/alice vs src/dest coins??\"}")); + } alice = LP_coinfind(rswap.alicecoin); bob = LP_coinfind(rswap.bobcoin); rswap.Atxfee = LP_txfeecalc(alice,rswap.Atxfee); From ce5d9b420b0fb3eb7f58e5ee6b2ca9faab67f7fe Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 11:40:49 +0300 Subject: [PATCH 014/346] Test --- iguana/exchanges/LP_remember.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 9781ecfa3..75d03a222 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -624,6 +624,7 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t int32_t LP_swap_load(struct LP_swap_remember *rswap) { int32_t i,needflag,addflag; long fsize; char fname[1024],str[65],*fstr,*symbol,*rstr; cJSON *txobj,*sentobj; bits256 txid,checktxid; uint64_t value; + rswap->iambob = -1; for (i=0; iiambob = jint(txobj,"iambob"); + if ( jobj(txobj,"iambob") != 0 ) + rswap->iambob = jint(txobj,"iambob"); txid = jbits256(txobj,"txid"); if ( bits256_nonz(txid) == 0 ) continue; @@ -663,6 +665,26 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) decode_hex(rswap->Dredeemscript,rswap->Dredeemlen,rstr); } rswap->values[i] = value = LP_value_extract(txobj,1); + if ( (symbol= jstr(txobj,"src")) != 0 ) + { + safecopy(rswap->src,symbol,sizeof(rswap->src)); + if ( rswap->iambob >= 0 ) + { + if ( rswap->iambob > 0 ) + safecopy(rswap->bobcoin,symbol,sizeof(rswap->bobcoin)); + else safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin)); + } + } + if ( (symbol= jstr(txobj,"dest")) != 0 ) + { + safecopy(rswap->dest,symbol,sizeof(rswap->dest)); + if ( rswap->iambob >= 0 ) + { + if ( rswap->iambob == 0 ) + safecopy(rswap->bobcoin,symbol,sizeof(rswap->bobcoin)); + else safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin)); + } + } if ( (symbol= jstr(txobj,"coin")) != 0 ) { if ( i == BASILISK_ALICESPEND || i == BASILISK_BOBPAYMENT || i == BASILISK_BOBDEPOSIT || i == BASILISK_BOBREFUND || i == BASILISK_BOBRECLAIM || i == BASILISK_ALICECLAIM ) From 949640417226a06ab9e1310f03cc6ff5ac6e02e7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 11:43:51 +0300 Subject: [PATCH 015/346] Test --- iguana/exchanges/LP_remember.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 75d03a222..3bc160aed 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -724,6 +724,14 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) } else if ( 0 && rswap->finishedflag == 0 ) printf("%s not finished\n",fname); } + if ( rswap->bobcoin[0] == 0 ) + strcpy(rswap->bobcoin,rswap->src); + if ( rswap->alicecoin[0] == 0 ) + strcpy(rswap->alicecoin,rswap->dest); + if ( rswap->src[0] == 0 ) + strcpy(rswap->src,rswap->bobcoin); + if ( rswap->dest[0] == 0 ) + strcpy(rswap->dest,rswap->alicecoin); return(rswap->finishedflag); } From 9f632c021bc87c236e0b425fffc2feb459e05f42 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 11:50:55 +0300 Subject: [PATCH 016/346] Fixed swapstatus --- iguana/exchanges/LP_remember.c | 62 +++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 3bc160aed..30da44c5f 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -735,7 +735,53 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) return(rswap->finishedflag); } -/*{ +/* +if ( rswap.txbytes[BASILISK_ALICESPEND] != 0 ) +{ + rswap.txids[BASILISK_ALICESPEND] = LP_broadcast("alicespend",rswap.bobcoin,rswap.txbytes[BASILISK_ALICESPEND],zero); + if ( bits256_nonz(rswap.txids[BASILISK_ALICESPEND]) != 0 ) // tested + { + rswap.sentflags[BASILISK_ALICESPEND] = 1; + rswap.paymentspent = rswap.txids[BASILISK_ALICESPEND]; + } +} +if ( rswap.txbytes[BASILISK_ALICECLAIM] != 0 ) +{ + rswap.txids[BASILISK_ALICECLAIM] = LP_broadcast("aliceclaim",rswap.bobcoin,rswap.txbytes[BASILISK_ALICECLAIM],zero); + if ( bits256_nonz(rswap.txids[BASILISK_ALICECLAIM]) != 0 ) // tested + { + rswap.sentflags[BASILISK_ALICECLAIM] = 1; + rswap.depositspent = rswap.txids[BASILISK_ALICECLAIM]; + } +} +if ( rswap.txbytes[BASILISK_ALICERECLAIM] != 0 ) +{ + rswap.txids[BASILISK_ALICERECLAIM] = LP_broadcast("alicereclaim",rswap.alicecoin,rswap.txbytes[BASILISK_ALICERECLAIM],zero); + if ( bits256_nonz(rswap.txids[BASILISK_ALICERECLAIM]) != 0 ) // tested + { + rswap.sentflags[BASILISK_ALICERECLAIM] = 1; + rswap.Apaymentspent = rswap.txids[BASILISK_ALICERECLAIM]; + } +} +if ( rswap.txbytes[BASILISK_BOBSPEND] != 0 ) +{ + rswap.txids[BASILISK_BOBSPEND] = LP_broadcast("bobspend",rswap.alicecoin,rswap.txbytes[BASILISK_BOBSPEND],zero); + if ( bits256_nonz(rswap.txids[BASILISK_BOBSPEND]) != 0 ) // tested + { + rswap.sentflags[BASILISK_BOBSPEND] = 1; + rswap.Apaymentspent = rswap.txids[BASILISK_BOBSPEND]; + } +} +if ( rswap.txbytes[BASILISK_BOBRECLAIM] != 0 ) +{ + rswap.txids[BASILISK_BOBRECLAIM] = LP_broadcast("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],zero); + if ( bits256_nonz(rswap.txids[BASILISK_BOBRECLAIM]) != 0 ) // tested + { + rswap.sentflags[BASILISK_BOBRECLAIM] = 1; + rswap.paymentspent = rswap.txids[BASILISK_BOBRECLAIM]; + } +} +{ if ( txbytes[BASILISK_BOBREFUND] != 0 ) { txids[BASILISK_BOBREFUND] = LP_broadcast("bobrefund",bobcoin,txbytes[BASILISK_BOBREFUND],zero); @@ -816,9 +862,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } - printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); - printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); - printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); + //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); + //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); + //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); if ( rswap.finishedflag == 0 && rswap.bobcoin[0] != 0 && rswap.alicecoin[0] != 0 ) { if ( alice->inactive != 0 || bob->inactive != 0 ) @@ -1079,10 +1125,10 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) array = cJSON_CreateArray(); if ( origrequestid != 0 && origquoteid != 0 ) { - printf("orig req.%u q.%u\n",origrequestid,origquoteid); + //printf("orig req.%u q.%u\n",origrequestid,origquoteid); if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 ) jaddi(array,item); - printf("got.(%s)\n",jprint(item,0)); + //printf("got.(%s)\n",jprint(item,0)); } else { @@ -1155,7 +1201,7 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) char *liststr,*retstr = 0; cJSON *retjson,*array,*item; int32_t i,n; if ( (liststr= basilisk_swaplist(requestid,quoteid)) != 0 ) { - printf("swapentry.(%s)\n",liststr); + //printf("swapentry.(%s)\n",liststr); if ( (retjson= cJSON_Parse(liststr)) != 0 ) { if ( (array= jarray(&n,retjson,"swaps")) != 0 ) @@ -1163,7 +1209,7 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) for (i=0; i Date: Tue, 10 Oct 2017 13:11:25 +0300 Subject: [PATCH 017/346] Test --- iguana/exchanges/LP_remember.c | 92 +++++++++++----------------------- 1 file changed, 28 insertions(+), 64 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 30da44c5f..ee91914bf 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -735,63 +735,21 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) return(rswap->finishedflag); } -/* -if ( rswap.txbytes[BASILISK_ALICESPEND] != 0 ) +void LP_txbytes_update(char *symbol,char *name,char *txbytes,bits256 *txidp,bits256 *ptr,int32_t *flagp) { - rswap.txids[BASILISK_ALICESPEND] = LP_broadcast("alicespend",rswap.bobcoin,rswap.txbytes[BASILISK_ALICESPEND],zero); - if ( bits256_nonz(rswap.txids[BASILISK_ALICESPEND]) != 0 ) // tested - { - rswap.sentflags[BASILISK_ALICESPEND] = 1; - rswap.paymentspent = rswap.txids[BASILISK_ALICESPEND]; - } -} -if ( rswap.txbytes[BASILISK_ALICECLAIM] != 0 ) -{ - rswap.txids[BASILISK_ALICECLAIM] = LP_broadcast("aliceclaim",rswap.bobcoin,rswap.txbytes[BASILISK_ALICECLAIM],zero); - if ( bits256_nonz(rswap.txids[BASILISK_ALICECLAIM]) != 0 ) // tested - { - rswap.sentflags[BASILISK_ALICECLAIM] = 1; - rswap.depositspent = rswap.txids[BASILISK_ALICECLAIM]; - } -} -if ( rswap.txbytes[BASILISK_ALICERECLAIM] != 0 ) -{ - rswap.txids[BASILISK_ALICERECLAIM] = LP_broadcast("alicereclaim",rswap.alicecoin,rswap.txbytes[BASILISK_ALICERECLAIM],zero); - if ( bits256_nonz(rswap.txids[BASILISK_ALICERECLAIM]) != 0 ) // tested - { - rswap.sentflags[BASILISK_ALICERECLAIM] = 1; - rswap.Apaymentspent = rswap.txids[BASILISK_ALICERECLAIM]; - } -} -if ( rswap.txbytes[BASILISK_BOBSPEND] != 0 ) -{ - rswap.txids[BASILISK_BOBSPEND] = LP_broadcast("bobspend",rswap.alicecoin,rswap.txbytes[BASILISK_BOBSPEND],zero); - if ( bits256_nonz(rswap.txids[BASILISK_BOBSPEND]) != 0 ) // tested - { - rswap.sentflags[BASILISK_BOBSPEND] = 1; - rswap.Apaymentspent = rswap.txids[BASILISK_BOBSPEND]; - } -} -if ( rswap.txbytes[BASILISK_BOBRECLAIM] != 0 ) -{ - rswap.txids[BASILISK_BOBRECLAIM] = LP_broadcast("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],zero); - if ( bits256_nonz(rswap.txids[BASILISK_BOBRECLAIM]) != 0 ) // tested - { - rswap.sentflags[BASILISK_BOBRECLAIM] = 1; - rswap.paymentspent = rswap.txids[BASILISK_BOBRECLAIM]; - } -} -{ - if ( txbytes[BASILISK_BOBREFUND] != 0 ) + bits256 zero; + memset(zero.bytes,0,sizeof(zero)); + if ( txbytes != 0 ) { - txids[BASILISK_BOBREFUND] = LP_broadcast("bobrefund",bobcoin,txbytes[BASILISK_BOBREFUND],zero); - if ( bits256_nonz(txids[BASILISK_BOBREFUND]) != 0 ) // tested + *txidp = LP_broadcast(name,symbol,txbytes,zero); + if ( bits256_nonz(*txidp) != 0 ) { - sentflags[BASILISK_BOBREFUND] = 1; - depositspent = txids[BASILISK_BOBREFUND]; + *flagp = 1; + if ( ptr != 0 ) + *ptr = *txidp; } } -}*/ +} int32_t LP_rswap_checktx(struct LP_swap_remember *rswap,char *symbol,int32_t txi) { @@ -911,7 +869,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("alicespend.(%s)\n",rswap.txbytes[BASILISK_ALICESPEND]); } } - if ( rswap.txbytes[BASILISK_ALICESPEND] != 0 ) + LP_txbytes_update("alicespend",rswap.bobcoin,rswap.txbytes[BASILISK_ALICESPEND],&rswap.txids[BASILISK_ALICESPEND],&rswap.paymentspent,&rswap.sentflags[BASILISK_ALICESPEND]); + /*if ( rswap.txbytes[BASILISK_ALICESPEND] != 0 ) { rswap.txids[BASILISK_ALICESPEND] = LP_broadcast("alicespend",rswap.bobcoin,rswap.txbytes[BASILISK_ALICESPEND],zero); if ( bits256_nonz(rswap.txids[BASILISK_ALICESPEND]) != 0 ) // tested @@ -919,7 +878,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.sentflags[BASILISK_ALICESPEND] = 1; rswap.paymentspent = rswap.txids[BASILISK_ALICESPEND]; } - } + }*/ } } if ( rswap.sentflags[BASILISK_ALICECLAIM] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 ) @@ -943,7 +902,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } } - if ( rswap.txbytes[BASILISK_ALICECLAIM] != 0 ) + LP_txbytes_update("aliceclaim",rswap.bobcoin,rswap.txbytes[BASILISK_ALICECLAIM],&rswap.txids[BASILISK_ALICECLAIM],&rswap.depositspent,&rswap.sentflags[BASILISK_ALICECLAIM]); + /*if ( rswap.txbytes[BASILISK_ALICECLAIM] != 0 ) { rswap.txids[BASILISK_ALICECLAIM] = LP_broadcast("aliceclaim",rswap.bobcoin,rswap.txbytes[BASILISK_ALICECLAIM],zero); if ( bits256_nonz(rswap.txids[BASILISK_ALICECLAIM]) != 0 ) // tested @@ -951,7 +911,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.sentflags[BASILISK_ALICECLAIM] = 1; rswap.depositspent = rswap.txids[BASILISK_ALICECLAIM]; } - } + }*/ } else printf("now %u before expiration %u\n",(uint32_t)time(NULL),rswap.expiration); } if ( rswap.sentflags[BASILISK_ALICEPAYMENT] != 0 && bits256_nonz(rswap.Apaymentspent) == 0 && rswap.sentflags[BASILISK_ALICECLAIM] == 0 ) @@ -965,7 +925,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("privBn.(%s) alicereclaim.(%s)\n",bits256_str(str,rswap.privBn),rswap.txbytes[BASILISK_ALICERECLAIM]); } } - if ( rswap.txbytes[BASILISK_ALICERECLAIM] != 0 ) + LP_txbytes_update("alicereclaim",rswap.alicecoin,rswap.txbytes[BASILISK_ALICERECLAIM],&rswap.txids[BASILISK_ALICERECLAIM],&rswap.Apaymentspent,&rswap.sentflags[BASILISK_ALICERECLAIM]); + /*if ( rswap.txbytes[BASILISK_ALICERECLAIM] != 0 ) { rswap.txids[BASILISK_ALICERECLAIM] = LP_broadcast("alicereclaim",rswap.alicecoin,rswap.txbytes[BASILISK_ALICERECLAIM],zero); if ( bits256_nonz(rswap.txids[BASILISK_ALICERECLAIM]) != 0 ) // tested @@ -973,7 +934,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.sentflags[BASILISK_ALICERECLAIM] = 1; rswap.Apaymentspent = rswap.txids[BASILISK_ALICERECLAIM]; } - } + }*/ } } else if ( rswap.iambob == 1 ) @@ -995,7 +956,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("bobspend.(%s)\n",rswap.txbytes[BASILISK_BOBSPEND]); } } - if ( rswap.txbytes[BASILISK_BOBSPEND] != 0 ) + LP_txbytes_update("bobspend",rswap.alicecoin,rswap.txbytes[BASILISK_BOBSPEND],&rswap.txids[BASILISK_BOBSPEND],&rswap.Apaymentspent,&rswap.sentflags[BASILISK_BOBSPEND]); + /*if ( rswap.txbytes[BASILISK_BOBSPEND] != 0 ) { rswap.txids[BASILISK_BOBSPEND] = LP_broadcast("bobspend",rswap.alicecoin,rswap.txbytes[BASILISK_BOBSPEND],zero); if ( bits256_nonz(rswap.txids[BASILISK_BOBSPEND]) != 0 ) // tested @@ -1003,7 +965,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.sentflags[BASILISK_BOBSPEND] = 1; rswap.Apaymentspent = rswap.txids[BASILISK_BOBSPEND]; } - } + }*/ } } if ( rswap.sentflags[BASILISK_BOBRECLAIM] == 0 && rswap.sentflags[BASILISK_BOBPAYMENT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBPAYMENT]) != 0 && time(NULL) > rswap.expiration && bits256_nonz(rswap.paymentspent) == 0 ) @@ -1024,7 +986,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } } - if ( rswap.txbytes[BASILISK_BOBRECLAIM] != 0 ) + LP_txbytes_update("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],&rswap.txids[BASILISK_BOBRECLAIM],&rswap.paymentspent,&rswap.sentflags[BASILISK_BOBRECLAIM]); + /*if ( rswap.txbytes[BASILISK_BOBRECLAIM] != 0 ) { rswap.txids[BASILISK_BOBRECLAIM] = LP_broadcast("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],zero); if ( bits256_nonz(rswap.txids[BASILISK_BOBRECLAIM]) != 0 ) // tested @@ -1032,7 +995,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.sentflags[BASILISK_BOBRECLAIM] = 1; rswap.paymentspent = rswap.txids[BASILISK_BOBRECLAIM]; } - } + }*/ } if ( rswap.sentflags[BASILISK_BOBREFUND] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 ) { @@ -1048,7 +1011,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( (rswap.txbytes[BASILISK_BOBREFUND]= basilisk_swap_bobtxspend(&signedtxid,rswap.Btxfee,"bobrefund",rswap.bobcoin,bob->wiftaddr,bob->taddr,bob->pubtype,bob->p2shtype,bob->isPoS,bob->wiftype,ctx,rswap.myprivs[0],0,redeemscript,redeemlen,userdata,len,rswap.txids[BASILISK_BOBDEPOSIT],0,0,rswap.pubkey33,1,rswap.expiration,&rswap.values[BASILISK_BOBREFUND],0,0,rswap.bobdepositaddr,1)) != 0 ) printf("pubB1.(%s) bobrefund.(%s)\n",bits256_str(str,rswap.pubB1),rswap.txbytes[BASILISK_BOBREFUND]); } - if ( rswap.txbytes[BASILISK_BOBREFUND] != 0 ) + LP_txbytes_update("bobrefund",rswap.bobcoin,rswap.txbytes[BASILISK_BOBREFUND],&rswap.txids[BASILISK_BOBREFUND],&rswap.depositspent,&rswap.sentflags[BASILISK_BOBREFUND]); + /*if ( rswap.txbytes[BASILISK_BOBREFUND] != 0 ) { rswap.txids[BASILISK_BOBREFUND] = LP_broadcast("bobrefund",rswap.bobcoin,rswap.txbytes[BASILISK_BOBREFUND],zero); if ( bits256_nonz(rswap.txids[BASILISK_BOBREFUND]) != 0 ) // tested @@ -1056,7 +1020,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.sentflags[BASILISK_BOBREFUND] = 1; rswap.depositspent = rswap.txids[BASILISK_BOBREFUND]; } - } + }*/ } else printf("bobrefund's time %u vs expiration %u\n",(uint32_t)time(NULL),rswap.expiration); } } From 2905ea6322a8f5d39899cb4bb77a1d25aeca3585 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 16:42:32 +0300 Subject: [PATCH 018/346] Test --- iguana/exchanges/LP_nativeDEX.c | 3 --- iguana/exchanges/LP_utxos.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 4abddda35..5db9a7f24 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,9 +19,6 @@ // LP_nativeDEX.c // marketmaker // -// n41r0j [12:21 AM] -// when i remove funds from my smart addresses, the first time i do ./inv, it shows up empty, but after that, the old values come back -//[12:23] a restart of client fixes it though // SPV at tx level and limit SPV proofing // stats, fix pricearray diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 9d6ab89f5..9a67d2cda 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -36,6 +36,20 @@ int32_t LP_isavailable(struct LP_utxoinfo *utxo) int32_t LP_isunspent(struct LP_utxoinfo *utxo) { + struct LP_address_utxo *up; struct _LP_utxoinfo u; struct iguana_info *coin; + if ( (coin= LP_coinfind(utxo->coin)) == 0 ) + return(0); + if ( (up= LP_address_utxofind(coin,utxo->coinaddr,utxo->payment.txid,utxo->payment.vout)) != 0 && up->spendheight > 0 ) + { + utxo->T.spentflag = up->spendheight; + return(0); + } + u = (utxo->iambob != 0) ? utxo->deposit : utxo->fee; + if ( (up= LP_address_utxofind(coin,utxo->coinaddr,u.txid,u.vout)) != 0 && up->spendheight > 0 ) + { + utxo->T.spentflag = up->spendheight; + return(0); + } if ( utxo != 0 && utxo->T.spentflag == 0 && LP_isavailable(utxo) > 0 ) return(1); else return(0); From 857b20e8a52c9a7c144ebad233df9cbad983bf0d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 17:13:27 +0300 Subject: [PATCH 019/346] Test --- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_ordermatch.c | 30 +++++++++++++---- iguana/exchanges/LP_utxo.c | 56 ++++++++++++++++++-------------- 3 files changed, 55 insertions(+), 32 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 5db9a7f24..3e1189b98 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -21,6 +21,7 @@ // // SPV at tx level and limit SPV proofing + // stats, fix pricearray // sign packets // dPoW security diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 53fd437f0..943a755d6 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -441,17 +441,33 @@ int32_t LP_nanobind(void *ctx,char *pairstr) return(pairsock); } -int32_t LP_nearest_utxovalue(int32_t noSPV,struct LP_address_utxo **utxos,int32_t n,uint64_t targetval) +int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **utxos,int32_t n,uint64_t targetval) { - int32_t i,mini = -1; int64_t dist; uint64_t mindist = (1LL << 60); + int32_t i,mini = -1; struct LP_address_utxo *up; struct electrum_info *backupep=0,*ep; char str[65]; int64_t dist; uint64_t mindist = (1LL << 60); + if ( (ep= coin->electrum) != 0 ) + { + if ( (backupep= ep->prev) == 0 ) + backupep = ep; + } for (i=0; ispendheight == 0 && utxos[i]->SPV > 0)) ) + if ( (up= utxos[i]) != 0 && up->spendheight == 0 ) { - dist = (utxos[i]->U.value - targetval); + if ( coin->electrum != 0 ) + { + if (up->SPV == 0 ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); + printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); + if ( up->SPV < 0 ) + { + printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); + continue; + } + } + dist = (up->U.value - targetval); if ( dist >= 0 && dist < mindist ) { - printf("(%.8f %.8f %.8f).%d ",dstr(utxos[i]->U.value),dstr(dist),dstr(mindist),mini); + printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); mini = i; mindist = dist; } @@ -484,12 +500,12 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr); } mini = -1; - if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin->electrum == 0,utxos,m,targetval)) >= 0 && (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) + if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,utxos,m,targetval)) >= 0 && (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) { up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; - if ( (mini= LP_nearest_utxovalue(coin->electrum == 0,utxos,m,targetval2 * 1.01)) >= 0 ) + if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) { if ( up != 0 && (up2= utxos[mini]) != 0 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 6b5ce26ba..5916b14b9 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -302,9 +302,37 @@ bits256 validate_merkle(int32_t pos,bits256 txid,cJSON *proofarray,int32_t proof return(hash); } +int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 txid,int32_t height) +{ + cJSON *merkobj,*merkles,*hdrobj; bits256 roothash,merkleroot; int32_t m,SPV = 0; + if ( (merkobj= electrum_getmerkle(coin->symbol,ep,&merkobj,txid,height)) != 0 ) + { + char str[65],str2[65],str3[65]; + SPV = -1; + memset(roothash.bytes,0,sizeof(roothash)); + if ( (merkles= jarray(&m,merkobj,"merkle")) != 0 ) + { + roothash = validate_merkle(jint(merkobj,"pos"),txid,merkles,m); + if ( (hdrobj= electrum_getheader(coin->symbol,ep,&hdrobj,height)) != 0 ) + { + merkleroot = jbits256(hdrobj,"merkle_root"); + if ( bits256_cmp(merkleroot,roothash) == 0 ) + { + SPV = height; + //printf("validated MERK %s ht.%d -> %s root.(%s)\n",bits256_str(str,up->U.txid),up->U.height,jprint(merkobj,0),bits256_str(str2,roothash)); + } + else printf("ERROR MERK %s ht.%d -> %s root.(%s) vs %s\n",bits256_str(str,txid),height,jprint(merkobj,0),bits256_str(str2,roothash),bits256_str(str3,merkleroot)); + free_json(hdrobj); + } + } + free_json(merkobj); + } + return(SPV); +} + cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret) { - cJSON *array,*item,*merkobj,*merkles,*hdrobj; int32_t n,m; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; bits256 merkleroot,roothash; struct electrum_info *ep,*backupep=0; + cJSON *array,*item; int32_t n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; struct electrum_info *ep,*backupep=0; array = cJSON_CreateArray(); if ( coinaddr != 0 && coinaddr[0] != 0 ) { @@ -321,30 +349,8 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum { if ( up->spendheight <= 0 && up->U.height > 0 ) { - if ( ep != 0 && up->SPV == 0 && up->U.height > 0 ) - { - if ( (merkobj= electrum_getmerkle(coin->symbol,backupep,&merkobj,up->U.txid,up->U.height)) != 0 ) - { - char str[65],str2[65],str3[65]; - memset(roothash.bytes,0,sizeof(roothash)); - if ( (merkles= jarray(&m,merkobj,"merkle")) != 0 ) - { - roothash = validate_merkle(jint(merkobj,"pos"),up->U.txid,merkles,m); - if ( (hdrobj= electrum_getheader(coin->symbol,backupep,&hdrobj,up->U.height)) != 0 ) - { - merkleroot = jbits256(hdrobj,"merkle_root"); - if ( bits256_cmp(merkleroot,roothash) == 0 ) - { - up->SPV = up->U.height; - //printf("validated MERK %s ht.%d -> %s root.(%s)\n",bits256_str(str,up->U.txid),up->U.height,jprint(merkobj,0),bits256_str(str2,roothash)); - } - else printf("ERROR MERK %s ht.%d -> %s root.(%s) vs %s\n",bits256_str(str,up->U.txid),up->U.height,jprint(merkobj,0),bits256_str(str2,roothash),bits256_str(str3,merkleroot)); - free_json(hdrobj); - } - } - free_json(merkobj); - } - } + if ( backupep != 0 && up->SPV == 0 ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); jaddi(array,LP_address_item(coin,up,electrumret)); n++; total += up->U.value; From 4bfdef2451dc6de80cad1d000f0616d975d6c3cb Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Oct 2017 19:14:49 +0300 Subject: [PATCH 020/346] Fix mintxfee --- iguana/exchanges/LP_coins.c | 3 ++- iguana/exchanges/LP_swap.c | 2 +- iguana/exchanges/LP_transaction.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index e1eca4ab0..627cbbe2a 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -280,7 +280,8 @@ int32_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asset coin->taddr = taddr; coin->wiftaddr = wiftaddr; coin->longestchain = longestchain; - coin->txfee = txfee; + if ( (coin->txfee= txfee) > 0 && txfee < LP_MIN_TXFEE ) + coin->txfee = LP_MIN_TXFEE; coin->pubtype = pubtype; coin->p2shtype = p2shtype; coin->wiftype = wiftype; diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 5ee3d4b6b..22bf882aa 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -584,7 +584,7 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba txfee = swap->I.Atxfee; else txfee = LP_MIN_TXFEE; } - if ( j64bits(vout,"satoshis") >= rawtx->I.amount && (skey= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(skey,"hex")) != 0 ) + if ( j64bits(vout,"satoshis") >= rawtx->I.amount+txfee && (skey= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(skey,"hex")) != 0 ) { if ( (hexlen= (int32_t)strlen(hexstr) >> 1) < sizeof(rawtx->spendscript) ) { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 2c8bcff35..3766b3936 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -551,6 +551,8 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,void *ctx,bits256 privkey,bits256 *privkey2p,uint8_t *redeemscript,int32_t redeemlen,uint8_t *userdata,int32_t userdatalen,bits256 utxotxid,int32_t vout,char *destaddr,uint8_t *pubkey33,int32_t finalseqid,uint32_t expiration,int64_t *destamountp,uint64_t satoshis,char *changeaddr,char *vinaddr,int32_t suppress_pubkeys) { char *rawtxbytes=0,*signedtx=0,str[65],tmpaddr[64],hexstr[999],wifstr[128],_destaddr[64]; uint8_t spendscript[512],addrtype,rmd160[20]; cJSON *txobj,*vins,*obj,*vouts,*item,*privkeys; int32_t completed,spendlen,n,ignore_cltverr=1; struct vin_info V[2]; uint32_t timestamp,locktime = 0,sequenceid = 0xffffffff * finalseqid; bits256 txid; uint64_t value=0,change = 0; struct iguana_msgtx msgtx; struct iguana_info *coin; + if ( txfee > 0 && txfee < 10000 ) + txfee = 10000; *destamountp = 0; memset(signedtxidp,0,sizeof(*signedtxidp)); if ( finalseqid == 0 ) From 27533473d33f8328155cec14cf469c89584aa287 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 11 Oct 2017 05:59:38 +0300 Subject: [PATCH 021/346] Remove need for win to call curl --- iguana/exchanges/LP_nativeDEX.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 3e1189b98..95d382d12 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -21,7 +21,7 @@ // // SPV at tx level and limit SPV proofing - +// coins file // stats, fix pricearray // sign packets // dPoW security @@ -653,6 +653,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu portable_mutex_init(&LP_messagemutex); portable_mutex_init(&LP_portfoliomutex); portable_mutex_init(&LP_butxomutex); +#ifndef _WIN32 if ( system("curl -s4 checkip.amazonaws.com > DB/myipaddr") == 0 ) { char ipfname[64]; @@ -665,6 +666,9 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu strcpy(LP_myipaddr,myipaddr); } else printf("error getting myipaddr\n"); } else printf("error issuing curl\n"); +#else + myipaddr = clonestr("127.0.0.1"); +#endif if ( IAMLP != 0 ) { pubsock = -1; From 2d429835718297121ad27c209bec69c149874561 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 11 Oct 2017 06:11:09 +0300 Subject: [PATCH 022/346] Test --- iguana/exchanges/LP_nativeDEX.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 95d382d12..c1b456048 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -595,7 +595,7 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybusport,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson) { - char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128]; void *ctx = bitcoin_ctx(); + char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); LP_showwif = juint(argjson,"wif"); if ( passphrase == 0 || passphrase[0] == 0 ) { @@ -701,7 +701,23 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu //LP_deadman_switch = (uint32_t)time(NULL); printf("canbind.%d my command address is (%s) pullsock.%d pullport.%u\n",LP_canbind,pushaddr,LP_mypullsock,mypullport); printf("initcoins\n"); - LP_initcoins(ctx,pubsock,jobj(argjson,"coins")); + if ( (coinsjson= jobj(argjson,"coins")) == 0 ) + { + if ( (coins_str= OS_filestr(&filesize,"coins")) != 0 ) + { + unstringify(coins_str); + printf("UNSTRINGIFIED.(%s)\n",coins_str); + coinsjson = cJSON_Parse(coins_str); + free(coins_str); + // yes I know this coinsjson is not freed, not sure about if it is referenced + } + } + if ( coinsjson == 0 ) + { + printf("no coins object or coins file, must abort\n"); + exit(-1); + } + LP_initcoins(ctx,pubsock,coinsjson); G.waiting = 1; LP_passphrase_init(passphrase,jstr(argjson,"gui")); if ( IAMLP != 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_psockloop,(void *)&myipaddr) != 0 ) From d0b96776e8efe3658eda22824e58484de2b057e6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 11 Oct 2017 06:14:22 +0300 Subject: [PATCH 023/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index c1b456048..b418d6af8 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -703,7 +703,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu printf("initcoins\n"); if ( (coinsjson= jobj(argjson,"coins")) == 0 ) { - if ( (coins_str= OS_filestr(&filesize,"coins")) != 0 ) + if ( (coins_str= OS_filestr(&filesize,"coins.json")) != 0 ) { unstringify(coins_str); printf("UNSTRINGIFIED.(%s)\n",coins_str); From e56fa4c798ec6884a8e89f5836a4c59a3079adb8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 11 Oct 2017 06:19:38 +0300 Subject: [PATCH 024/346] coins.json support the logic is if there is no coins object in the command line json, it will look for a file called coins.json in the same directory as the executable in unix and osx that is one dir above so I copied the coins file to ../coins.json then edit it to remove the inital shell script definition and the "" around the [] internally i call unstringify to remove all the backslashes, so basically the same file contents as coins can be used --- iguana/exchanges/LP_nativeDEX.c | 1 - 1 file changed, 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index b418d6af8..3126fc07e 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -700,7 +700,6 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu LP_mybussock = LP_coinbus(mybusport); //LP_deadman_switch = (uint32_t)time(NULL); printf("canbind.%d my command address is (%s) pullsock.%d pullport.%u\n",LP_canbind,pushaddr,LP_mypullsock,mypullport); - printf("initcoins\n"); if ( (coinsjson= jobj(argjson,"coins")) == 0 ) { if ( (coins_str= OS_filestr(&filesize,"coins.json")) != 0 ) From 8fb6fa334f0ab327e6d8b533507628d4a2cc541d Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 11 Oct 2017 06:37:56 +0300 Subject: [PATCH 025/346] Install script to handle coins.json --- iguana/exchanges/install | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/install b/iguana/exchanges/install index 3f64033f1..4695b8e3a 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,6 @@ #!/bin/bash cp balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices getutxos help inv setprice status utxos ../dexscripts +cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass . #echo you will need to have a passphrase file with your passphrase and userpass file with userpass value in dexscripts dir From 044072757b98c6e35b742fe3f2b163f0afb0292c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 13:04:32 +0300 Subject: [PATCH 026/346] Disable filesystem get --- iguana/exchanges/stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 81562a46c..a118f296a 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -337,7 +337,7 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po return(clonestr("{\"error\":\"cant find index7779\"}")); else return(filestr); } - else if ( (filestr= OS_filestr(&filesize,furl)) != 0 ) + /*else if ( (filestr= OS_filestr(&filesize,furl)) != 0 ) { *jsonflagp = 1; for (i=(int32_t)strlen(url)-1; i>0; i--) @@ -347,7 +347,7 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po strcpy(filetype,url+i+1); //printf("return filetype.(%s) size.%ld\n",filetype,filesize); return(filestr); - } + }*/ if ( strncmp(&url[i],"/api",strlen("/api")) == 0 ) { *jsonflagp = 1; From e46fbea7deefe305bb9dbfcb4b239f9a58263e25 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:03:15 +0300 Subject: [PATCH 027/346] Test --- iguana/exchanges/LP_remember.c | 4 ++-- iguana/exchanges/stats.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index ee91914bf..2076d00f4 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1089,10 +1089,10 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) array = cJSON_CreateArray(); if ( origrequestid != 0 && origquoteid != 0 ) { - //printf("orig req.%u q.%u\n",origrequestid,origquoteid); + printf("orig req.%u q.%u\n",origrequestid,origquoteid); if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 ) jaddi(array,item); - //printf("got.(%s)\n",jprint(item,0)); + printf("got.(%s)\n",jprint(item,0)); } else { diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index a118f296a..c946dbc89 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -337,7 +337,7 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po return(clonestr("{\"error\":\"cant find index7779\"}")); else return(filestr); } - /*else if ( (filestr= OS_filestr(&filesize,furl)) != 0 ) + /*else if ( (filestr= OS_filestr(&filesize,furl)) != 0 ) allows arbitrary file access! { *jsonflagp = 1; for (i=(int32_t)strlen(url)-1; i>0; i--) From 321ead49f0f9dda47bc68eb5a2d9df1aaeb02b84 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:13:04 +0300 Subject: [PATCH 028/346] Test --- iguana/exchanges/LP_transaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 3766b3936..feeefb815 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -41,6 +41,7 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi memset(&txid,0,sizeof(txid)); for (i=0; i<2; i++) { + char str[65]; printf("LP_broadcast.%d %s %s i.%d sentflag.%d\n",i,symbol,bits256_str(str,expectedtxid),i,sentflag); if ( sentflag == 0 && LP_gettx_presence(symbol,expectedtxid) != 0 ) sentflag = 1; if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes)) != 0 ) @@ -63,6 +64,7 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi txid = expectedtxid; sentflag = 1; } + else printf("broadcast error.(%s)\n",retstr); } free_json(retjson); } From e7ae329967e4291109c138ec6497695d2f7954e8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:13:50 +0300 Subject: [PATCH 029/346] Test --- iguana/exchanges/LP_nativeDEX.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 3126fc07e..981a65e20 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -509,7 +509,8 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int coin->lastscanht = coin->firstscanht; continue; } - printf("%s ref.%d scan.%d to %d, longest.%d\n",coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); + if ( (coin->lastscanht % 1000) == 0 ) + printf("%s ref.%d scan.%d to %d, longest.%d\n",coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); if ( LP_blockinit(coin,coin->lastscanht) < 0 ) { printf("blockinit.%s %d error\n",coin->symbol,coin->lastscanht); From eb684c9fba672a374c6fa26a48ee539daaf14cce Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:22:15 +0300 Subject: [PATCH 030/346] Test --- iguana/exchanges/LP_transaction.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index feeefb815..088553bc0 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -37,8 +37,18 @@ int32_t LP_gettx_presence(char *symbol,bits256 expectedtxid) bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxid) { - char *retstr; bits256 txid; cJSON *retjson,*errorobj; int32_t i,sentflag = 0; + char *retstr; bits256 txid; uint8_t *ptr; cJSON *retjson,*errorobj; int32_t i,len,sentflag = 0; memset(&txid,0,sizeof(txid)); + if ( txbytes == 0 || txbytes[0] == 0 ) + return(txid); + if ( bits256_nonz(expectedtxid) == 0 ) + { + len = (int32_t)strlen(txbytes) >> 1; + ptr = malloc(len); + decode_hex(ptr,len,txbytes); + expectedtxid = bits256_doublesha256(0,ptr,len); + free(ptr); + } for (i=0; i<2; i++) { char str[65]; printf("LP_broadcast.%d %s %s i.%d sentflag.%d\n",i,symbol,bits256_str(str,expectedtxid),i,sentflag); @@ -46,6 +56,7 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi sentflag = 1; if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes)) != 0 ) { + printf("retstr.(%s)\n",retstr); if ( is_hexstr(retstr,0) == 64 ) { decode_hex(txid.bytes,32,retstr); From 323ff895a87edfca176c5c02e3fffc661469ef4a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:26:15 +0300 Subject: [PATCH 031/346] Test --- iguana/exchanges/LP_remember.c | 2 +- iguana/exchanges/LP_transaction.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 2076d00f4..eec276d4f 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -828,7 +828,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( alice->inactive != 0 || bob->inactive != 0 ) { printf("Alice.%s inactive.%u or Bob.%s inactive.%u\n",rswap.alicecoin,alice->inactive,rswap.bobcoin,bob->inactive); - return(0); + return(cJSON_Parse("{\"error\":\"inactive bob or alice coin\"}")); } LP_rswap_checktx(&rswap,rswap.alicecoin,BASILISK_ALICEPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBPAYMENT); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 088553bc0..6961fe7e2 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -81,7 +81,8 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi } char str[65]; printf("sentflag.%d [%s] %s RETSTR.(%s) %s.%s\n",sentflag,txname,txbytes,retstr,symbol,bits256_str(str,txid)); free(retstr); - } + } else if ( sentflag == 0 ) + printf("null retstr\n"); if ( sentflag != 0 ) break; sleep(3); From 36e4d994699967310ee9a693f0c06cbcc33b31a0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:28:23 +0300 Subject: [PATCH 032/346] Test --- iguana/exchanges/LP_rpc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index c612cfa3f..e8d24761c 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -602,17 +602,23 @@ char *LP_sendrawtransaction(char *symbol,char *signedtx) { cJSON *array,*errobj; char *paramstr,*tmpstr,*retstr=0; int32_t n,alreadyflag = 0; cJSON *retjson; struct iguana_info *coin; if ( symbol == 0 || symbol[0] == 0 ) + { + printf("LP_sendrawtransaction null symbol\n"); return(0); + } coin = LP_coinfind(symbol); if ( coin == 0 ) + { + printf("LP_sendrawtransaction null coin\n"); return(0); + } if ( coin->electrum == 0 ) { array = cJSON_CreateArray(); jaddistr(array,signedtx); paramstr = jprint(array,1); retstr = bitcoind_passthru(symbol,coin->serverport,coin->userpass,"sendrawtransaction",paramstr); - //printf(">>>>>>>>>>> %s dpow_sendrawtransaction.(%s) -> (%s)\n",coin->symbol,paramstr,retstr); + printf(">>>>>>>>>>> %s dpow_sendrawtransaction.(%s) -> (%s)\n",coin->symbol,paramstr,retstr); free(paramstr); } else From 3e85468b321b607bba2f11e260e80681330f729f Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:30:45 +0300 Subject: [PATCH 033/346] Test --- iguana/exchanges/LP_remember.c | 2 +- iguana/exchanges/LP_transaction.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index eec276d4f..f5812c7dd 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -735,7 +735,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) return(rswap->finishedflag); } -void LP_txbytes_update(char *symbol,char *name,char *txbytes,bits256 *txidp,bits256 *ptr,int32_t *flagp) +void LP_txbytes_update(char *name,char *symbol,char *txbytes,bits256 *txidp,bits256 *ptr,int32_t *flagp) { bits256 zero; memset(zero.bytes,0,sizeof(zero)); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 6961fe7e2..67a2b979c 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -51,7 +51,7 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi } for (i=0; i<2; i++) { - char str[65]; printf("LP_broadcast.%d %s %s i.%d sentflag.%d\n",i,symbol,bits256_str(str,expectedtxid),i,sentflag); + char str[65]; printf("LP_broadcast.%d (%s) %s i.%d sentflag.%d\n",i,symbol,bits256_str(str,expectedtxid),i,sentflag); if ( sentflag == 0 && LP_gettx_presence(symbol,expectedtxid) != 0 ) sentflag = 1; if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes)) != 0 ) From 0552ee5ad2ba28720fbd1344c91d23cbcab27b7a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 15:32:30 +0300 Subject: [PATCH 034/346] Test --- iguana/exchanges/LP_transaction.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 67a2b979c..08fd99eb1 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -51,12 +51,11 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi } for (i=0; i<2; i++) { - char str[65]; printf("LP_broadcast.%d (%s) %s i.%d sentflag.%d\n",i,symbol,bits256_str(str,expectedtxid),i,sentflag); + //char str[65]; printf("LP_broadcast.%d (%s) %s i.%d sentflag.%d\n",i,symbol,bits256_str(str,expectedtxid),i,sentflag); if ( sentflag == 0 && LP_gettx_presence(symbol,expectedtxid) != 0 ) sentflag = 1; if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes)) != 0 ) { - printf("retstr.(%s)\n",retstr); if ( is_hexstr(retstr,0) == 64 ) { decode_hex(txid.bytes,32,retstr); @@ -79,10 +78,9 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi } free_json(retjson); } - char str[65]; printf("sentflag.%d [%s] %s RETSTR.(%s) %s.%s\n",sentflag,txname,txbytes,retstr,symbol,bits256_str(str,txid)); + //char str[65]; printf("sentflag.%d [%s] %s RETSTR.(%s) %s.%s\n",sentflag,txname,txbytes,retstr,symbol,bits256_str(str,txid)); free(retstr); - } else if ( sentflag == 0 ) - printf("null retstr\n"); + } if ( sentflag != 0 ) break; sleep(3); From 87b1cbd3198277fdba9a9fd501c8d1339d8bfaa8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 16:09:38 +0300 Subject: [PATCH 035/346] Test --- iguana/exchanges/LP_remember.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index f5812c7dd..f34f92c43 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -266,21 +266,21 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag sentflags[utxoind] = 1; if ( aliceaddr != 0 && strcmp(destaddr,aliceaddr) == 0 ) { - //printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); + printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); sentflags[alicespent] = 1; sentflags[bobspent] = 0; txids[alicespent] = spendtxid; } else if ( bobaddr != 0 && strcmp(destaddr,bobaddr) == 0 ) { - //printf("BOB spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); + printf("BOB spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); sentflags[bobspent] = 1; sentflags[alicespent] = 0; txids[bobspent] = spendtxid; } else { - //printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); + printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); if ( aliceaddr != 0 ) { sentflags[bobspent] = 1; From a20a82e21ce132325a73559593044b3c5d80e0b3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 16:17:17 +0300 Subject: [PATCH 036/346] Json files --- .gitignore | 1 - iguana/exchanges/coins.json | 3 +++ iguana/help/InstantDEX_DEXratio.json | 1 + iguana/help/InstantDEX_accept.json | 1 + iguana/help/InstantDEX_allcoins.json | 1 + iguana/help/InstantDEX_allexchanges.json | 1 + iguana/help/InstantDEX_allpairs.json | 1 + iguana/help/InstantDEX_apikeypair.json | 1 + iguana/help/InstantDEX_automatched.json | 1 + iguana/help/InstantDEX_available.json | 1 + iguana/help/InstantDEX_balance.json | 1 + iguana/help/InstantDEX_buy.json | 1 + iguana/help/InstantDEX_cancelorder.json | 1 + iguana/help/InstantDEX_getswaplist.json | 1 + iguana/help/InstantDEX_incoming.json | 1 + iguana/help/InstantDEX_init.json | 1 + iguana/help/InstantDEX_openorders.json | 1 + iguana/help/InstantDEX_orderbook.json | 1 + iguana/help/InstantDEX_orderstatus.json | 1 + iguana/help/InstantDEX_pollgap.json | 1 + iguana/help/InstantDEX_request.json | 1 + iguana/help/InstantDEX_sell.json | 1 + iguana/help/InstantDEX_setuserid.json | 1 + iguana/help/InstantDEX_smartaddress.json | 1 + iguana/help/InstantDEX_smartaddresses.json | 1 + iguana/help/InstantDEX_supports.json | 1 + iguana/help/InstantDEX_tradehistory.json | 1 + iguana/help/InstantDEX_withdraw.json | 1 + iguana/help/SuperNET_activehandle.json | 1 + iguana/help/SuperNET_addr2rmd160.json | 1 + iguana/help/SuperNET_bitcoinrpc.json | 1 + iguana/help/SuperNET_broadcastcipher.json | 1 + iguana/help/SuperNET_broadcastdecipher.json | 1 + iguana/help/SuperNET_cipher.json | 1 + iguana/help/SuperNET_decipher.json | 1 + iguana/help/SuperNET_decryptjson.json | 1 + iguana/help/SuperNET_encryptjson.json | 1 + iguana/help/SuperNET_getpeers.json | 1 + iguana/help/SuperNET_help.json | 1 + iguana/help/SuperNET_html.json | 1 + iguana/help/SuperNET_keypair.json | 1 + iguana/help/SuperNET_layer.json | 1 + iguana/help/SuperNET_login.json | 1 + iguana/help/SuperNET_logout.json | 1 + iguana/help/SuperNET_multicastcipher.json | 1 + iguana/help/SuperNET_multicastdecipher.json | 1 + iguana/help/SuperNET_myipaddr.json | 1 + iguana/help/SuperNET_mypeers.json | 1 + iguana/help/SuperNET_priv2pub.json | 1 + iguana/help/SuperNET_priv2wif.json | 1 + iguana/help/SuperNET_rmd160conv.json | 1 + iguana/help/SuperNET_rosetta.json | 1 + iguana/help/SuperNET_saveconf.json | 1 + iguana/help/SuperNET_setmyipaddr.json | 1 + iguana/help/SuperNET_stop.json | 1 + iguana/help/SuperNET_utc2utime.json | 1 + iguana/help/SuperNET_utime2utc.json | 1 + iguana/help/SuperNET_wif2priv.json | 1 + iguana/help/basilisk_addrelay.json | 1 + iguana/help/basilisk_balances.json | 1 + iguana/help/basilisk_cancelrefresh.json | 1 + iguana/help/basilisk_dispatch.json | 1 + iguana/help/basilisk_forward.json | 1 + iguana/help/basilisk_geckoblock.json | 1 + iguana/help/basilisk_geckoget.json | 1 + iguana/help/basilisk_geckoheaders.json | 1 + iguana/help/basilisk_geckotx.json | 1 + iguana/help/basilisk_genesis_opreturn.json | 1 + iguana/help/basilisk_getmessage.json | 1 + iguana/help/basilisk_history.json | 1 + iguana/help/basilisk_mailbox.json | 1 + iguana/help/basilisk_paxfiats.json | 1 + iguana/help/basilisk_publish.json | 1 + iguana/help/basilisk_rawtx.json | 1 + iguana/help/basilisk_refresh.json | 1 + iguana/help/basilisk_sendmessage.json | 1 + iguana/help/basilisk_subscribe.json | 1 + iguana/help/basilisk_utxocombine.json | 1 + iguana/help/basilisk_utxorawtx.json | 1 + iguana/help/basilisk_value.json | 1 + iguana/help/bitcoinrpc_addmultisigaddress.json | 1 + iguana/help/bitcoinrpc_backupwallet.json | 1 + iguana/help/bitcoinrpc_checkwallet.json | 1 + iguana/help/bitcoinrpc_createmultisig.json | 1 + iguana/help/bitcoinrpc_createrawtransaction.json | 1 + iguana/help/bitcoinrpc_decoderawtransaction.json | 1 + iguana/help/bitcoinrpc_decodescript.json | 1 + iguana/help/bitcoinrpc_dumpprivkey.json | 1 + iguana/help/bitcoinrpc_dumpwallet.json | 1 + iguana/help/bitcoinrpc_encryptwallet.json | 1 + iguana/help/bitcoinrpc_getaccount.json | 1 + iguana/help/bitcoinrpc_getaccountaddress.json | 1 + iguana/help/bitcoinrpc_getaddressesbyaccount.json | 1 + iguana/help/bitcoinrpc_getbalance.json | 1 + iguana/help/bitcoinrpc_getbestblockhash.json | 1 + iguana/help/bitcoinrpc_getblock.json | 1 + iguana/help/bitcoinrpc_getblockcount.json | 1 + iguana/help/bitcoinrpc_getblockhash.json | 1 + iguana/help/bitcoinrpc_getdifficulty.json | 1 + iguana/help/bitcoinrpc_getinfo.json | 1 + iguana/help/bitcoinrpc_getnewaddress.json | 1 + iguana/help/bitcoinrpc_getrawchangeaddress.json | 1 + iguana/help/bitcoinrpc_getrawtransaction.json | 1 + iguana/help/bitcoinrpc_getreceivedbyaccount.json | 1 + iguana/help/bitcoinrpc_getreceivedbyaddress.json | 1 + iguana/help/bitcoinrpc_gettransaction.json | 1 + iguana/help/bitcoinrpc_gettxout.json | 1 + iguana/help/bitcoinrpc_gettxoutsetinfo.json | 1 + iguana/help/bitcoinrpc_importaddress.json | 1 + iguana/help/bitcoinrpc_importprivkey.json | 1 + iguana/help/bitcoinrpc_importwallet.json | 1 + iguana/help/bitcoinrpc_listaccounts.json | 1 + iguana/help/bitcoinrpc_listaddressgroupings.json | 1 + iguana/help/bitcoinrpc_listlockunspent.json | 1 + iguana/help/bitcoinrpc_listreceivedbyaccount.json | 1 + iguana/help/bitcoinrpc_listreceivedbyaddress.json | 1 + iguana/help/bitcoinrpc_listsinceblock.json | 1 + iguana/help/bitcoinrpc_listtransactions.json | 1 + iguana/help/bitcoinrpc_listunspent.json | 1 + iguana/help/bitcoinrpc_lockunspent.json | 1 + iguana/help/bitcoinrpc_move.json | 1 + iguana/help/bitcoinrpc_repairwallet.json | 1 + iguana/help/bitcoinrpc_sendfrom.json | 1 + iguana/help/bitcoinrpc_sendmany.json | 1 + iguana/help/bitcoinrpc_sendrawtransaction.json | 1 + iguana/help/bitcoinrpc_sendtoaddress.json | 1 + iguana/help/bitcoinrpc_setaccount.json | 1 + iguana/help/bitcoinrpc_settxfee.json | 1 + iguana/help/bitcoinrpc_signmessage.json | 1 + iguana/help/bitcoinrpc_signrawtransaction.json | 1 + iguana/help/bitcoinrpc_submitblock.json | 1 + iguana/help/bitcoinrpc_validateaddress.json | 1 + iguana/help/bitcoinrpc_validatepubkey.json | 1 + iguana/help/bitcoinrpc_validaterawtransaction.json | 1 + iguana/help/bitcoinrpc_verifymessage.json | 1 + iguana/help/bitcoinrpc_walletlock.json | 1 + iguana/help/bitcoinrpc_walletpassphrase.json | 1 + iguana/help/bitcoinrpc_walletpassphrasechange.json | 1 + iguana/help/dex_alladdresses.json | 1 + iguana/help/dex_checkaddress.json | 1 + iguana/help/dex_explorer.json | 1 + iguana/help/dex_getbalance.json | 1 + iguana/help/dex_getbestblockhash.json | 1 + iguana/help/dex_getblock.json | 1 + iguana/help/dex_getblockhash.json | 1 + iguana/help/dex_getinfo.json | 1 + iguana/help/dex_getmessage.json | 1 + iguana/help/dex_getnotaries.json | 1 + iguana/help/dex_gettransaction.json | 1 + iguana/help/dex_gettxin.json | 1 + iguana/help/dex_gettxout.json | 1 + iguana/help/dex_importaddress.json | 1 + iguana/help/dex_kvsearch.json | 1 + iguana/help/dex_kvupdate.json | 1 + iguana/help/dex_listspent.json | 1 + iguana/help/dex_listtransactions.json | 1 + iguana/help/dex_listtransactions2.json | 1 + iguana/help/dex_listunspent.json | 1 + iguana/help/dex_listunspent2.json | 1 + iguana/help/dex_psock.json | 1 + iguana/help/dex_send.json | 1 + iguana/help/dex_sendrawtransaction.json | 1 + iguana/help/dex_validateaddress.json | 1 + iguana/help/dpow_active.json | 1 + iguana/help/dpow_bindaddr.json | 1 + iguana/help/dpow_cancelratify.json | 1 + iguana/help/dpow_fundnotaries.json | 1 + iguana/help/dpow_notarychains.json | 1 + iguana/help/dpow_pending.json | 1 + iguana/help/dpow_ratify.json | 1 + iguana/help/hash_NXT.json | 1 + iguana/help/hash_base64_decode.json | 1 + iguana/help/hash_base64_encode.json | 1 + iguana/help/hash_crc32.json | 1 + iguana/help/hash_curve25519.json | 1 + iguana/help/hash_curve25519_pair.json | 1 + iguana/help/hash_hex.json | 1 + iguana/help/hash_md2.json | 1 + iguana/help/hash_md4.json | 1 + iguana/help/hash_md5.json | 1 + iguana/help/hash_rmd128.json | 1 + iguana/help/hash_rmd160.json | 1 + iguana/help/hash_rmd160_sha256.json | 1 + iguana/help/hash_rmd256.json | 1 + iguana/help/hash_rmd320.json | 1 + iguana/help/hash_sha1.json | 1 + iguana/help/hash_sha224.json | 1 + iguana/help/hash_sha256.json | 1 + iguana/help/hash_sha256_sha256.json | 1 + iguana/help/hash_sha384.json | 1 + iguana/help/hash_sha512.json | 1 + iguana/help/hash_tiger192_3.json | 1 + iguana/help/hash_unhex.json | 1 + iguana/help/hash_whirlpool.json | 1 + iguana/help/hmac_md2.json | 1 + iguana/help/hmac_md4.json | 1 + iguana/help/hmac_md5.json | 1 + iguana/help/hmac_rmd128.json | 1 + iguana/help/hmac_rmd160.json | 1 + iguana/help/hmac_rmd256.json | 1 + iguana/help/hmac_rmd320.json | 1 + iguana/help/hmac_sha1.json | 1 + iguana/help/hmac_sha224.json | 1 + iguana/help/hmac_sha256.json | 1 + iguana/help/hmac_sha384.json | 1 + iguana/help/hmac_sha512.json | 1 + iguana/help/hmac_tiger192_3.json | 1 + iguana/help/hmac_whirlpool.json | 1 + iguana/help/iguana_PoSweights.json | 1 + iguana/help/iguana_addcoin.json | 1 + iguana/help/iguana_addnode.json | 1 + iguana/help/iguana_addnotary.json | 1 + iguana/help/iguana_balance.json | 1 + iguana/help/iguana_bundleaddresses.json | 1 + iguana/help/iguana_bundlehashes.json | 1 + iguana/help/iguana_dividends.json | 1 + iguana/help/iguana_dpow.json | 1 + iguana/help/iguana_getconnectioncount.json | 1 + iguana/help/iguana_initfastfind.json | 1 + iguana/help/iguana_makekeypair.json | 1 + iguana/help/iguana_maxpeers.json | 1 + iguana/help/iguana_nodestatus.json | 1 + iguana/help/iguana_oneshot.json | 1 + iguana/help/iguana_passthru.json | 1 + iguana/help/iguana_pausecoin.json | 1 + iguana/help/iguana_peers.json | 1 + iguana/help/iguana_persistent.json | 1 + iguana/help/iguana_prices.json | 1 + iguana/help/iguana_rate.json | 1 + iguana/help/iguana_rates.json | 1 + iguana/help/iguana_removecoin.json | 1 + iguana/help/iguana_removenode.json | 1 + iguana/help/iguana_snapshot.json | 1 + iguana/help/iguana_spendmsig.json | 1 + iguana/help/iguana_splitfunds.json | 1 + iguana/help/iguana_stakers.json | 1 + iguana/help/iguana_startcoin.json | 1 + iguana/help/iguana_stopcoin.json | 1 + iguana/help/iguana_validate.json | 1 + iguana/help/jumblr_runsilent.json | 1 + iguana/help/jumblr_setpassphrase.json | 1 + iguana/help/jumblr_status.json | 1 + iguana/help/jumblr_totransparent.json | 1 + iguana/help/keyboard_key.json | 1 + iguana/help/komodo_passthru.json | 1 + iguana/help/mouse_change.json | 1 + iguana/help/mouse_click.json | 1 + iguana/help/mouse_close.json | 1 + iguana/help/mouse_image.json | 1 + iguana/help/mouse_leave.json | 1 + iguana/help/passthru_paxfiats.json | 1 + iguana/help/pax_start.json | 1 + iguana/help/tradebot_accumulate.json | 1 + iguana/help/tradebot_activebots.json | 1 + iguana/help/tradebot_allbalances.json | 1 + iguana/help/tradebot_amlp.json | 1 + iguana/help/tradebot_anchor.json | 1 + iguana/help/tradebot_aveprice.json | 1 + iguana/help/tradebot_divest.json | 1 + iguana/help/tradebot_gensvm.json | 1 + iguana/help/tradebot_goals.json | 1 + iguana/help/tradebot_liquidity.json | 1 + iguana/help/tradebot_monitor.json | 1 + iguana/help/tradebot_monitorall.json | 1 + iguana/help/tradebot_notlp.json | 1 + iguana/help/tradebot_openliquidity.json | 1 + iguana/help/tradebot_pause.json | 1 + iguana/help/tradebot_portfolio.json | 1 + iguana/help/tradebot_resume.json | 1 + iguana/help/tradebot_status.json | 1 + iguana/help/tradebot_stop.json | 1 + iguana/help/tradebot_unmonitor.json | 1 + iguana/help/zcash_passthru.json | 1 + 273 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 iguana/exchanges/coins.json create mode 100644 iguana/help/InstantDEX_DEXratio.json create mode 100644 iguana/help/InstantDEX_accept.json create mode 100644 iguana/help/InstantDEX_allcoins.json create mode 100644 iguana/help/InstantDEX_allexchanges.json create mode 100644 iguana/help/InstantDEX_allpairs.json create mode 100644 iguana/help/InstantDEX_apikeypair.json create mode 100644 iguana/help/InstantDEX_automatched.json create mode 100644 iguana/help/InstantDEX_available.json create mode 100644 iguana/help/InstantDEX_balance.json create mode 100644 iguana/help/InstantDEX_buy.json create mode 100644 iguana/help/InstantDEX_cancelorder.json create mode 100644 iguana/help/InstantDEX_getswaplist.json create mode 100644 iguana/help/InstantDEX_incoming.json create mode 100644 iguana/help/InstantDEX_init.json create mode 100644 iguana/help/InstantDEX_openorders.json create mode 100644 iguana/help/InstantDEX_orderbook.json create mode 100644 iguana/help/InstantDEX_orderstatus.json create mode 100644 iguana/help/InstantDEX_pollgap.json create mode 100644 iguana/help/InstantDEX_request.json create mode 100644 iguana/help/InstantDEX_sell.json create mode 100644 iguana/help/InstantDEX_setuserid.json create mode 100644 iguana/help/InstantDEX_smartaddress.json create mode 100644 iguana/help/InstantDEX_smartaddresses.json create mode 100644 iguana/help/InstantDEX_supports.json create mode 100644 iguana/help/InstantDEX_tradehistory.json create mode 100644 iguana/help/InstantDEX_withdraw.json create mode 100644 iguana/help/SuperNET_activehandle.json create mode 100644 iguana/help/SuperNET_addr2rmd160.json create mode 100644 iguana/help/SuperNET_bitcoinrpc.json create mode 100644 iguana/help/SuperNET_broadcastcipher.json create mode 100644 iguana/help/SuperNET_broadcastdecipher.json create mode 100644 iguana/help/SuperNET_cipher.json create mode 100644 iguana/help/SuperNET_decipher.json create mode 100644 iguana/help/SuperNET_decryptjson.json create mode 100644 iguana/help/SuperNET_encryptjson.json create mode 100644 iguana/help/SuperNET_getpeers.json create mode 100644 iguana/help/SuperNET_help.json create mode 100644 iguana/help/SuperNET_html.json create mode 100644 iguana/help/SuperNET_keypair.json create mode 100644 iguana/help/SuperNET_layer.json create mode 100644 iguana/help/SuperNET_login.json create mode 100644 iguana/help/SuperNET_logout.json create mode 100644 iguana/help/SuperNET_multicastcipher.json create mode 100644 iguana/help/SuperNET_multicastdecipher.json create mode 100644 iguana/help/SuperNET_myipaddr.json create mode 100644 iguana/help/SuperNET_mypeers.json create mode 100644 iguana/help/SuperNET_priv2pub.json create mode 100644 iguana/help/SuperNET_priv2wif.json create mode 100644 iguana/help/SuperNET_rmd160conv.json create mode 100644 iguana/help/SuperNET_rosetta.json create mode 100644 iguana/help/SuperNET_saveconf.json create mode 100644 iguana/help/SuperNET_setmyipaddr.json create mode 100644 iguana/help/SuperNET_stop.json create mode 100644 iguana/help/SuperNET_utc2utime.json create mode 100644 iguana/help/SuperNET_utime2utc.json create mode 100644 iguana/help/SuperNET_wif2priv.json create mode 100644 iguana/help/basilisk_addrelay.json create mode 100644 iguana/help/basilisk_balances.json create mode 100644 iguana/help/basilisk_cancelrefresh.json create mode 100644 iguana/help/basilisk_dispatch.json create mode 100644 iguana/help/basilisk_forward.json create mode 100644 iguana/help/basilisk_geckoblock.json create mode 100644 iguana/help/basilisk_geckoget.json create mode 100644 iguana/help/basilisk_geckoheaders.json create mode 100644 iguana/help/basilisk_geckotx.json create mode 100644 iguana/help/basilisk_genesis_opreturn.json create mode 100644 iguana/help/basilisk_getmessage.json create mode 100644 iguana/help/basilisk_history.json create mode 100644 iguana/help/basilisk_mailbox.json create mode 100644 iguana/help/basilisk_paxfiats.json create mode 100644 iguana/help/basilisk_publish.json create mode 100644 iguana/help/basilisk_rawtx.json create mode 100644 iguana/help/basilisk_refresh.json create mode 100644 iguana/help/basilisk_sendmessage.json create mode 100644 iguana/help/basilisk_subscribe.json create mode 100644 iguana/help/basilisk_utxocombine.json create mode 100644 iguana/help/basilisk_utxorawtx.json create mode 100644 iguana/help/basilisk_value.json create mode 100644 iguana/help/bitcoinrpc_addmultisigaddress.json create mode 100644 iguana/help/bitcoinrpc_backupwallet.json create mode 100644 iguana/help/bitcoinrpc_checkwallet.json create mode 100644 iguana/help/bitcoinrpc_createmultisig.json create mode 100644 iguana/help/bitcoinrpc_createrawtransaction.json create mode 100644 iguana/help/bitcoinrpc_decoderawtransaction.json create mode 100644 iguana/help/bitcoinrpc_decodescript.json create mode 100644 iguana/help/bitcoinrpc_dumpprivkey.json create mode 100644 iguana/help/bitcoinrpc_dumpwallet.json create mode 100644 iguana/help/bitcoinrpc_encryptwallet.json create mode 100644 iguana/help/bitcoinrpc_getaccount.json create mode 100644 iguana/help/bitcoinrpc_getaccountaddress.json create mode 100644 iguana/help/bitcoinrpc_getaddressesbyaccount.json create mode 100644 iguana/help/bitcoinrpc_getbalance.json create mode 100644 iguana/help/bitcoinrpc_getbestblockhash.json create mode 100644 iguana/help/bitcoinrpc_getblock.json create mode 100644 iguana/help/bitcoinrpc_getblockcount.json create mode 100644 iguana/help/bitcoinrpc_getblockhash.json create mode 100644 iguana/help/bitcoinrpc_getdifficulty.json create mode 100644 iguana/help/bitcoinrpc_getinfo.json create mode 100644 iguana/help/bitcoinrpc_getnewaddress.json create mode 100644 iguana/help/bitcoinrpc_getrawchangeaddress.json create mode 100644 iguana/help/bitcoinrpc_getrawtransaction.json create mode 100644 iguana/help/bitcoinrpc_getreceivedbyaccount.json create mode 100644 iguana/help/bitcoinrpc_getreceivedbyaddress.json create mode 100644 iguana/help/bitcoinrpc_gettransaction.json create mode 100644 iguana/help/bitcoinrpc_gettxout.json create mode 100644 iguana/help/bitcoinrpc_gettxoutsetinfo.json create mode 100644 iguana/help/bitcoinrpc_importaddress.json create mode 100644 iguana/help/bitcoinrpc_importprivkey.json create mode 100644 iguana/help/bitcoinrpc_importwallet.json create mode 100644 iguana/help/bitcoinrpc_listaccounts.json create mode 100644 iguana/help/bitcoinrpc_listaddressgroupings.json create mode 100644 iguana/help/bitcoinrpc_listlockunspent.json create mode 100644 iguana/help/bitcoinrpc_listreceivedbyaccount.json create mode 100644 iguana/help/bitcoinrpc_listreceivedbyaddress.json create mode 100644 iguana/help/bitcoinrpc_listsinceblock.json create mode 100644 iguana/help/bitcoinrpc_listtransactions.json create mode 100644 iguana/help/bitcoinrpc_listunspent.json create mode 100644 iguana/help/bitcoinrpc_lockunspent.json create mode 100644 iguana/help/bitcoinrpc_move.json create mode 100644 iguana/help/bitcoinrpc_repairwallet.json create mode 100644 iguana/help/bitcoinrpc_sendfrom.json create mode 100644 iguana/help/bitcoinrpc_sendmany.json create mode 100644 iguana/help/bitcoinrpc_sendrawtransaction.json create mode 100644 iguana/help/bitcoinrpc_sendtoaddress.json create mode 100644 iguana/help/bitcoinrpc_setaccount.json create mode 100644 iguana/help/bitcoinrpc_settxfee.json create mode 100644 iguana/help/bitcoinrpc_signmessage.json create mode 100644 iguana/help/bitcoinrpc_signrawtransaction.json create mode 100644 iguana/help/bitcoinrpc_submitblock.json create mode 100644 iguana/help/bitcoinrpc_validateaddress.json create mode 100644 iguana/help/bitcoinrpc_validatepubkey.json create mode 100644 iguana/help/bitcoinrpc_validaterawtransaction.json create mode 100644 iguana/help/bitcoinrpc_verifymessage.json create mode 100644 iguana/help/bitcoinrpc_walletlock.json create mode 100644 iguana/help/bitcoinrpc_walletpassphrase.json create mode 100644 iguana/help/bitcoinrpc_walletpassphrasechange.json create mode 100644 iguana/help/dex_alladdresses.json create mode 100644 iguana/help/dex_checkaddress.json create mode 100644 iguana/help/dex_explorer.json create mode 100644 iguana/help/dex_getbalance.json create mode 100644 iguana/help/dex_getbestblockhash.json create mode 100644 iguana/help/dex_getblock.json create mode 100644 iguana/help/dex_getblockhash.json create mode 100644 iguana/help/dex_getinfo.json create mode 100644 iguana/help/dex_getmessage.json create mode 100644 iguana/help/dex_getnotaries.json create mode 100644 iguana/help/dex_gettransaction.json create mode 100644 iguana/help/dex_gettxin.json create mode 100644 iguana/help/dex_gettxout.json create mode 100644 iguana/help/dex_importaddress.json create mode 100644 iguana/help/dex_kvsearch.json create mode 100644 iguana/help/dex_kvupdate.json create mode 100644 iguana/help/dex_listspent.json create mode 100644 iguana/help/dex_listtransactions.json create mode 100644 iguana/help/dex_listtransactions2.json create mode 100644 iguana/help/dex_listunspent.json create mode 100644 iguana/help/dex_listunspent2.json create mode 100644 iguana/help/dex_psock.json create mode 100644 iguana/help/dex_send.json create mode 100644 iguana/help/dex_sendrawtransaction.json create mode 100644 iguana/help/dex_validateaddress.json create mode 100644 iguana/help/dpow_active.json create mode 100644 iguana/help/dpow_bindaddr.json create mode 100644 iguana/help/dpow_cancelratify.json create mode 100644 iguana/help/dpow_fundnotaries.json create mode 100644 iguana/help/dpow_notarychains.json create mode 100644 iguana/help/dpow_pending.json create mode 100644 iguana/help/dpow_ratify.json create mode 100644 iguana/help/hash_NXT.json create mode 100644 iguana/help/hash_base64_decode.json create mode 100644 iguana/help/hash_base64_encode.json create mode 100644 iguana/help/hash_crc32.json create mode 100644 iguana/help/hash_curve25519.json create mode 100644 iguana/help/hash_curve25519_pair.json create mode 100644 iguana/help/hash_hex.json create mode 100644 iguana/help/hash_md2.json create mode 100644 iguana/help/hash_md4.json create mode 100644 iguana/help/hash_md5.json create mode 100644 iguana/help/hash_rmd128.json create mode 100644 iguana/help/hash_rmd160.json create mode 100644 iguana/help/hash_rmd160_sha256.json create mode 100644 iguana/help/hash_rmd256.json create mode 100644 iguana/help/hash_rmd320.json create mode 100644 iguana/help/hash_sha1.json create mode 100644 iguana/help/hash_sha224.json create mode 100644 iguana/help/hash_sha256.json create mode 100644 iguana/help/hash_sha256_sha256.json create mode 100644 iguana/help/hash_sha384.json create mode 100644 iguana/help/hash_sha512.json create mode 100644 iguana/help/hash_tiger192_3.json create mode 100644 iguana/help/hash_unhex.json create mode 100644 iguana/help/hash_whirlpool.json create mode 100644 iguana/help/hmac_md2.json create mode 100644 iguana/help/hmac_md4.json create mode 100644 iguana/help/hmac_md5.json create mode 100644 iguana/help/hmac_rmd128.json create mode 100644 iguana/help/hmac_rmd160.json create mode 100644 iguana/help/hmac_rmd256.json create mode 100644 iguana/help/hmac_rmd320.json create mode 100644 iguana/help/hmac_sha1.json create mode 100644 iguana/help/hmac_sha224.json create mode 100644 iguana/help/hmac_sha256.json create mode 100644 iguana/help/hmac_sha384.json create mode 100644 iguana/help/hmac_sha512.json create mode 100644 iguana/help/hmac_tiger192_3.json create mode 100644 iguana/help/hmac_whirlpool.json create mode 100644 iguana/help/iguana_PoSweights.json create mode 100644 iguana/help/iguana_addcoin.json create mode 100644 iguana/help/iguana_addnode.json create mode 100644 iguana/help/iguana_addnotary.json create mode 100644 iguana/help/iguana_balance.json create mode 100644 iguana/help/iguana_bundleaddresses.json create mode 100644 iguana/help/iguana_bundlehashes.json create mode 100644 iguana/help/iguana_dividends.json create mode 100644 iguana/help/iguana_dpow.json create mode 100644 iguana/help/iguana_getconnectioncount.json create mode 100644 iguana/help/iguana_initfastfind.json create mode 100644 iguana/help/iguana_makekeypair.json create mode 100644 iguana/help/iguana_maxpeers.json create mode 100644 iguana/help/iguana_nodestatus.json create mode 100644 iguana/help/iguana_oneshot.json create mode 100644 iguana/help/iguana_passthru.json create mode 100644 iguana/help/iguana_pausecoin.json create mode 100644 iguana/help/iguana_peers.json create mode 100644 iguana/help/iguana_persistent.json create mode 100644 iguana/help/iguana_prices.json create mode 100644 iguana/help/iguana_rate.json create mode 100644 iguana/help/iguana_rates.json create mode 100644 iguana/help/iguana_removecoin.json create mode 100644 iguana/help/iguana_removenode.json create mode 100644 iguana/help/iguana_snapshot.json create mode 100644 iguana/help/iguana_spendmsig.json create mode 100644 iguana/help/iguana_splitfunds.json create mode 100644 iguana/help/iguana_stakers.json create mode 100644 iguana/help/iguana_startcoin.json create mode 100644 iguana/help/iguana_stopcoin.json create mode 100644 iguana/help/iguana_validate.json create mode 100644 iguana/help/jumblr_runsilent.json create mode 100644 iguana/help/jumblr_setpassphrase.json create mode 100644 iguana/help/jumblr_status.json create mode 100644 iguana/help/jumblr_totransparent.json create mode 100644 iguana/help/keyboard_key.json create mode 100644 iguana/help/komodo_passthru.json create mode 100644 iguana/help/mouse_change.json create mode 100644 iguana/help/mouse_click.json create mode 100644 iguana/help/mouse_close.json create mode 100644 iguana/help/mouse_image.json create mode 100644 iguana/help/mouse_leave.json create mode 100644 iguana/help/passthru_paxfiats.json create mode 100644 iguana/help/pax_start.json create mode 100644 iguana/help/tradebot_accumulate.json create mode 100644 iguana/help/tradebot_activebots.json create mode 100644 iguana/help/tradebot_allbalances.json create mode 100644 iguana/help/tradebot_amlp.json create mode 100644 iguana/help/tradebot_anchor.json create mode 100644 iguana/help/tradebot_aveprice.json create mode 100644 iguana/help/tradebot_divest.json create mode 100644 iguana/help/tradebot_gensvm.json create mode 100644 iguana/help/tradebot_goals.json create mode 100644 iguana/help/tradebot_liquidity.json create mode 100644 iguana/help/tradebot_monitor.json create mode 100644 iguana/help/tradebot_monitorall.json create mode 100644 iguana/help/tradebot_notlp.json create mode 100644 iguana/help/tradebot_openliquidity.json create mode 100644 iguana/help/tradebot_pause.json create mode 100644 iguana/help/tradebot_portfolio.json create mode 100644 iguana/help/tradebot_resume.json create mode 100644 iguana/help/tradebot_status.json create mode 100644 iguana/help/tradebot_stop.json create mode 100644 iguana/help/tradebot_unmonitor.json create mode 100644 iguana/help/zcash_passthru.json diff --git a/.gitignore b/.gitignore index 323798336..c2c001dd5 100755 --- a/.gitignore +++ b/.gitignore @@ -170,7 +170,6 @@ iguana/help.json iguana/index7778.html -*.json iguana/DB/KMD/utxo.dat diff --git a/iguana/exchanges/coins.json b/iguana/exchanges/coins.json new file mode 100644 index 000000000..d97e39c22 --- /dev/null +++ b/iguana/exchanges/coins.json @@ -0,0 +1,3 @@ +[{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}] + + diff --git a/iguana/help/InstantDEX_DEXratio.json b/iguana/help/InstantDEX_DEXratio.json new file mode 100644 index 000000000..cc7bbd980 --- /dev/null +++ b/iguana/help/InstantDEX_DEXratio.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"DEXratio","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_DEXratio_test.py"}]} diff --git a/iguana/help/InstantDEX_accept.json b/iguana/help/InstantDEX_accept.json new file mode 100644 index 000000000..92c1d4521 --- /dev/null +++ b/iguana/help/InstantDEX_accept.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"accept","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_accept_test.py"}]} diff --git a/iguana/help/InstantDEX_allcoins.json b/iguana/help/InstantDEX_allcoins.json new file mode 100644 index 000000000..41d3a3ac3 --- /dev/null +++ b/iguana/help/InstantDEX_allcoins.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"allcoins","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_allcoins_test.py"}]} diff --git a/iguana/help/InstantDEX_allexchanges.json b/iguana/help/InstantDEX_allexchanges.json new file mode 100644 index 000000000..1d3e588fa --- /dev/null +++ b/iguana/help/InstantDEX_allexchanges.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"allexchanges","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_allexchanges_test.py"}]} diff --git a/iguana/help/InstantDEX_allpairs.json b/iguana/help/InstantDEX_allpairs.json new file mode 100644 index 000000000..80b71c2b9 --- /dev/null +++ b/iguana/help/InstantDEX_allpairs.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"allpairs","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_allpairs_test.py"}]} diff --git a/iguana/help/InstantDEX_apikeypair.json b/iguana/help/InstantDEX_apikeypair.json new file mode 100644 index 000000000..ed6a4d911 --- /dev/null +++ b/iguana/help/InstantDEX_apikeypair.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"apikeypair","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_apikeypair_test.py"}]} diff --git a/iguana/help/InstantDEX_automatched.json b/iguana/help/InstantDEX_automatched.json new file mode 100644 index 000000000..b9626ec23 --- /dev/null +++ b/iguana/help/InstantDEX_automatched.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"automatched","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_automatched_test.py"}]} diff --git a/iguana/help/InstantDEX_available.json b/iguana/help/InstantDEX_available.json new file mode 100644 index 000000000..18ed08484 --- /dev/null +++ b/iguana/help/InstantDEX_available.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"available","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_available_test.py"}]} diff --git a/iguana/help/InstantDEX_balance.json b/iguana/help/InstantDEX_balance.json new file mode 100644 index 000000000..c70d5b99f --- /dev/null +++ b/iguana/help/InstantDEX_balance.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"balance","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_balance_test.py"}]} diff --git a/iguana/help/InstantDEX_buy.json b/iguana/help/InstantDEX_buy.json new file mode 100644 index 000000000..1c3636e07 --- /dev/null +++ b/iguana/help/InstantDEX_buy.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"buy","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_buy_test.py"}]} diff --git a/iguana/help/InstantDEX_cancelorder.json b/iguana/help/InstantDEX_cancelorder.json new file mode 100644 index 000000000..ea397f36d --- /dev/null +++ b/iguana/help/InstantDEX_cancelorder.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"cancelorder","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_cancelorder_test.py"}]} diff --git a/iguana/help/InstantDEX_getswaplist.json b/iguana/help/InstantDEX_getswaplist.json new file mode 100644 index 000000000..59caa393b --- /dev/null +++ b/iguana/help/InstantDEX_getswaplist.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"getswaplist","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_getswaplist_test.py"}]} diff --git a/iguana/help/InstantDEX_incoming.json b/iguana/help/InstantDEX_incoming.json new file mode 100644 index 000000000..f698f45d7 --- /dev/null +++ b/iguana/help/InstantDEX_incoming.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"incoming","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_incoming_test.py"}]} diff --git a/iguana/help/InstantDEX_init.json b/iguana/help/InstantDEX_init.json new file mode 100644 index 000000000..1caaab76f --- /dev/null +++ b/iguana/help/InstantDEX_init.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"init","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_init_test.py"}]} diff --git a/iguana/help/InstantDEX_openorders.json b/iguana/help/InstantDEX_openorders.json new file mode 100644 index 000000000..dfd406ecd --- /dev/null +++ b/iguana/help/InstantDEX_openorders.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"openorders","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_openorders_test.py"}]} diff --git a/iguana/help/InstantDEX_orderbook.json b/iguana/help/InstantDEX_orderbook.json new file mode 100644 index 000000000..beff23123 --- /dev/null +++ b/iguana/help/InstantDEX_orderbook.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"orderbook","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_orderbook_test.py"}]} diff --git a/iguana/help/InstantDEX_orderstatus.json b/iguana/help/InstantDEX_orderstatus.json new file mode 100644 index 000000000..613e54400 --- /dev/null +++ b/iguana/help/InstantDEX_orderstatus.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"orderstatus","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_orderstatus_test.py"}]} diff --git a/iguana/help/InstantDEX_pollgap.json b/iguana/help/InstantDEX_pollgap.json new file mode 100644 index 000000000..b90628331 --- /dev/null +++ b/iguana/help/InstantDEX_pollgap.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"pollgap","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_pollgap_test.py"}]} diff --git a/iguana/help/InstantDEX_request.json b/iguana/help/InstantDEX_request.json new file mode 100644 index 000000000..9dde5538e --- /dev/null +++ b/iguana/help/InstantDEX_request.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"request","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_request_test.py"}]} diff --git a/iguana/help/InstantDEX_sell.json b/iguana/help/InstantDEX_sell.json new file mode 100644 index 000000000..57a939570 --- /dev/null +++ b/iguana/help/InstantDEX_sell.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"sell","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_sell_test.py"}]} diff --git a/iguana/help/InstantDEX_setuserid.json b/iguana/help/InstantDEX_setuserid.json new file mode 100644 index 000000000..0b2dd819c --- /dev/null +++ b/iguana/help/InstantDEX_setuserid.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"setuserid","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_setuserid_test.py"}]} diff --git a/iguana/help/InstantDEX_smartaddress.json b/iguana/help/InstantDEX_smartaddress.json new file mode 100644 index 000000000..18924dca4 --- /dev/null +++ b/iguana/help/InstantDEX_smartaddress.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"smartaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_smartaddress_test.py"}]} diff --git a/iguana/help/InstantDEX_smartaddresses.json b/iguana/help/InstantDEX_smartaddresses.json new file mode 100644 index 000000000..39f3f1d20 --- /dev/null +++ b/iguana/help/InstantDEX_smartaddresses.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"smartaddresses","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_smartaddresses_test.py"}]} diff --git a/iguana/help/InstantDEX_supports.json b/iguana/help/InstantDEX_supports.json new file mode 100644 index 000000000..254fea7aa --- /dev/null +++ b/iguana/help/InstantDEX_supports.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"supports","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_supports_test.py"}]} diff --git a/iguana/help/InstantDEX_tradehistory.json b/iguana/help/InstantDEX_tradehistory.json new file mode 100644 index 000000000..5feba4639 --- /dev/null +++ b/iguana/help/InstantDEX_tradehistory.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"tradehistory","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_tradehistory_test.py"}]} diff --git a/iguana/help/InstantDEX_withdraw.json b/iguana/help/InstantDEX_withdraw.json new file mode 100644 index 000000000..45aa88599 --- /dev/null +++ b/iguana/help/InstantDEX_withdraw.json @@ -0,0 +1 @@ +{"agent":"InstantDEX","method":"withdraw","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"InstantDEX_withdraw_test.py"}]} diff --git a/iguana/help/SuperNET_activehandle.json b/iguana/help/SuperNET_activehandle.json new file mode 100644 index 000000000..1530b8c01 --- /dev/null +++ b/iguana/help/SuperNET_activehandle.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"activehandle","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_activehandle_test.py"}]} diff --git a/iguana/help/SuperNET_addr2rmd160.json b/iguana/help/SuperNET_addr2rmd160.json new file mode 100644 index 000000000..a3a40aac4 --- /dev/null +++ b/iguana/help/SuperNET_addr2rmd160.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"addr2rmd160","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_addr2rmd160_test.py"}]} diff --git a/iguana/help/SuperNET_bitcoinrpc.json b/iguana/help/SuperNET_bitcoinrpc.json new file mode 100644 index 000000000..46422d4d7 --- /dev/null +++ b/iguana/help/SuperNET_bitcoinrpc.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"bitcoinrpc","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_bitcoinrpc_test.py"}]} diff --git a/iguana/help/SuperNET_broadcastcipher.json b/iguana/help/SuperNET_broadcastcipher.json new file mode 100644 index 000000000..7d762494d --- /dev/null +++ b/iguana/help/SuperNET_broadcastcipher.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"broadcastcipher","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_broadcastcipher_test.py"}]} diff --git a/iguana/help/SuperNET_broadcastdecipher.json b/iguana/help/SuperNET_broadcastdecipher.json new file mode 100644 index 000000000..d0c9a482a --- /dev/null +++ b/iguana/help/SuperNET_broadcastdecipher.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"broadcastdecipher","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_broadcastdecipher_test.py"}]} diff --git a/iguana/help/SuperNET_cipher.json b/iguana/help/SuperNET_cipher.json new file mode 100644 index 000000000..fe40ca2b7 --- /dev/null +++ b/iguana/help/SuperNET_cipher.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"cipher","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_cipher_test.py"}]} diff --git a/iguana/help/SuperNET_decipher.json b/iguana/help/SuperNET_decipher.json new file mode 100644 index 000000000..e9f3afeb0 --- /dev/null +++ b/iguana/help/SuperNET_decipher.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"decipher","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_decipher_test.py"}]} diff --git a/iguana/help/SuperNET_decryptjson.json b/iguana/help/SuperNET_decryptjson.json new file mode 100644 index 000000000..99f744a30 --- /dev/null +++ b/iguana/help/SuperNET_decryptjson.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"decryptjson","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_decryptjson_test.py"}]} diff --git a/iguana/help/SuperNET_encryptjson.json b/iguana/help/SuperNET_encryptjson.json new file mode 100644 index 000000000..ab8e48167 --- /dev/null +++ b/iguana/help/SuperNET_encryptjson.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"encryptjson","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_encryptjson_test.py"}]} diff --git a/iguana/help/SuperNET_getpeers.json b/iguana/help/SuperNET_getpeers.json new file mode 100644 index 000000000..0b0668d7c --- /dev/null +++ b/iguana/help/SuperNET_getpeers.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"getpeers","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_getpeers_test.py"}]} diff --git a/iguana/help/SuperNET_help.json b/iguana/help/SuperNET_help.json new file mode 100644 index 000000000..6e15f801c --- /dev/null +++ b/iguana/help/SuperNET_help.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"help","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_help_test.py"}]} diff --git a/iguana/help/SuperNET_html.json b/iguana/help/SuperNET_html.json new file mode 100644 index 000000000..b964098e9 --- /dev/null +++ b/iguana/help/SuperNET_html.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"html","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_html_test.py"}]} diff --git a/iguana/help/SuperNET_keypair.json b/iguana/help/SuperNET_keypair.json new file mode 100644 index 000000000..cdd91ae55 --- /dev/null +++ b/iguana/help/SuperNET_keypair.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"keypair","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_keypair_test.py"}]} diff --git a/iguana/help/SuperNET_layer.json b/iguana/help/SuperNET_layer.json new file mode 100644 index 000000000..fe4ecf3d4 --- /dev/null +++ b/iguana/help/SuperNET_layer.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"layer","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_layer_test.py"}]} diff --git a/iguana/help/SuperNET_login.json b/iguana/help/SuperNET_login.json new file mode 100644 index 000000000..c95a70f88 --- /dev/null +++ b/iguana/help/SuperNET_login.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"login","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_login_test.py"}]} diff --git a/iguana/help/SuperNET_logout.json b/iguana/help/SuperNET_logout.json new file mode 100644 index 000000000..c81c52c82 --- /dev/null +++ b/iguana/help/SuperNET_logout.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"logout","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_logout_test.py"}]} diff --git a/iguana/help/SuperNET_multicastcipher.json b/iguana/help/SuperNET_multicastcipher.json new file mode 100644 index 000000000..f12acca5c --- /dev/null +++ b/iguana/help/SuperNET_multicastcipher.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"multicastcipher","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_multicastcipher_test.py"}]} diff --git a/iguana/help/SuperNET_multicastdecipher.json b/iguana/help/SuperNET_multicastdecipher.json new file mode 100644 index 000000000..6c7a28c63 --- /dev/null +++ b/iguana/help/SuperNET_multicastdecipher.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"multicastdecipher","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_multicastdecipher_test.py"}]} diff --git a/iguana/help/SuperNET_myipaddr.json b/iguana/help/SuperNET_myipaddr.json new file mode 100644 index 000000000..ca58efd1b --- /dev/null +++ b/iguana/help/SuperNET_myipaddr.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"myipaddr","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_myipaddr_test.py"}]} diff --git a/iguana/help/SuperNET_mypeers.json b/iguana/help/SuperNET_mypeers.json new file mode 100644 index 000000000..461a59d53 --- /dev/null +++ b/iguana/help/SuperNET_mypeers.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"mypeers","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_mypeers_test.py"}]} diff --git a/iguana/help/SuperNET_priv2pub.json b/iguana/help/SuperNET_priv2pub.json new file mode 100644 index 000000000..279268c76 --- /dev/null +++ b/iguana/help/SuperNET_priv2pub.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"priv2pub","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_priv2pub_test.py"}]} diff --git a/iguana/help/SuperNET_priv2wif.json b/iguana/help/SuperNET_priv2wif.json new file mode 100644 index 000000000..8fc080527 --- /dev/null +++ b/iguana/help/SuperNET_priv2wif.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"priv2wif","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_priv2wif_test.py"}]} diff --git a/iguana/help/SuperNET_rmd160conv.json b/iguana/help/SuperNET_rmd160conv.json new file mode 100644 index 000000000..831ff50f7 --- /dev/null +++ b/iguana/help/SuperNET_rmd160conv.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"rmd160conv","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_rmd160conv_test.py"}]} diff --git a/iguana/help/SuperNET_rosetta.json b/iguana/help/SuperNET_rosetta.json new file mode 100644 index 000000000..58c3ef933 --- /dev/null +++ b/iguana/help/SuperNET_rosetta.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"rosetta","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_rosetta_test.py"}]} diff --git a/iguana/help/SuperNET_saveconf.json b/iguana/help/SuperNET_saveconf.json new file mode 100644 index 000000000..e78fbf542 --- /dev/null +++ b/iguana/help/SuperNET_saveconf.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"saveconf","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_saveconf_test.py"}]} diff --git a/iguana/help/SuperNET_setmyipaddr.json b/iguana/help/SuperNET_setmyipaddr.json new file mode 100644 index 000000000..02a73f5d8 --- /dev/null +++ b/iguana/help/SuperNET_setmyipaddr.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"setmyipaddr","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_setmyipaddr_test.py"}]} diff --git a/iguana/help/SuperNET_stop.json b/iguana/help/SuperNET_stop.json new file mode 100644 index 000000000..29f40aadd --- /dev/null +++ b/iguana/help/SuperNET_stop.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"stop","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_stop_test.py"}]} diff --git a/iguana/help/SuperNET_utc2utime.json b/iguana/help/SuperNET_utc2utime.json new file mode 100644 index 000000000..f5fa3556f --- /dev/null +++ b/iguana/help/SuperNET_utc2utime.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"utc2utime","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_utc2utime_test.py"}]} diff --git a/iguana/help/SuperNET_utime2utc.json b/iguana/help/SuperNET_utime2utc.json new file mode 100644 index 000000000..000d81603 --- /dev/null +++ b/iguana/help/SuperNET_utime2utc.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"utime2utc","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_utime2utc_test.py"}]} diff --git a/iguana/help/SuperNET_wif2priv.json b/iguana/help/SuperNET_wif2priv.json new file mode 100644 index 000000000..e0447b36b --- /dev/null +++ b/iguana/help/SuperNET_wif2priv.json @@ -0,0 +1 @@ +{"agent":"SuperNET","method":"wif2priv","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"SuperNET_wif2priv_test.py"}]} diff --git a/iguana/help/basilisk_addrelay.json b/iguana/help/basilisk_addrelay.json new file mode 100644 index 000000000..a0faa2c84 --- /dev/null +++ b/iguana/help/basilisk_addrelay.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"addrelay","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_addrelay_test.py"}]} diff --git a/iguana/help/basilisk_balances.json b/iguana/help/basilisk_balances.json new file mode 100644 index 000000000..85bdf0f7f --- /dev/null +++ b/iguana/help/basilisk_balances.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"balances","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_balances_test.py"}]} diff --git a/iguana/help/basilisk_cancelrefresh.json b/iguana/help/basilisk_cancelrefresh.json new file mode 100644 index 000000000..1d2db83c9 --- /dev/null +++ b/iguana/help/basilisk_cancelrefresh.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"cancelrefresh","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_cancelrefresh_test.py"}]} diff --git a/iguana/help/basilisk_dispatch.json b/iguana/help/basilisk_dispatch.json new file mode 100644 index 000000000..395902152 --- /dev/null +++ b/iguana/help/basilisk_dispatch.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"dispatch","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_dispatch_test.py"}]} diff --git a/iguana/help/basilisk_forward.json b/iguana/help/basilisk_forward.json new file mode 100644 index 000000000..868424a14 --- /dev/null +++ b/iguana/help/basilisk_forward.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"forward","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_forward_test.py"}]} diff --git a/iguana/help/basilisk_geckoblock.json b/iguana/help/basilisk_geckoblock.json new file mode 100644 index 000000000..ed730f081 --- /dev/null +++ b/iguana/help/basilisk_geckoblock.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"geckoblock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_geckoblock_test.py"}]} diff --git a/iguana/help/basilisk_geckoget.json b/iguana/help/basilisk_geckoget.json new file mode 100644 index 000000000..ddb097fab --- /dev/null +++ b/iguana/help/basilisk_geckoget.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"geckoget","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_geckoget_test.py"}]} diff --git a/iguana/help/basilisk_geckoheaders.json b/iguana/help/basilisk_geckoheaders.json new file mode 100644 index 000000000..30b600d6f --- /dev/null +++ b/iguana/help/basilisk_geckoheaders.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"geckoheaders","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_geckoheaders_test.py"}]} diff --git a/iguana/help/basilisk_geckotx.json b/iguana/help/basilisk_geckotx.json new file mode 100644 index 000000000..b55cf8582 --- /dev/null +++ b/iguana/help/basilisk_geckotx.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"geckotx","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_geckotx_test.py"}]} diff --git a/iguana/help/basilisk_genesis_opreturn.json b/iguana/help/basilisk_genesis_opreturn.json new file mode 100644 index 000000000..25c7e3277 --- /dev/null +++ b/iguana/help/basilisk_genesis_opreturn.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"genesis_opreturn","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_genesis_opreturn_test.py"}]} diff --git a/iguana/help/basilisk_getmessage.json b/iguana/help/basilisk_getmessage.json new file mode 100644 index 000000000..e4dbd9cdd --- /dev/null +++ b/iguana/help/basilisk_getmessage.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"getmessage","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_getmessage_test.py"}]} diff --git a/iguana/help/basilisk_history.json b/iguana/help/basilisk_history.json new file mode 100644 index 000000000..fd91aa8bc --- /dev/null +++ b/iguana/help/basilisk_history.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"history","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_history_test.py"}]} diff --git a/iguana/help/basilisk_mailbox.json b/iguana/help/basilisk_mailbox.json new file mode 100644 index 000000000..4eceaf50a --- /dev/null +++ b/iguana/help/basilisk_mailbox.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"mailbox","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_mailbox_test.py"}]} diff --git a/iguana/help/basilisk_paxfiats.json b/iguana/help/basilisk_paxfiats.json new file mode 100644 index 000000000..26a27c6cb --- /dev/null +++ b/iguana/help/basilisk_paxfiats.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"paxfiats","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_paxfiats_test.py"}]} diff --git a/iguana/help/basilisk_publish.json b/iguana/help/basilisk_publish.json new file mode 100644 index 000000000..1c0d9469c --- /dev/null +++ b/iguana/help/basilisk_publish.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"publish","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_publish_test.py"}]} diff --git a/iguana/help/basilisk_rawtx.json b/iguana/help/basilisk_rawtx.json new file mode 100644 index 000000000..73682aa14 --- /dev/null +++ b/iguana/help/basilisk_rawtx.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"rawtx","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_rawtx_test.py"}]} diff --git a/iguana/help/basilisk_refresh.json b/iguana/help/basilisk_refresh.json new file mode 100644 index 000000000..fc3ee50a8 --- /dev/null +++ b/iguana/help/basilisk_refresh.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"refresh","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_refresh_test.py"}]} diff --git a/iguana/help/basilisk_sendmessage.json b/iguana/help/basilisk_sendmessage.json new file mode 100644 index 000000000..96a8fab9e --- /dev/null +++ b/iguana/help/basilisk_sendmessage.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"sendmessage","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_sendmessage_test.py"}]} diff --git a/iguana/help/basilisk_subscribe.json b/iguana/help/basilisk_subscribe.json new file mode 100644 index 000000000..2369fefb9 --- /dev/null +++ b/iguana/help/basilisk_subscribe.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"subscribe","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_subscribe_test.py"}]} diff --git a/iguana/help/basilisk_utxocombine.json b/iguana/help/basilisk_utxocombine.json new file mode 100644 index 000000000..4ef0423ec --- /dev/null +++ b/iguana/help/basilisk_utxocombine.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"utxocombine","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_utxocombine_test.py"}]} diff --git a/iguana/help/basilisk_utxorawtx.json b/iguana/help/basilisk_utxorawtx.json new file mode 100644 index 000000000..f44828007 --- /dev/null +++ b/iguana/help/basilisk_utxorawtx.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"utxorawtx","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_utxorawtx_test.py"}]} diff --git a/iguana/help/basilisk_value.json b/iguana/help/basilisk_value.json new file mode 100644 index 000000000..2f3575ad8 --- /dev/null +++ b/iguana/help/basilisk_value.json @@ -0,0 +1 @@ +{"agent":"basilisk","method":"value","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"basilisk_value_test.py"}]} diff --git a/iguana/help/bitcoinrpc_addmultisigaddress.json b/iguana/help/bitcoinrpc_addmultisigaddress.json new file mode 100644 index 000000000..453eedab1 --- /dev/null +++ b/iguana/help/bitcoinrpc_addmultisigaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"addmultisigaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_addmultisigaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_backupwallet.json b/iguana/help/bitcoinrpc_backupwallet.json new file mode 100644 index 000000000..49d4977f6 --- /dev/null +++ b/iguana/help/bitcoinrpc_backupwallet.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"backupwallet","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_backupwallet_test.py"}]} diff --git a/iguana/help/bitcoinrpc_checkwallet.json b/iguana/help/bitcoinrpc_checkwallet.json new file mode 100644 index 000000000..7873ec3e3 --- /dev/null +++ b/iguana/help/bitcoinrpc_checkwallet.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"checkwallet","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_checkwallet_test.py"}]} diff --git a/iguana/help/bitcoinrpc_createmultisig.json b/iguana/help/bitcoinrpc_createmultisig.json new file mode 100644 index 000000000..1fc0af008 --- /dev/null +++ b/iguana/help/bitcoinrpc_createmultisig.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"createmultisig","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_createmultisig_test.py"}]} diff --git a/iguana/help/bitcoinrpc_createrawtransaction.json b/iguana/help/bitcoinrpc_createrawtransaction.json new file mode 100644 index 000000000..36a955996 --- /dev/null +++ b/iguana/help/bitcoinrpc_createrawtransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"createrawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_createrawtransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_decoderawtransaction.json b/iguana/help/bitcoinrpc_decoderawtransaction.json new file mode 100644 index 000000000..772f96900 --- /dev/null +++ b/iguana/help/bitcoinrpc_decoderawtransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"decoderawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_decoderawtransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_decodescript.json b/iguana/help/bitcoinrpc_decodescript.json new file mode 100644 index 000000000..9be4a77bf --- /dev/null +++ b/iguana/help/bitcoinrpc_decodescript.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"decodescript","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_decodescript_test.py"}]} diff --git a/iguana/help/bitcoinrpc_dumpprivkey.json b/iguana/help/bitcoinrpc_dumpprivkey.json new file mode 100644 index 000000000..b28fe7185 --- /dev/null +++ b/iguana/help/bitcoinrpc_dumpprivkey.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"dumpprivkey","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_dumpprivkey_test.py"}]} diff --git a/iguana/help/bitcoinrpc_dumpwallet.json b/iguana/help/bitcoinrpc_dumpwallet.json new file mode 100644 index 000000000..d0f3ed4f1 --- /dev/null +++ b/iguana/help/bitcoinrpc_dumpwallet.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"dumpwallet","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_dumpwallet_test.py"}]} diff --git a/iguana/help/bitcoinrpc_encryptwallet.json b/iguana/help/bitcoinrpc_encryptwallet.json new file mode 100644 index 000000000..3919c40a4 --- /dev/null +++ b/iguana/help/bitcoinrpc_encryptwallet.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"encryptwallet","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_encryptwallet_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getaccount.json b/iguana/help/bitcoinrpc_getaccount.json new file mode 100644 index 000000000..b0ecd2a9e --- /dev/null +++ b/iguana/help/bitcoinrpc_getaccount.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getaccount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getaccount_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getaccountaddress.json b/iguana/help/bitcoinrpc_getaccountaddress.json new file mode 100644 index 000000000..cf3842825 --- /dev/null +++ b/iguana/help/bitcoinrpc_getaccountaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getaccountaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getaccountaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getaddressesbyaccount.json b/iguana/help/bitcoinrpc_getaddressesbyaccount.json new file mode 100644 index 000000000..12d42c814 --- /dev/null +++ b/iguana/help/bitcoinrpc_getaddressesbyaccount.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getaddressesbyaccount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getaddressesbyaccount_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getbalance.json b/iguana/help/bitcoinrpc_getbalance.json new file mode 100644 index 000000000..22f234744 --- /dev/null +++ b/iguana/help/bitcoinrpc_getbalance.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getbalance","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getbalance_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getbestblockhash.json b/iguana/help/bitcoinrpc_getbestblockhash.json new file mode 100644 index 000000000..e2c5fd0a7 --- /dev/null +++ b/iguana/help/bitcoinrpc_getbestblockhash.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getbestblockhash","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getbestblockhash_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getblock.json b/iguana/help/bitcoinrpc_getblock.json new file mode 100644 index 000000000..2f23841f5 --- /dev/null +++ b/iguana/help/bitcoinrpc_getblock.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getblock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getblock_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getblockcount.json b/iguana/help/bitcoinrpc_getblockcount.json new file mode 100644 index 000000000..1c1a14959 --- /dev/null +++ b/iguana/help/bitcoinrpc_getblockcount.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getblockcount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getblockcount_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getblockhash.json b/iguana/help/bitcoinrpc_getblockhash.json new file mode 100644 index 000000000..4c7877840 --- /dev/null +++ b/iguana/help/bitcoinrpc_getblockhash.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getblockhash","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getblockhash_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getdifficulty.json b/iguana/help/bitcoinrpc_getdifficulty.json new file mode 100644 index 000000000..5950fb6f5 --- /dev/null +++ b/iguana/help/bitcoinrpc_getdifficulty.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getdifficulty","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getdifficulty_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getinfo.json b/iguana/help/bitcoinrpc_getinfo.json new file mode 100644 index 000000000..22be35c69 --- /dev/null +++ b/iguana/help/bitcoinrpc_getinfo.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getinfo","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getinfo_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getnewaddress.json b/iguana/help/bitcoinrpc_getnewaddress.json new file mode 100644 index 000000000..3d6875a2a --- /dev/null +++ b/iguana/help/bitcoinrpc_getnewaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getnewaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getnewaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getrawchangeaddress.json b/iguana/help/bitcoinrpc_getrawchangeaddress.json new file mode 100644 index 000000000..3d4128a2f --- /dev/null +++ b/iguana/help/bitcoinrpc_getrawchangeaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getrawchangeaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getrawchangeaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getrawtransaction.json b/iguana/help/bitcoinrpc_getrawtransaction.json new file mode 100644 index 000000000..93c727b87 --- /dev/null +++ b/iguana/help/bitcoinrpc_getrawtransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getrawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getrawtransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getreceivedbyaccount.json b/iguana/help/bitcoinrpc_getreceivedbyaccount.json new file mode 100644 index 000000000..defd762d9 --- /dev/null +++ b/iguana/help/bitcoinrpc_getreceivedbyaccount.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getreceivedbyaccount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getreceivedbyaccount_test.py"}]} diff --git a/iguana/help/bitcoinrpc_getreceivedbyaddress.json b/iguana/help/bitcoinrpc_getreceivedbyaddress.json new file mode 100644 index 000000000..edb272cb7 --- /dev/null +++ b/iguana/help/bitcoinrpc_getreceivedbyaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"getreceivedbyaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_getreceivedbyaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_gettransaction.json b/iguana/help/bitcoinrpc_gettransaction.json new file mode 100644 index 000000000..480f1e86f --- /dev/null +++ b/iguana/help/bitcoinrpc_gettransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"gettransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_gettransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_gettxout.json b/iguana/help/bitcoinrpc_gettxout.json new file mode 100644 index 000000000..98324561b --- /dev/null +++ b/iguana/help/bitcoinrpc_gettxout.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"gettxout","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_gettxout_test.py"}]} diff --git a/iguana/help/bitcoinrpc_gettxoutsetinfo.json b/iguana/help/bitcoinrpc_gettxoutsetinfo.json new file mode 100644 index 000000000..3d1926383 --- /dev/null +++ b/iguana/help/bitcoinrpc_gettxoutsetinfo.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"gettxoutsetinfo","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_gettxoutsetinfo_test.py"}]} diff --git a/iguana/help/bitcoinrpc_importaddress.json b/iguana/help/bitcoinrpc_importaddress.json new file mode 100644 index 000000000..37e9c4a0d --- /dev/null +++ b/iguana/help/bitcoinrpc_importaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"importaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_importaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_importprivkey.json b/iguana/help/bitcoinrpc_importprivkey.json new file mode 100644 index 000000000..4efae987e --- /dev/null +++ b/iguana/help/bitcoinrpc_importprivkey.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"importprivkey","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_importprivkey_test.py"}]} diff --git a/iguana/help/bitcoinrpc_importwallet.json b/iguana/help/bitcoinrpc_importwallet.json new file mode 100644 index 000000000..8bf5ce1ae --- /dev/null +++ b/iguana/help/bitcoinrpc_importwallet.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"importwallet","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_importwallet_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listaccounts.json b/iguana/help/bitcoinrpc_listaccounts.json new file mode 100644 index 000000000..635508cf5 --- /dev/null +++ b/iguana/help/bitcoinrpc_listaccounts.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listaccounts","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listaccounts_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listaddressgroupings.json b/iguana/help/bitcoinrpc_listaddressgroupings.json new file mode 100644 index 000000000..21f7d8b3e --- /dev/null +++ b/iguana/help/bitcoinrpc_listaddressgroupings.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listaddressgroupings","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listaddressgroupings_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listlockunspent.json b/iguana/help/bitcoinrpc_listlockunspent.json new file mode 100644 index 000000000..23ee5ccb9 --- /dev/null +++ b/iguana/help/bitcoinrpc_listlockunspent.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listlockunspent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listlockunspent_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listreceivedbyaccount.json b/iguana/help/bitcoinrpc_listreceivedbyaccount.json new file mode 100644 index 000000000..a7f59f51f --- /dev/null +++ b/iguana/help/bitcoinrpc_listreceivedbyaccount.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listreceivedbyaccount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listreceivedbyaccount_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listreceivedbyaddress.json b/iguana/help/bitcoinrpc_listreceivedbyaddress.json new file mode 100644 index 000000000..6150f1a3b --- /dev/null +++ b/iguana/help/bitcoinrpc_listreceivedbyaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listreceivedbyaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listreceivedbyaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listsinceblock.json b/iguana/help/bitcoinrpc_listsinceblock.json new file mode 100644 index 000000000..66beb661a --- /dev/null +++ b/iguana/help/bitcoinrpc_listsinceblock.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listsinceblock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listsinceblock_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listtransactions.json b/iguana/help/bitcoinrpc_listtransactions.json new file mode 100644 index 000000000..ddb55511c --- /dev/null +++ b/iguana/help/bitcoinrpc_listtransactions.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listtransactions","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listtransactions_test.py"}]} diff --git a/iguana/help/bitcoinrpc_listunspent.json b/iguana/help/bitcoinrpc_listunspent.json new file mode 100644 index 000000000..0c11033b4 --- /dev/null +++ b/iguana/help/bitcoinrpc_listunspent.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"listunspent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_listunspent_test.py"}]} diff --git a/iguana/help/bitcoinrpc_lockunspent.json b/iguana/help/bitcoinrpc_lockunspent.json new file mode 100644 index 000000000..61c9d7db8 --- /dev/null +++ b/iguana/help/bitcoinrpc_lockunspent.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"lockunspent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_lockunspent_test.py"}]} diff --git a/iguana/help/bitcoinrpc_move.json b/iguana/help/bitcoinrpc_move.json new file mode 100644 index 000000000..b96af5b84 --- /dev/null +++ b/iguana/help/bitcoinrpc_move.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"move","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_move_test.py"}]} diff --git a/iguana/help/bitcoinrpc_repairwallet.json b/iguana/help/bitcoinrpc_repairwallet.json new file mode 100644 index 000000000..4b6f7f080 --- /dev/null +++ b/iguana/help/bitcoinrpc_repairwallet.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"repairwallet","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_repairwallet_test.py"}]} diff --git a/iguana/help/bitcoinrpc_sendfrom.json b/iguana/help/bitcoinrpc_sendfrom.json new file mode 100644 index 000000000..6cec10d79 --- /dev/null +++ b/iguana/help/bitcoinrpc_sendfrom.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"sendfrom","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_sendfrom_test.py"}]} diff --git a/iguana/help/bitcoinrpc_sendmany.json b/iguana/help/bitcoinrpc_sendmany.json new file mode 100644 index 000000000..5115347f4 --- /dev/null +++ b/iguana/help/bitcoinrpc_sendmany.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"sendmany","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_sendmany_test.py"}]} diff --git a/iguana/help/bitcoinrpc_sendrawtransaction.json b/iguana/help/bitcoinrpc_sendrawtransaction.json new file mode 100644 index 000000000..fa9c4182f --- /dev/null +++ b/iguana/help/bitcoinrpc_sendrawtransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"sendrawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_sendrawtransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_sendtoaddress.json b/iguana/help/bitcoinrpc_sendtoaddress.json new file mode 100644 index 000000000..0553170c9 --- /dev/null +++ b/iguana/help/bitcoinrpc_sendtoaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"sendtoaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_sendtoaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_setaccount.json b/iguana/help/bitcoinrpc_setaccount.json new file mode 100644 index 000000000..e73220bf2 --- /dev/null +++ b/iguana/help/bitcoinrpc_setaccount.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"setaccount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_setaccount_test.py"}]} diff --git a/iguana/help/bitcoinrpc_settxfee.json b/iguana/help/bitcoinrpc_settxfee.json new file mode 100644 index 000000000..d3cc05812 --- /dev/null +++ b/iguana/help/bitcoinrpc_settxfee.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"settxfee","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_settxfee_test.py"}]} diff --git a/iguana/help/bitcoinrpc_signmessage.json b/iguana/help/bitcoinrpc_signmessage.json new file mode 100644 index 000000000..c5e335545 --- /dev/null +++ b/iguana/help/bitcoinrpc_signmessage.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"signmessage","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_signmessage_test.py"}]} diff --git a/iguana/help/bitcoinrpc_signrawtransaction.json b/iguana/help/bitcoinrpc_signrawtransaction.json new file mode 100644 index 000000000..5f693247a --- /dev/null +++ b/iguana/help/bitcoinrpc_signrawtransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"signrawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_signrawtransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_submitblock.json b/iguana/help/bitcoinrpc_submitblock.json new file mode 100644 index 000000000..03e5c711e --- /dev/null +++ b/iguana/help/bitcoinrpc_submitblock.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"submitblock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_submitblock_test.py"}]} diff --git a/iguana/help/bitcoinrpc_validateaddress.json b/iguana/help/bitcoinrpc_validateaddress.json new file mode 100644 index 000000000..2226a7767 --- /dev/null +++ b/iguana/help/bitcoinrpc_validateaddress.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"validateaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_validateaddress_test.py"}]} diff --git a/iguana/help/bitcoinrpc_validatepubkey.json b/iguana/help/bitcoinrpc_validatepubkey.json new file mode 100644 index 000000000..bfd1d8c5b --- /dev/null +++ b/iguana/help/bitcoinrpc_validatepubkey.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"validatepubkey","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_validatepubkey_test.py"}]} diff --git a/iguana/help/bitcoinrpc_validaterawtransaction.json b/iguana/help/bitcoinrpc_validaterawtransaction.json new file mode 100644 index 000000000..ffcec8df8 --- /dev/null +++ b/iguana/help/bitcoinrpc_validaterawtransaction.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"validaterawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_validaterawtransaction_test.py"}]} diff --git a/iguana/help/bitcoinrpc_verifymessage.json b/iguana/help/bitcoinrpc_verifymessage.json new file mode 100644 index 000000000..9cc4a7ee7 --- /dev/null +++ b/iguana/help/bitcoinrpc_verifymessage.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"verifymessage","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_verifymessage_test.py"}]} diff --git a/iguana/help/bitcoinrpc_walletlock.json b/iguana/help/bitcoinrpc_walletlock.json new file mode 100644 index 000000000..d3375ba94 --- /dev/null +++ b/iguana/help/bitcoinrpc_walletlock.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"walletlock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_walletlock_test.py"}]} diff --git a/iguana/help/bitcoinrpc_walletpassphrase.json b/iguana/help/bitcoinrpc_walletpassphrase.json new file mode 100644 index 000000000..e196e4171 --- /dev/null +++ b/iguana/help/bitcoinrpc_walletpassphrase.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"walletpassphrase","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_walletpassphrase_test.py"}]} diff --git a/iguana/help/bitcoinrpc_walletpassphrasechange.json b/iguana/help/bitcoinrpc_walletpassphrasechange.json new file mode 100644 index 000000000..c18bc1a12 --- /dev/null +++ b/iguana/help/bitcoinrpc_walletpassphrasechange.json @@ -0,0 +1 @@ +{"agent":"bitcoinrpc","method":"walletpassphrasechange","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"bitcoinrpc_walletpassphrasechange_test.py"}]} diff --git a/iguana/help/dex_alladdresses.json b/iguana/help/dex_alladdresses.json new file mode 100644 index 000000000..71b30968d --- /dev/null +++ b/iguana/help/dex_alladdresses.json @@ -0,0 +1 @@ +{"agent":"dex","method":"alladdresses","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_alladdresses_test.py"}]} diff --git a/iguana/help/dex_checkaddress.json b/iguana/help/dex_checkaddress.json new file mode 100644 index 000000000..c651f71f9 --- /dev/null +++ b/iguana/help/dex_checkaddress.json @@ -0,0 +1 @@ +{"agent":"dex","method":"checkaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_checkaddress_test.py"}]} diff --git a/iguana/help/dex_explorer.json b/iguana/help/dex_explorer.json new file mode 100644 index 000000000..f48b9eb44 --- /dev/null +++ b/iguana/help/dex_explorer.json @@ -0,0 +1 @@ +{"agent":"dex","method":"explorer","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_explorer_test.py"}]} diff --git a/iguana/help/dex_getbalance.json b/iguana/help/dex_getbalance.json new file mode 100644 index 000000000..39c086891 --- /dev/null +++ b/iguana/help/dex_getbalance.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getbalance","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getbalance_test.py"}]} diff --git a/iguana/help/dex_getbestblockhash.json b/iguana/help/dex_getbestblockhash.json new file mode 100644 index 000000000..ab3625a38 --- /dev/null +++ b/iguana/help/dex_getbestblockhash.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getbestblockhash","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getbestblockhash_test.py"}]} diff --git a/iguana/help/dex_getblock.json b/iguana/help/dex_getblock.json new file mode 100644 index 000000000..9f74e1ba6 --- /dev/null +++ b/iguana/help/dex_getblock.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getblock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getblock_test.py"}]} diff --git a/iguana/help/dex_getblockhash.json b/iguana/help/dex_getblockhash.json new file mode 100644 index 000000000..87fbff94d --- /dev/null +++ b/iguana/help/dex_getblockhash.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getblockhash","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getblockhash_test.py"}]} diff --git a/iguana/help/dex_getinfo.json b/iguana/help/dex_getinfo.json new file mode 100644 index 000000000..89b6f79fa --- /dev/null +++ b/iguana/help/dex_getinfo.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getinfo","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getinfo_test.py"}]} diff --git a/iguana/help/dex_getmessage.json b/iguana/help/dex_getmessage.json new file mode 100644 index 000000000..4b0aa5d4e --- /dev/null +++ b/iguana/help/dex_getmessage.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getmessage","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getmessage_test.py"}]} diff --git a/iguana/help/dex_getnotaries.json b/iguana/help/dex_getnotaries.json new file mode 100644 index 000000000..b3280498e --- /dev/null +++ b/iguana/help/dex_getnotaries.json @@ -0,0 +1 @@ +{"agent":"dex","method":"getnotaries","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_getnotaries_test.py"}]} diff --git a/iguana/help/dex_gettransaction.json b/iguana/help/dex_gettransaction.json new file mode 100644 index 000000000..4b3df0094 --- /dev/null +++ b/iguana/help/dex_gettransaction.json @@ -0,0 +1 @@ +{"agent":"dex","method":"gettransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_gettransaction_test.py"}]} diff --git a/iguana/help/dex_gettxin.json b/iguana/help/dex_gettxin.json new file mode 100644 index 000000000..868ffd753 --- /dev/null +++ b/iguana/help/dex_gettxin.json @@ -0,0 +1 @@ +{"agent":"dex","method":"gettxin","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_gettxin_test.py"}]} diff --git a/iguana/help/dex_gettxout.json b/iguana/help/dex_gettxout.json new file mode 100644 index 000000000..13169702d --- /dev/null +++ b/iguana/help/dex_gettxout.json @@ -0,0 +1 @@ +{"agent":"dex","method":"gettxout","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_gettxout_test.py"}]} diff --git a/iguana/help/dex_importaddress.json b/iguana/help/dex_importaddress.json new file mode 100644 index 000000000..c0961635f --- /dev/null +++ b/iguana/help/dex_importaddress.json @@ -0,0 +1 @@ +{"agent":"dex","method":"importaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_importaddress_test.py"}]} diff --git a/iguana/help/dex_kvsearch.json b/iguana/help/dex_kvsearch.json new file mode 100644 index 000000000..3b3f22ac5 --- /dev/null +++ b/iguana/help/dex_kvsearch.json @@ -0,0 +1 @@ +{"agent":"dex","method":"kvsearch","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_kvsearch_test.py"}]} diff --git a/iguana/help/dex_kvupdate.json b/iguana/help/dex_kvupdate.json new file mode 100644 index 000000000..8303eaad1 --- /dev/null +++ b/iguana/help/dex_kvupdate.json @@ -0,0 +1 @@ +{"agent":"dex","method":"kvupdate","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_kvupdate_test.py"}]} diff --git a/iguana/help/dex_listspent.json b/iguana/help/dex_listspent.json new file mode 100644 index 000000000..22767b773 --- /dev/null +++ b/iguana/help/dex_listspent.json @@ -0,0 +1 @@ +{"agent":"dex","method":"listspent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_listspent_test.py"}]} diff --git a/iguana/help/dex_listtransactions.json b/iguana/help/dex_listtransactions.json new file mode 100644 index 000000000..be95c75ff --- /dev/null +++ b/iguana/help/dex_listtransactions.json @@ -0,0 +1 @@ +{"agent":"dex","method":"listtransactions","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_listtransactions_test.py"}]} diff --git a/iguana/help/dex_listtransactions2.json b/iguana/help/dex_listtransactions2.json new file mode 100644 index 000000000..234b9b8df --- /dev/null +++ b/iguana/help/dex_listtransactions2.json @@ -0,0 +1 @@ +{"agent":"dex","method":"listtransactions2","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_listtransactions2_test.py"}]} diff --git a/iguana/help/dex_listunspent.json b/iguana/help/dex_listunspent.json new file mode 100644 index 000000000..0f50ca06e --- /dev/null +++ b/iguana/help/dex_listunspent.json @@ -0,0 +1 @@ +{"agent":"dex","method":"listunspent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_listunspent_test.py"}]} diff --git a/iguana/help/dex_listunspent2.json b/iguana/help/dex_listunspent2.json new file mode 100644 index 000000000..9ccc2a1e4 --- /dev/null +++ b/iguana/help/dex_listunspent2.json @@ -0,0 +1 @@ +{"agent":"dex","method":"listunspent2","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_listunspent2_test.py"}]} diff --git a/iguana/help/dex_psock.json b/iguana/help/dex_psock.json new file mode 100644 index 000000000..74a3a8dfa --- /dev/null +++ b/iguana/help/dex_psock.json @@ -0,0 +1 @@ +{"agent":"dex","method":"psock","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_psock_test.py"}]} diff --git a/iguana/help/dex_send.json b/iguana/help/dex_send.json new file mode 100644 index 000000000..ccd3cc2bd --- /dev/null +++ b/iguana/help/dex_send.json @@ -0,0 +1 @@ +{"agent":"dex","method":"send","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_send_test.py"}]} diff --git a/iguana/help/dex_sendrawtransaction.json b/iguana/help/dex_sendrawtransaction.json new file mode 100644 index 000000000..20261d219 --- /dev/null +++ b/iguana/help/dex_sendrawtransaction.json @@ -0,0 +1 @@ +{"agent":"dex","method":"sendrawtransaction","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_sendrawtransaction_test.py"}]} diff --git a/iguana/help/dex_validateaddress.json b/iguana/help/dex_validateaddress.json new file mode 100644 index 000000000..7387dc024 --- /dev/null +++ b/iguana/help/dex_validateaddress.json @@ -0,0 +1 @@ +{"agent":"dex","method":"validateaddress","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dex_validateaddress_test.py"}]} diff --git a/iguana/help/dpow_active.json b/iguana/help/dpow_active.json new file mode 100644 index 000000000..b639a3ada --- /dev/null +++ b/iguana/help/dpow_active.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"active","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_active_test.py"}]} diff --git a/iguana/help/dpow_bindaddr.json b/iguana/help/dpow_bindaddr.json new file mode 100644 index 000000000..65f0052f7 --- /dev/null +++ b/iguana/help/dpow_bindaddr.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"bindaddr","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_bindaddr_test.py"}]} diff --git a/iguana/help/dpow_cancelratify.json b/iguana/help/dpow_cancelratify.json new file mode 100644 index 000000000..33a872463 --- /dev/null +++ b/iguana/help/dpow_cancelratify.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"cancelratify","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_cancelratify_test.py"}]} diff --git a/iguana/help/dpow_fundnotaries.json b/iguana/help/dpow_fundnotaries.json new file mode 100644 index 000000000..4e2854714 --- /dev/null +++ b/iguana/help/dpow_fundnotaries.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"fundnotaries","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_fundnotaries_test.py"}]} diff --git a/iguana/help/dpow_notarychains.json b/iguana/help/dpow_notarychains.json new file mode 100644 index 000000000..daee37348 --- /dev/null +++ b/iguana/help/dpow_notarychains.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"notarychains","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_notarychains_test.py"}]} diff --git a/iguana/help/dpow_pending.json b/iguana/help/dpow_pending.json new file mode 100644 index 000000000..1a524af58 --- /dev/null +++ b/iguana/help/dpow_pending.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"pending","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_pending_test.py"}]} diff --git a/iguana/help/dpow_ratify.json b/iguana/help/dpow_ratify.json new file mode 100644 index 000000000..c449a8888 --- /dev/null +++ b/iguana/help/dpow_ratify.json @@ -0,0 +1 @@ +{"agent":"dpow","method":"ratify","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"dpow_ratify_test.py"}]} diff --git a/iguana/help/hash_NXT.json b/iguana/help/hash_NXT.json new file mode 100644 index 000000000..85fae7d76 --- /dev/null +++ b/iguana/help/hash_NXT.json @@ -0,0 +1 @@ +{"agent":"hash","method":"NXT","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_NXT_test.py"}]} diff --git a/iguana/help/hash_base64_decode.json b/iguana/help/hash_base64_decode.json new file mode 100644 index 000000000..eadde2571 --- /dev/null +++ b/iguana/help/hash_base64_decode.json @@ -0,0 +1 @@ +{"agent":"hash","method":"base64_decode","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_base64_decode_test.py"}]} diff --git a/iguana/help/hash_base64_encode.json b/iguana/help/hash_base64_encode.json new file mode 100644 index 000000000..171e50200 --- /dev/null +++ b/iguana/help/hash_base64_encode.json @@ -0,0 +1 @@ +{"agent":"hash","method":"base64_encode","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_base64_encode_test.py"}]} diff --git a/iguana/help/hash_crc32.json b/iguana/help/hash_crc32.json new file mode 100644 index 000000000..3891c7bdf --- /dev/null +++ b/iguana/help/hash_crc32.json @@ -0,0 +1 @@ +{"agent":"hash","method":"crc32","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_crc32_test.py"}]} diff --git a/iguana/help/hash_curve25519.json b/iguana/help/hash_curve25519.json new file mode 100644 index 000000000..c9205f92b --- /dev/null +++ b/iguana/help/hash_curve25519.json @@ -0,0 +1 @@ +{"agent":"hash","method":"curve25519","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_curve25519_test.py"}]} diff --git a/iguana/help/hash_curve25519_pair.json b/iguana/help/hash_curve25519_pair.json new file mode 100644 index 000000000..f1e183ead --- /dev/null +++ b/iguana/help/hash_curve25519_pair.json @@ -0,0 +1 @@ +{"agent":"hash","method":"curve25519_pair","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_curve25519_pair_test.py"}]} diff --git a/iguana/help/hash_hex.json b/iguana/help/hash_hex.json new file mode 100644 index 000000000..467d9579b --- /dev/null +++ b/iguana/help/hash_hex.json @@ -0,0 +1 @@ +{"agent":"hash","method":"hex","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_hex_test.py"}]} diff --git a/iguana/help/hash_md2.json b/iguana/help/hash_md2.json new file mode 100644 index 000000000..995e6bb7f --- /dev/null +++ b/iguana/help/hash_md2.json @@ -0,0 +1 @@ +{"agent":"hash","method":"md2","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_md2_test.py"}]} diff --git a/iguana/help/hash_md4.json b/iguana/help/hash_md4.json new file mode 100644 index 000000000..696b4a22b --- /dev/null +++ b/iguana/help/hash_md4.json @@ -0,0 +1 @@ +{"agent":"hash","method":"md4","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_md4_test.py"}]} diff --git a/iguana/help/hash_md5.json b/iguana/help/hash_md5.json new file mode 100644 index 000000000..cd50b763a --- /dev/null +++ b/iguana/help/hash_md5.json @@ -0,0 +1 @@ +{"agent":"hash","method":"md5","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_md5_test.py"}]} diff --git a/iguana/help/hash_rmd128.json b/iguana/help/hash_rmd128.json new file mode 100644 index 000000000..c1fe35027 --- /dev/null +++ b/iguana/help/hash_rmd128.json @@ -0,0 +1 @@ +{"agent":"hash","method":"rmd128","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_rmd128_test.py"}]} diff --git a/iguana/help/hash_rmd160.json b/iguana/help/hash_rmd160.json new file mode 100644 index 000000000..448febe13 --- /dev/null +++ b/iguana/help/hash_rmd160.json @@ -0,0 +1 @@ +{"agent":"hash","method":"rmd160","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_rmd160_test.py"}]} diff --git a/iguana/help/hash_rmd160_sha256.json b/iguana/help/hash_rmd160_sha256.json new file mode 100644 index 000000000..d20a37caa --- /dev/null +++ b/iguana/help/hash_rmd160_sha256.json @@ -0,0 +1 @@ +{"agent":"hash","method":"rmd160_sha256","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_rmd160_sha256_test.py"}]} diff --git a/iguana/help/hash_rmd256.json b/iguana/help/hash_rmd256.json new file mode 100644 index 000000000..7b5476766 --- /dev/null +++ b/iguana/help/hash_rmd256.json @@ -0,0 +1 @@ +{"agent":"hash","method":"rmd256","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_rmd256_test.py"}]} diff --git a/iguana/help/hash_rmd320.json b/iguana/help/hash_rmd320.json new file mode 100644 index 000000000..d710f49d8 --- /dev/null +++ b/iguana/help/hash_rmd320.json @@ -0,0 +1 @@ +{"agent":"hash","method":"rmd320","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_rmd320_test.py"}]} diff --git a/iguana/help/hash_sha1.json b/iguana/help/hash_sha1.json new file mode 100644 index 000000000..03a4fe9a3 --- /dev/null +++ b/iguana/help/hash_sha1.json @@ -0,0 +1 @@ +{"agent":"hash","method":"sha1","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_sha1_test.py"}]} diff --git a/iguana/help/hash_sha224.json b/iguana/help/hash_sha224.json new file mode 100644 index 000000000..a3b3f0840 --- /dev/null +++ b/iguana/help/hash_sha224.json @@ -0,0 +1 @@ +{"agent":"hash","method":"sha224","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_sha224_test.py"}]} diff --git a/iguana/help/hash_sha256.json b/iguana/help/hash_sha256.json new file mode 100644 index 000000000..f7350d129 --- /dev/null +++ b/iguana/help/hash_sha256.json @@ -0,0 +1 @@ +{"agent":"hash","method":"sha256","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_sha256_test.py"}]} diff --git a/iguana/help/hash_sha256_sha256.json b/iguana/help/hash_sha256_sha256.json new file mode 100644 index 000000000..7f750db03 --- /dev/null +++ b/iguana/help/hash_sha256_sha256.json @@ -0,0 +1 @@ +{"agent":"hash","method":"sha256_sha256","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_sha256_sha256_test.py"}]} diff --git a/iguana/help/hash_sha384.json b/iguana/help/hash_sha384.json new file mode 100644 index 000000000..9c3a29487 --- /dev/null +++ b/iguana/help/hash_sha384.json @@ -0,0 +1 @@ +{"agent":"hash","method":"sha384","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_sha384_test.py"}]} diff --git a/iguana/help/hash_sha512.json b/iguana/help/hash_sha512.json new file mode 100644 index 000000000..1b43f3a27 --- /dev/null +++ b/iguana/help/hash_sha512.json @@ -0,0 +1 @@ +{"agent":"hash","method":"sha512","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_sha512_test.py"}]} diff --git a/iguana/help/hash_tiger192_3.json b/iguana/help/hash_tiger192_3.json new file mode 100644 index 000000000..e48f284fb --- /dev/null +++ b/iguana/help/hash_tiger192_3.json @@ -0,0 +1 @@ +{"agent":"hash","method":"tiger192_3","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_tiger192_3_test.py"}]} diff --git a/iguana/help/hash_unhex.json b/iguana/help/hash_unhex.json new file mode 100644 index 000000000..860f3c3c8 --- /dev/null +++ b/iguana/help/hash_unhex.json @@ -0,0 +1 @@ +{"agent":"hash","method":"unhex","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_unhex_test.py"}]} diff --git a/iguana/help/hash_whirlpool.json b/iguana/help/hash_whirlpool.json new file mode 100644 index 000000000..6c84f55b0 --- /dev/null +++ b/iguana/help/hash_whirlpool.json @@ -0,0 +1 @@ +{"agent":"hash","method":"whirlpool","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hash_whirlpool_test.py"}]} diff --git a/iguana/help/hmac_md2.json b/iguana/help/hmac_md2.json new file mode 100644 index 000000000..3a39c448b --- /dev/null +++ b/iguana/help/hmac_md2.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"md2","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_md2_test.py"}]} diff --git a/iguana/help/hmac_md4.json b/iguana/help/hmac_md4.json new file mode 100644 index 000000000..fdb646593 --- /dev/null +++ b/iguana/help/hmac_md4.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"md4","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_md4_test.py"}]} diff --git a/iguana/help/hmac_md5.json b/iguana/help/hmac_md5.json new file mode 100644 index 000000000..cd9021def --- /dev/null +++ b/iguana/help/hmac_md5.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"md5","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_md5_test.py"}]} diff --git a/iguana/help/hmac_rmd128.json b/iguana/help/hmac_rmd128.json new file mode 100644 index 000000000..a5c10722b --- /dev/null +++ b/iguana/help/hmac_rmd128.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"rmd128","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_rmd128_test.py"}]} diff --git a/iguana/help/hmac_rmd160.json b/iguana/help/hmac_rmd160.json new file mode 100644 index 000000000..114d560d9 --- /dev/null +++ b/iguana/help/hmac_rmd160.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"rmd160","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_rmd160_test.py"}]} diff --git a/iguana/help/hmac_rmd256.json b/iguana/help/hmac_rmd256.json new file mode 100644 index 000000000..836887c38 --- /dev/null +++ b/iguana/help/hmac_rmd256.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"rmd256","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_rmd256_test.py"}]} diff --git a/iguana/help/hmac_rmd320.json b/iguana/help/hmac_rmd320.json new file mode 100644 index 000000000..a7f0a94f8 --- /dev/null +++ b/iguana/help/hmac_rmd320.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"rmd320","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_rmd320_test.py"}]} diff --git a/iguana/help/hmac_sha1.json b/iguana/help/hmac_sha1.json new file mode 100644 index 000000000..beef6ef79 --- /dev/null +++ b/iguana/help/hmac_sha1.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"sha1","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_sha1_test.py"}]} diff --git a/iguana/help/hmac_sha224.json b/iguana/help/hmac_sha224.json new file mode 100644 index 000000000..e665184e1 --- /dev/null +++ b/iguana/help/hmac_sha224.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"sha224","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_sha224_test.py"}]} diff --git a/iguana/help/hmac_sha256.json b/iguana/help/hmac_sha256.json new file mode 100644 index 000000000..ae082aa6d --- /dev/null +++ b/iguana/help/hmac_sha256.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"sha256","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_sha256_test.py"}]} diff --git a/iguana/help/hmac_sha384.json b/iguana/help/hmac_sha384.json new file mode 100644 index 000000000..cadfef49d --- /dev/null +++ b/iguana/help/hmac_sha384.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"sha384","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_sha384_test.py"}]} diff --git a/iguana/help/hmac_sha512.json b/iguana/help/hmac_sha512.json new file mode 100644 index 000000000..c2aed013b --- /dev/null +++ b/iguana/help/hmac_sha512.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"sha512","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_sha512_test.py"}]} diff --git a/iguana/help/hmac_tiger192_3.json b/iguana/help/hmac_tiger192_3.json new file mode 100644 index 000000000..c7b776d69 --- /dev/null +++ b/iguana/help/hmac_tiger192_3.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"tiger192_3","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_tiger192_3_test.py"}]} diff --git a/iguana/help/hmac_whirlpool.json b/iguana/help/hmac_whirlpool.json new file mode 100644 index 000000000..b85e3940e --- /dev/null +++ b/iguana/help/hmac_whirlpool.json @@ -0,0 +1 @@ +{"agent":"hmac","method":"whirlpool","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"hmac_whirlpool_test.py"}]} diff --git a/iguana/help/iguana_PoSweights.json b/iguana/help/iguana_PoSweights.json new file mode 100644 index 000000000..d5597f13c --- /dev/null +++ b/iguana/help/iguana_PoSweights.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"PoSweights","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_PoSweights_test.py"}]} diff --git a/iguana/help/iguana_addcoin.json b/iguana/help/iguana_addcoin.json new file mode 100644 index 000000000..0bfaaf6de --- /dev/null +++ b/iguana/help/iguana_addcoin.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"addcoin","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_addcoin_test.py"}]} diff --git a/iguana/help/iguana_addnode.json b/iguana/help/iguana_addnode.json new file mode 100644 index 000000000..1dcf66ce8 --- /dev/null +++ b/iguana/help/iguana_addnode.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"addnode","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_addnode_test.py"}]} diff --git a/iguana/help/iguana_addnotary.json b/iguana/help/iguana_addnotary.json new file mode 100644 index 000000000..c57b97435 --- /dev/null +++ b/iguana/help/iguana_addnotary.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"addnotary","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_addnotary_test.py"}]} diff --git a/iguana/help/iguana_balance.json b/iguana/help/iguana_balance.json new file mode 100644 index 000000000..b84a65f42 --- /dev/null +++ b/iguana/help/iguana_balance.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"balance","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_balance_test.py"}]} diff --git a/iguana/help/iguana_bundleaddresses.json b/iguana/help/iguana_bundleaddresses.json new file mode 100644 index 000000000..f80caee90 --- /dev/null +++ b/iguana/help/iguana_bundleaddresses.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"bundleaddresses","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_bundleaddresses_test.py"}]} diff --git a/iguana/help/iguana_bundlehashes.json b/iguana/help/iguana_bundlehashes.json new file mode 100644 index 000000000..2eddf7a38 --- /dev/null +++ b/iguana/help/iguana_bundlehashes.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"bundlehashes","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_bundlehashes_test.py"}]} diff --git a/iguana/help/iguana_dividends.json b/iguana/help/iguana_dividends.json new file mode 100644 index 000000000..222489389 --- /dev/null +++ b/iguana/help/iguana_dividends.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"dividends","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_dividends_test.py"}]} diff --git a/iguana/help/iguana_dpow.json b/iguana/help/iguana_dpow.json new file mode 100644 index 000000000..6e54c8629 --- /dev/null +++ b/iguana/help/iguana_dpow.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"dpow","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_dpow_test.py"}]} diff --git a/iguana/help/iguana_getconnectioncount.json b/iguana/help/iguana_getconnectioncount.json new file mode 100644 index 000000000..4b3ee5ad7 --- /dev/null +++ b/iguana/help/iguana_getconnectioncount.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"getconnectioncount","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_getconnectioncount_test.py"}]} diff --git a/iguana/help/iguana_initfastfind.json b/iguana/help/iguana_initfastfind.json new file mode 100644 index 000000000..1de530d85 --- /dev/null +++ b/iguana/help/iguana_initfastfind.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"initfastfind","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_initfastfind_test.py"}]} diff --git a/iguana/help/iguana_makekeypair.json b/iguana/help/iguana_makekeypair.json new file mode 100644 index 000000000..1d70e412e --- /dev/null +++ b/iguana/help/iguana_makekeypair.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"makekeypair","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_makekeypair_test.py"}]} diff --git a/iguana/help/iguana_maxpeers.json b/iguana/help/iguana_maxpeers.json new file mode 100644 index 000000000..0f67ebfe4 --- /dev/null +++ b/iguana/help/iguana_maxpeers.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"maxpeers","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_maxpeers_test.py"}]} diff --git a/iguana/help/iguana_nodestatus.json b/iguana/help/iguana_nodestatus.json new file mode 100644 index 000000000..e3937827a --- /dev/null +++ b/iguana/help/iguana_nodestatus.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"nodestatus","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_nodestatus_test.py"}]} diff --git a/iguana/help/iguana_oneshot.json b/iguana/help/iguana_oneshot.json new file mode 100644 index 000000000..5157a0be7 --- /dev/null +++ b/iguana/help/iguana_oneshot.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"oneshot","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_oneshot_test.py"}]} diff --git a/iguana/help/iguana_passthru.json b/iguana/help/iguana_passthru.json new file mode 100644 index 000000000..a7203ba08 --- /dev/null +++ b/iguana/help/iguana_passthru.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"passthru","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_passthru_test.py"}]} diff --git a/iguana/help/iguana_pausecoin.json b/iguana/help/iguana_pausecoin.json new file mode 100644 index 000000000..ada16880b --- /dev/null +++ b/iguana/help/iguana_pausecoin.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"pausecoin","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_pausecoin_test.py"}]} diff --git a/iguana/help/iguana_peers.json b/iguana/help/iguana_peers.json new file mode 100644 index 000000000..75a498b7e --- /dev/null +++ b/iguana/help/iguana_peers.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"peers","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_peers_test.py"}]} diff --git a/iguana/help/iguana_persistent.json b/iguana/help/iguana_persistent.json new file mode 100644 index 000000000..14953397f --- /dev/null +++ b/iguana/help/iguana_persistent.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"persistent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_persistent_test.py"}]} diff --git a/iguana/help/iguana_prices.json b/iguana/help/iguana_prices.json new file mode 100644 index 000000000..a1b02f625 --- /dev/null +++ b/iguana/help/iguana_prices.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"prices","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_prices_test.py"}]} diff --git a/iguana/help/iguana_rate.json b/iguana/help/iguana_rate.json new file mode 100644 index 000000000..94cfec4ab --- /dev/null +++ b/iguana/help/iguana_rate.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"rate","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_rate_test.py"}]} diff --git a/iguana/help/iguana_rates.json b/iguana/help/iguana_rates.json new file mode 100644 index 000000000..678f86b90 --- /dev/null +++ b/iguana/help/iguana_rates.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"rates","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_rates_test.py"}]} diff --git a/iguana/help/iguana_removecoin.json b/iguana/help/iguana_removecoin.json new file mode 100644 index 000000000..e33676b7f --- /dev/null +++ b/iguana/help/iguana_removecoin.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"removecoin","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_removecoin_test.py"}]} diff --git a/iguana/help/iguana_removenode.json b/iguana/help/iguana_removenode.json new file mode 100644 index 000000000..9af62606d --- /dev/null +++ b/iguana/help/iguana_removenode.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"removenode","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_removenode_test.py"}]} diff --git a/iguana/help/iguana_snapshot.json b/iguana/help/iguana_snapshot.json new file mode 100644 index 000000000..c5bd5c3c9 --- /dev/null +++ b/iguana/help/iguana_snapshot.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"snapshot","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_snapshot_test.py"}]} diff --git a/iguana/help/iguana_spendmsig.json b/iguana/help/iguana_spendmsig.json new file mode 100644 index 000000000..7e987d790 --- /dev/null +++ b/iguana/help/iguana_spendmsig.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"spendmsig","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_spendmsig_test.py"}]} diff --git a/iguana/help/iguana_splitfunds.json b/iguana/help/iguana_splitfunds.json new file mode 100644 index 000000000..bdea50ac5 --- /dev/null +++ b/iguana/help/iguana_splitfunds.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"splitfunds","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_splitfunds_test.py"}]} diff --git a/iguana/help/iguana_stakers.json b/iguana/help/iguana_stakers.json new file mode 100644 index 000000000..8fb613dd6 --- /dev/null +++ b/iguana/help/iguana_stakers.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"stakers","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_stakers_test.py"}]} diff --git a/iguana/help/iguana_startcoin.json b/iguana/help/iguana_startcoin.json new file mode 100644 index 000000000..b0a52eaf7 --- /dev/null +++ b/iguana/help/iguana_startcoin.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"startcoin","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_startcoin_test.py"}]} diff --git a/iguana/help/iguana_stopcoin.json b/iguana/help/iguana_stopcoin.json new file mode 100644 index 000000000..802470c20 --- /dev/null +++ b/iguana/help/iguana_stopcoin.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"stopcoin","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_stopcoin_test.py"}]} diff --git a/iguana/help/iguana_validate.json b/iguana/help/iguana_validate.json new file mode 100644 index 000000000..555ed8534 --- /dev/null +++ b/iguana/help/iguana_validate.json @@ -0,0 +1 @@ +{"agent":"iguana","method":"validate","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"iguana_validate_test.py"}]} diff --git a/iguana/help/jumblr_runsilent.json b/iguana/help/jumblr_runsilent.json new file mode 100644 index 000000000..071654a08 --- /dev/null +++ b/iguana/help/jumblr_runsilent.json @@ -0,0 +1 @@ +{"agent":"jumblr","method":"runsilent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"jumblr_runsilent_test.py"}]} diff --git a/iguana/help/jumblr_setpassphrase.json b/iguana/help/jumblr_setpassphrase.json new file mode 100644 index 000000000..abb67bed0 --- /dev/null +++ b/iguana/help/jumblr_setpassphrase.json @@ -0,0 +1 @@ +{"agent":"jumblr","method":"setpassphrase","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"jumblr_setpassphrase_test.py"}]} diff --git a/iguana/help/jumblr_status.json b/iguana/help/jumblr_status.json new file mode 100644 index 000000000..a245ba5db --- /dev/null +++ b/iguana/help/jumblr_status.json @@ -0,0 +1 @@ +{"agent":"jumblr","method":"status","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"jumblr_status_test.py"}]} diff --git a/iguana/help/jumblr_totransparent.json b/iguana/help/jumblr_totransparent.json new file mode 100644 index 000000000..22d1f678d --- /dev/null +++ b/iguana/help/jumblr_totransparent.json @@ -0,0 +1 @@ +{"agent":"jumblr","method":"totransparent","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"jumblr_totransparent_test.py"}]} diff --git a/iguana/help/keyboard_key.json b/iguana/help/keyboard_key.json new file mode 100644 index 000000000..941a0517f --- /dev/null +++ b/iguana/help/keyboard_key.json @@ -0,0 +1 @@ +{"agent":"keyboard","method":"key","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"keyboard_key_test.py"}]} diff --git a/iguana/help/komodo_passthru.json b/iguana/help/komodo_passthru.json new file mode 100644 index 000000000..91e0fc86c --- /dev/null +++ b/iguana/help/komodo_passthru.json @@ -0,0 +1 @@ +{"agent":"komodo","method":"passthru","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"komodo_passthru_test.py"}]} diff --git a/iguana/help/mouse_change.json b/iguana/help/mouse_change.json new file mode 100644 index 000000000..e94100130 --- /dev/null +++ b/iguana/help/mouse_change.json @@ -0,0 +1 @@ +{"agent":"mouse","method":"change","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"mouse_change_test.py"}]} diff --git a/iguana/help/mouse_click.json b/iguana/help/mouse_click.json new file mode 100644 index 000000000..5400603ea --- /dev/null +++ b/iguana/help/mouse_click.json @@ -0,0 +1 @@ +{"agent":"mouse","method":"click","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"mouse_click_test.py"}]} diff --git a/iguana/help/mouse_close.json b/iguana/help/mouse_close.json new file mode 100644 index 000000000..465a680c4 --- /dev/null +++ b/iguana/help/mouse_close.json @@ -0,0 +1 @@ +{"agent":"mouse","method":"close","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"mouse_close_test.py"}]} diff --git a/iguana/help/mouse_image.json b/iguana/help/mouse_image.json new file mode 100644 index 000000000..0fe91b3b0 --- /dev/null +++ b/iguana/help/mouse_image.json @@ -0,0 +1 @@ +{"agent":"mouse","method":"image","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"mouse_image_test.py"}]} diff --git a/iguana/help/mouse_leave.json b/iguana/help/mouse_leave.json new file mode 100644 index 000000000..0102f7c1e --- /dev/null +++ b/iguana/help/mouse_leave.json @@ -0,0 +1 @@ +{"agent":"mouse","method":"leave","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"mouse_leave_test.py"}]} diff --git a/iguana/help/passthru_paxfiats.json b/iguana/help/passthru_paxfiats.json new file mode 100644 index 000000000..48b2d7b57 --- /dev/null +++ b/iguana/help/passthru_paxfiats.json @@ -0,0 +1 @@ +{"agent":"passthru","method":"paxfiats","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"passthru_paxfiats_test.py"}]} diff --git a/iguana/help/pax_start.json b/iguana/help/pax_start.json new file mode 100644 index 000000000..1f053e4f3 --- /dev/null +++ b/iguana/help/pax_start.json @@ -0,0 +1 @@ +{"agent":"pax","method":"start","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"pax_start_test.py"}]} diff --git a/iguana/help/tradebot_accumulate.json b/iguana/help/tradebot_accumulate.json new file mode 100644 index 000000000..e46ec03c3 --- /dev/null +++ b/iguana/help/tradebot_accumulate.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"accumulate","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_accumulate_test.py"}]} diff --git a/iguana/help/tradebot_activebots.json b/iguana/help/tradebot_activebots.json new file mode 100644 index 000000000..1eb5e73e3 --- /dev/null +++ b/iguana/help/tradebot_activebots.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"activebots","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_activebots_test.py"}]} diff --git a/iguana/help/tradebot_allbalances.json b/iguana/help/tradebot_allbalances.json new file mode 100644 index 000000000..93c51ec2b --- /dev/null +++ b/iguana/help/tradebot_allbalances.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"allbalances","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_allbalances_test.py"}]} diff --git a/iguana/help/tradebot_amlp.json b/iguana/help/tradebot_amlp.json new file mode 100644 index 000000000..35f83ec0d --- /dev/null +++ b/iguana/help/tradebot_amlp.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"amlp","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_amlp_test.py"}]} diff --git a/iguana/help/tradebot_anchor.json b/iguana/help/tradebot_anchor.json new file mode 100644 index 000000000..22a7256ae --- /dev/null +++ b/iguana/help/tradebot_anchor.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"anchor","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_anchor_test.py"}]} diff --git a/iguana/help/tradebot_aveprice.json b/iguana/help/tradebot_aveprice.json new file mode 100644 index 000000000..74f8bc1ab --- /dev/null +++ b/iguana/help/tradebot_aveprice.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"aveprice","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_aveprice_test.py"}]} diff --git a/iguana/help/tradebot_divest.json b/iguana/help/tradebot_divest.json new file mode 100644 index 000000000..013d6b795 --- /dev/null +++ b/iguana/help/tradebot_divest.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"divest","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_divest_test.py"}]} diff --git a/iguana/help/tradebot_gensvm.json b/iguana/help/tradebot_gensvm.json new file mode 100644 index 000000000..445aad5db --- /dev/null +++ b/iguana/help/tradebot_gensvm.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"gensvm","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_gensvm_test.py"}]} diff --git a/iguana/help/tradebot_goals.json b/iguana/help/tradebot_goals.json new file mode 100644 index 000000000..eadeab3f1 --- /dev/null +++ b/iguana/help/tradebot_goals.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"goals","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_goals_test.py"}]} diff --git a/iguana/help/tradebot_liquidity.json b/iguana/help/tradebot_liquidity.json new file mode 100644 index 000000000..dc1461790 --- /dev/null +++ b/iguana/help/tradebot_liquidity.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"liquidity","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_liquidity_test.py"}]} diff --git a/iguana/help/tradebot_monitor.json b/iguana/help/tradebot_monitor.json new file mode 100644 index 000000000..31df1db48 --- /dev/null +++ b/iguana/help/tradebot_monitor.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"monitor","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_monitor_test.py"}]} diff --git a/iguana/help/tradebot_monitorall.json b/iguana/help/tradebot_monitorall.json new file mode 100644 index 000000000..16ea650ae --- /dev/null +++ b/iguana/help/tradebot_monitorall.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"monitorall","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_monitorall_test.py"}]} diff --git a/iguana/help/tradebot_notlp.json b/iguana/help/tradebot_notlp.json new file mode 100644 index 000000000..ed462ecf4 --- /dev/null +++ b/iguana/help/tradebot_notlp.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"notlp","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_notlp_test.py"}]} diff --git a/iguana/help/tradebot_openliquidity.json b/iguana/help/tradebot_openliquidity.json new file mode 100644 index 000000000..961e6f424 --- /dev/null +++ b/iguana/help/tradebot_openliquidity.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"openliquidity","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_openliquidity_test.py"}]} diff --git a/iguana/help/tradebot_pause.json b/iguana/help/tradebot_pause.json new file mode 100644 index 000000000..81c641f28 --- /dev/null +++ b/iguana/help/tradebot_pause.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"pause","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_pause_test.py"}]} diff --git a/iguana/help/tradebot_portfolio.json b/iguana/help/tradebot_portfolio.json new file mode 100644 index 000000000..50b646579 --- /dev/null +++ b/iguana/help/tradebot_portfolio.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"portfolio","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_portfolio_test.py"}]} diff --git a/iguana/help/tradebot_resume.json b/iguana/help/tradebot_resume.json new file mode 100644 index 000000000..745666320 --- /dev/null +++ b/iguana/help/tradebot_resume.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"resume","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_resume_test.py"}]} diff --git a/iguana/help/tradebot_status.json b/iguana/help/tradebot_status.json new file mode 100644 index 000000000..1289541a5 --- /dev/null +++ b/iguana/help/tradebot_status.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"status","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_status_test.py"}]} diff --git a/iguana/help/tradebot_stop.json b/iguana/help/tradebot_stop.json new file mode 100644 index 000000000..d948d48c6 --- /dev/null +++ b/iguana/help/tradebot_stop.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"stop","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_stop_test.py"}]} diff --git a/iguana/help/tradebot_unmonitor.json b/iguana/help/tradebot_unmonitor.json new file mode 100644 index 000000000..992a768ef --- /dev/null +++ b/iguana/help/tradebot_unmonitor.json @@ -0,0 +1 @@ +{"agent":"tradebot","method":"unmonitor","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"tradebot_unmonitor_test.py"}]} diff --git a/iguana/help/zcash_passthru.json b/iguana/help/zcash_passthru.json new file mode 100644 index 000000000..657b16dfd --- /dev/null +++ b/iguana/help/zcash_passthru.json @@ -0,0 +1 @@ +{"agent":"zcash","method":"passthru","field0":"put in helpful info field0","field1":"put in helpful info for field1","help":"put helpful info here","teststatus":[{"tester":"bob","result":"put result here","notes":"put useful notes here","automated":"notyet","sourcefile":"zcash_passthru_test.py"}]} From 59f86d423753bb63ef2c81c1d539b904fc57d385 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 16:31:42 +0300 Subject: [PATCH 037/346] Test --- iguana/exchanges/LP_remember.c | 5 +++-- iguana/exchanges/LP_transaction.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index f34f92c43..275de09fa 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -264,6 +264,7 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag if ( bits256_nonz(spendtxid) != 0 ) { sentflags[utxoind] = 1; + printf("utxoind.%d Alice.(%s) Bob.(%s)\n",utxoind,aliceaddr,bobaddr); if ( aliceaddr != 0 && strcmp(destaddr,aliceaddr) == 0 ) { printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); @@ -1089,10 +1090,10 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) array = cJSON_CreateArray(); if ( origrequestid != 0 && origquoteid != 0 ) { - printf("orig req.%u q.%u\n",origrequestid,origquoteid); + //printf("orig req.%u q.%u\n",origrequestid,origquoteid); if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 ) jaddi(array,item); - printf("got.(%s)\n",jprint(item,0)); + //printf("got.(%s)\n",jprint(item,0)); } else { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 08fd99eb1..484c59a50 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -560,7 +560,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ return(complete); } -char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,void *ctx,bits256 privkey,bits256 *privkey2p,uint8_t *redeemscript,int32_t redeemlen,uint8_t *userdata,int32_t userdatalen,bits256 utxotxid,int32_t vout,char *destaddr,uint8_t *pubkey33,int32_t finalseqid,uint32_t expiration,int64_t *destamountp,uint64_t satoshis,char *changeaddr,char *vinaddr,int32_t suppress_pubkeys) +char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,void *ctx,bits256 privkey,bits256 *privkey2p,uint8_t *redeemscript,int32_t redeemlen,uint8_t *userdata,int32_t userdatalen,bits256 utxotxid,int32_t utxovout,char *destaddr,uint8_t *pubkey33,int32_t finalseqid,uint32_t expiration,int64_t *destamountp,uint64_t satoshis,char *changeaddr,char *vinaddr,int32_t suppress_pubkeys) { char *rawtxbytes=0,*signedtx=0,str[65],tmpaddr[64],hexstr[999],wifstr[128],_destaddr[64]; uint8_t spendscript[512],addrtype,rmd160[20]; cJSON *txobj,*vins,*obj,*vouts,*item,*privkeys; int32_t completed,spendlen,n,ignore_cltverr=1; struct vin_info V[2]; uint32_t timestamp,locktime = 0,sequenceid = 0xffffffff * finalseqid; bits256 txid; uint64_t value=0,change = 0; struct iguana_msgtx msgtx; struct iguana_info *coin; if ( txfee > 0 && txfee < 10000 ) @@ -578,9 +578,9 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch { if ( (txobj= LP_gettx(symbol,utxotxid)) != 0 ) { - if ( (vouts= jarray(&n,txobj,"vout")) != 0 && vout < n ) + if ( (vouts= jarray(&n,txobj,"vout")) != 0 && utxovout < n ) { - obj = jitem(vouts,vout); + obj = jitem(vouts,utxovout); value = LP_value_extract(obj,1); //printf("value in vout.%d %.8f (%s)\n",vout,dstr(value),jprint(txobj,0)); } From 761709fdb2ed1f314ee225325b09a22b750fda4a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 16:58:52 +0300 Subject: [PATCH 038/346] Test --- iguana/exchanges/LP_remember.c | 5 +++++ iguana/exchanges/LP_transaction.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 275de09fa..c19d52129 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -705,7 +705,12 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) if ( (coin= LP_coinfind(symbol)) != 0 && (ht= LP_txheight(coin,txid)) > 0 && ht > 0 ) { if ( coin->firstrefht == 0 || ht < coin->firstrefht ) + { + if ( coin->firstscanht == 0 || ht < coin->firstscanht ) + coin->firstscanht = coin->lastscanht = ht; coin->firstrefht = ht; + printf(">>>>>>>>. 1st refht %s <- %d, scan %d %d\n",coin->symbol,ht,coin->firstscanht,coin->lastscanht); + } } if ( bits256_nonz(checktxid) == 0 ) checktxid = jbits256(sentobj,"hash"); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 484c59a50..a7b69ec80 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -587,10 +587,10 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch free_json(txobj); //if ( value != 0 ) // gettxout - } + } else printf("cant gettx\n"); if ( value == 0 ) { - printf("basilisk_swap_bobtxspend.%s %s utxo.(%s) already spent or doesnt exist\n",name,symbol,bits256_str(str,utxotxid)); + printf("basilisk_swap_bobtxspend.%s %s utxo.(%s).v%d already spent or doesnt exist\n",name,symbol,bits256_str(str,utxotxid),utxovout); return(0); } } From d0cd2f61ede1a2b8bcae07b415f9664e21d4aeb1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:02:35 +0300 Subject: [PATCH 039/346] Test --- iguana/exchanges/LP_remember.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index c19d52129..fa3c6d1a6 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -826,6 +826,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } + printf("ALICE 1st refht %s <- %d, scan %d %d\n",alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); + printf("BOB 1st refht %s <- %d, scan %d %d\n",bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); From 505bedb910f0459efce2a90667e8c0f600af0c12 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:04:54 +0300 Subject: [PATCH 040/346] Test --- iguana/exchanges/LP_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index a7b69ec80..a5d66d712 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -660,7 +660,7 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch jaddstr(item,"userdata",hexstr); } jaddbits256(item,"txid",utxotxid); - jaddnum(item,"vout",vout); + jaddnum(item,"vout",utxovout); bitcoin_address(tmpaddr,taddr,pubtype,pubkey33,33); bitcoin_addr2rmd160(taddr,&addrtype,rmd160,tmpaddr); if ( redeemlen != 0 ) From d918b04040b47fb8d702c2ad316a3a16a0387967 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:11:46 +0300 Subject: [PATCH 041/346] Test --- iguana/exchanges/LP_remember.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index fa3c6d1a6..6ba98c7e3 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -622,6 +622,24 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t return(rswap->iambob); } +void LP_refht_update(char *symbol,bits256 txid) +{ + int32_t ht; struct iguana_info *coin; + if ( (coin= LP_coinfind(symbol)) != 0 ) // && coin->electrum == 0 + { + if ( (ht= LP_txheight(coin,txid)) > 0 && ht > 0 ) + { + if ( coin->firstrefht == 0 || ht < coin->firstrefht ) + { + if ( coin->firstscanht == 0 || ht < coin->firstscanht ) + coin->firstscanht = coin->lastscanht = ht; + coin->firstrefht = ht; + printf(">>>>>>>>. 1st refht %s <- %d, scan %d %d\n",coin->symbol,ht,coin->firstscanht,coin->lastscanht); + } + } + } +} + int32_t LP_swap_load(struct LP_swap_remember *rswap) { int32_t i,needflag,addflag; long fsize; char fname[1024],str[65],*fstr,*symbol,*rstr; cJSON *txobj,*sentobj; bits256 txid,checktxid; uint64_t value; @@ -694,24 +712,14 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin)); if ( rswap->finishedflag == 0 ) { + LP_refht_update(symbol,txid); if ( (sentobj= LP_gettx(symbol,txid)) == 0 ) { char str2[65]; printf("%s %s ready to broadcast\n",symbol,bits256_str(str2,txid)); } else { - struct iguana_info *coin; int32_t ht = -1; checktxid = jbits256(sentobj,"txid"); - if ( (coin= LP_coinfind(symbol)) != 0 && (ht= LP_txheight(coin,txid)) > 0 && ht > 0 ) - { - if ( coin->firstrefht == 0 || ht < coin->firstrefht ) - { - if ( coin->firstscanht == 0 || ht < coin->firstscanht ) - coin->firstscanht = coin->lastscanht = ht; - coin->firstrefht = ht; - printf(">>>>>>>>. 1st refht %s <- %d, scan %d %d\n",coin->symbol,ht,coin->firstscanht,coin->lastscanht); - } - } if ( bits256_nonz(checktxid) == 0 ) checktxid = jbits256(sentobj,"hash"); if ( bits256_cmp(checktxid,txid) == 0 ) @@ -769,6 +777,7 @@ int32_t LP_rswap_checktx(struct LP_swap_remember *rswap,char *symbol,int32_t txi { rswap->sentflags[txi] = 1; free_json(sentobj); + LP_refht_update(symbol,rswap->txids[txi]); return(1); } } From 23a2aa6a2ddc493fed49dfd650209fbfa6eb493a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:18:32 +0300 Subject: [PATCH 042/346] Test --- iguana/exchanges/LP_utxo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 5916b14b9..960d3c0d9 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -671,9 +671,9 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) if ( bits256_nonz(blockhash) != 0 && (blockobj= LP_getblock(coin->symbol,blockhash)) != 0 ) { height = jint(blockobj,"height"); - //printf("%s LP_txheight.%d\n",coin->symbol,height); + char str[65]; printf("%s %s LP_txheight.%d\n",coin->symbol,bits256_str(str,txid),height); free_json(blockobj); - } //else printf("%s LP_txheight error (%s)\n",coin->symbol,jprint(txobj,0)); + } else printf("%s LP_txheight error (%s)\n",coin->symbol,jprint(txobj,0)); free_json(txobj); } } From 6160dd36b8e31dee3d44a04c615ddf37378e0b5a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:23:42 +0300 Subject: [PATCH 043/346] Test --- iguana/exchanges/LP_remember.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 6ba98c7e3..e1754ffb4 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -634,7 +634,7 @@ void LP_refht_update(char *symbol,bits256 txid) if ( coin->firstscanht == 0 || ht < coin->firstscanht ) coin->firstscanht = coin->lastscanht = ht; coin->firstrefht = ht; - printf(">>>>>>>>. 1st refht %s <- %d, scan %d %d\n",coin->symbol,ht,coin->firstscanht,coin->lastscanht); + char str[65]; printf(">>>>>>>>. 1st refht %s %s <- %d, scan %d %d\n",coin->symbol,bits256_str(str,txid),ht,coin->firstscanht,coin->lastscanht); } } } From fe5fb6b823195fa51fca2806eddb6561c7f76269 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:27:18 +0300 Subject: [PATCH 044/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 960d3c0d9..d33889a7b 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -673,7 +673,7 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) height = jint(blockobj,"height"); char str[65]; printf("%s %s LP_txheight.%d\n",coin->symbol,bits256_str(str,txid),height); free_json(blockobj); - } else printf("%s LP_txheight error (%s)\n",coin->symbol,jprint(txobj,0)); + } // else printf("%s LP_txheight error (%s)\n",coin->symbol,jprint(txobj,0)); likely just unconfirmed free_json(txobj); } } From 5cc93e0605bcd2750e397f3276c509c2344897b6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:32:23 +0300 Subject: [PATCH 045/346] Test --- iguana/exchanges/LP_rpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index e8d24761c..8def0e8e3 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -254,7 +254,9 @@ cJSON *LP_gettx(char *symbol,bits256 txid) if ( coin->electrum == 0 ) { sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid)); - return(bitcoin_json(coin,"getrawtransaction",buf)); + retjson = bitcoin_json(coin,"getrawtransaction",buf); + printf("%s getrawtransaction %s -> %s\n",symbol,buf,jprint(retjson,0)); + return(retjson); } else { From 3d25ac4764202191bf71e1c45a1d76965be84f0e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:36:47 +0300 Subject: [PATCH 046/346] Test --- iguana/exchanges/LP_rpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 8def0e8e3..a0f7a2151 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -255,7 +255,8 @@ cJSON *LP_gettx(char *symbol,bits256 txid) { sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid)); retjson = bitcoin_json(coin,"getrawtransaction",buf); - printf("%s getrawtransaction %s -> %s\n",symbol,buf,jprint(retjson,0)); + if ( jobj(retjson,"vin") == 0 ) + printf("%s getrawtransaction %s -> %s\n",symbol,buf,jprint(retjson,0)); return(retjson); } else From cb6ac53b2f057ded5fa94fdfc45f1ec1750a4783 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 17:46:18 +0300 Subject: [PATCH 047/346] Test --- iguana/exchanges/LP_remember.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index e1754ffb4..2fac6667e 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -771,11 +771,12 @@ int32_t LP_rswap_checktx(struct LP_swap_remember *rswap,char *symbol,int32_t txi if ( rswap->sentflags[txi] == 0 && bits256_nonz(rswap->txids[txi]) != 0 ) { printf("[%s] txbytes.%p Apayment.%s\n",txnames[txi],rswap->txbytes[txi],bits256_str(str,rswap->txids[txi])); - if ( rswap->txbytes[txi] != 0 ) + /*if ( rswap->txbytes[txi] != 0 ) rswap->sentflags[txi] = 1; - else if ( (sentobj= LP_gettx(symbol,rswap->txids[txi])) != 0 ) + else*/ if ( (sentobj= LP_gettx(symbol,rswap->txids[txi])) != 0 ) { rswap->sentflags[txi] = 1; + printf("CHECKTX.(%s)\n",jprint(sentobj,0)); free_json(sentobj); LP_refht_update(symbol,rswap->txids[txi]); return(1); From cdf13ab0721c5f79b27a869021783d998a691c85 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 18:12:04 +0300 Subject: [PATCH 048/346] Test --- iguana/exchanges/LP_remember.c | 46 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 2fac6667e..47907d8c5 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -622,22 +622,30 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t return(rswap->iambob); } -void LP_refht_update(char *symbol,bits256 txid) +int32_t _LP_refht_update(struct iguana_info *coin,int32_t refht) { - int32_t ht; struct iguana_info *coin; + if ( refht > 0 && (coin->firstrefht == 0 || refht < coin->firstrefht) ) + { + if ( coin->firstscanht == 0 || refht < coin->firstscanht ) + coin->firstscanht = coin->lastscanht = refht; + coin->firstrefht = refht; + return(1); + } + return(0); +} + +int32_t LP_refht_update(char *symbol,bits256 txid) +{ + int32_t refht; struct iguana_info *coin; if ( (coin= LP_coinfind(symbol)) != 0 ) // && coin->electrum == 0 { - if ( (ht= LP_txheight(coin,txid)) > 0 && ht > 0 ) + if ( (refht= LP_txheight(coin,txid)) > 0 && refht > 0 ) { - if ( coin->firstrefht == 0 || ht < coin->firstrefht ) - { - if ( coin->firstscanht == 0 || ht < coin->firstscanht ) - coin->firstscanht = coin->lastscanht = ht; - coin->firstrefht = ht; - char str[65]; printf(">>>>>>>>. 1st refht %s %s <- %d, scan %d %d\n",coin->symbol,bits256_str(str,txid),ht,coin->firstscanht,coin->lastscanht); - } + char str[65]; printf(">>>>>>>>. 1st refht %s %s <- %d, scan %d %d\n",coin->symbol,bits256_str(str,txid),refht,coin->firstscanht,coin->lastscanht); + return(_LP_refht_update(coin,refht)); } } + return(0); } int32_t LP_swap_load(struct LP_swap_remember *rswap) @@ -712,7 +720,6 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin)); if ( rswap->finishedflag == 0 ) { - LP_refht_update(symbol,txid); if ( (sentobj= LP_gettx(symbol,txid)) == 0 ) { char str2[65]; printf("%s %s ready to broadcast\n",symbol,bits256_str(str2,txid)); @@ -722,6 +729,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) checktxid = jbits256(sentobj,"txid"); if ( bits256_nonz(checktxid) == 0 ) checktxid = jbits256(sentobj,"hash"); + LP_refht_update(symbol,txid); if ( bits256_cmp(checktxid,txid) == 0 ) { //printf(">>>>>> %s txid %s\n",jprint(sentobj,0),bits256_str(str,txid)); @@ -767,20 +775,16 @@ void LP_txbytes_update(char *name,char *symbol,char *txbytes,bits256 *txidp,bits int32_t LP_rswap_checktx(struct LP_swap_remember *rswap,char *symbol,int32_t txi) { - cJSON *sentobj; char str[65]; + struct LP_transaction *tx; struct iguana_info *coin; char str[65]; if ( rswap->sentflags[txi] == 0 && bits256_nonz(rswap->txids[txi]) != 0 ) { - printf("[%s] txbytes.%p Apayment.%s\n",txnames[txi],rswap->txbytes[txi],bits256_str(str,rswap->txids[txi])); - /*if ( rswap->txbytes[txi] != 0 ) - rswap->sentflags[txi] = 1; - else*/ if ( (sentobj= LP_gettx(symbol,rswap->txids[txi])) != 0 ) + coin = LP_coinfind(symbol); + printf("[%s] %s txbytes.%p %s\n",txnames[txi],txnames[txi],rswap->txbytes[txi],bits256_str(str,rswap->txids[txi])); + if ( coin != 0 && (tx= LP_transactionfind(coin,rswap->txids[txi])) != 0 && tx->height > 0 ) { rswap->sentflags[txi] = 1; - printf("CHECKTX.(%s)\n",jprint(sentobj,0)); - free_json(sentobj); - LP_refht_update(symbol,rswap->txids[txi]); - return(1); - } + _LP_refht_update(coin,tx->height); + } else LP_refht_update(symbol,rswap->txids[txi]); } return(0); } From 92652b2da6fcdfbe086a4188392e2f63f6764467 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 18:34:57 +0300 Subject: [PATCH 049/346] Test --- iguana/exchanges/LP_remember.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 47907d8c5..93df5b907 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -244,7 +244,7 @@ bits256 basilisk_swap_privBn_extract(bits256 *bobrefundp,char *bobcoin,bits256 b return(privBn); } -bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflags,bits256 *txids,int32_t utxoind,int32_t alicespent,int32_t bobspent,int32_t vout,char *aliceaddr,char *bobaddr) +bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflags,bits256 *txids,int32_t utxoind,int32_t alicespent,int32_t bobspent,int32_t vout,char *aliceaddr,char *bobaddr,char *Adest,char *dest) { bits256 spendtxid,txid; char destaddr[64],str[65]; struct iguana_info *coin; cJSON *histobj; if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) @@ -265,14 +265,14 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag { sentflags[utxoind] = 1; printf("utxoind.%d Alice.(%s) Bob.(%s)\n",utxoind,aliceaddr,bobaddr); - if ( aliceaddr != 0 && strcmp(destaddr,aliceaddr) == 0 ) + if ( aliceaddr != 0 && (strcmp(destaddr,aliceaddr) == 0 || strcmp(Adest,destaddr) == 0) ) { printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); sentflags[alicespent] = 1; sentflags[bobspent] = 0; txids[alicespent] = spendtxid; } - else if ( bobaddr != 0 && strcmp(destaddr,bobaddr) == 0 ) + else if ( bobaddr != 0 && (strcmp(destaddr,bobaddr) == 0 || strcmp(dest,destaddr) == 0) ) { printf("BOB spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); sentflags[bobspent] = 1; @@ -284,13 +284,13 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); if ( aliceaddr != 0 ) { - sentflags[bobspent] = 1; + sentflags[bobspent] = 0; sentflags[alicespent] = 0; txids[bobspent] = spendtxid; } else if ( bobaddr != 0 ) { - sentflags[alicespent] = 1; + sentflags[alicespent] = 0; sentflags[bobspent] = 0; txids[alicespent] = spendtxid; } @@ -840,8 +840,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } - printf("ALICE 1st refht %s <- %d, scan %d %d\n",alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); - printf("BOB 1st refht %s <- %d, scan %d %d\n",bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); + printf("ALICE.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.Adestaddr,alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); + printf("BOB.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.destaddr,bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); @@ -855,9 +855,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti LP_rswap_checktx(&rswap,rswap.alicecoin,BASILISK_ALICEPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBDEPOSIT); - rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,Adest,Bdest); - rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,AAdest,ABdest); - rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,Adest,Bdest); + rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); + rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,AAdest,ABdest,rswap.Adestaddr,rswap.destaddr); + rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); if ( rswap.iambob == 0 ) { From 5b570d0f95d4ec58f7faff07b61bad8d4ac36dc4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 18:38:48 +0300 Subject: [PATCH 050/346] Test --- iguana/exchanges/LP_utxo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index d33889a7b..85f5cd9db 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -671,7 +671,9 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) if ( bits256_nonz(blockhash) != 0 && (blockobj= LP_getblock(coin->symbol,blockhash)) != 0 ) { height = jint(blockobj,"height"); - char str[65]; printf("%s %s LP_txheight.%d\n",coin->symbol,bits256_str(str,txid),height); + char str[65]; + if ( strcmp(coin->symbol,"CHIPS") != 0 && strcmp(coin->symbol,"BTC") != 0 ) + printf("%s %s LP_txheight.%d\n",coin->symbol,bits256_str(str,txid),height); free_json(blockobj); } // else printf("%s LP_txheight error (%s)\n",coin->symbol,jprint(txobj,0)); likely just unconfirmed free_json(txobj); From 94be3c821f346d9851de0e7e64f40c15c352e179 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 18:42:52 +0300 Subject: [PATCH 051/346] Test --- iguana/exchanges/LP_rpc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index a0f7a2151..611085e48 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -255,8 +255,11 @@ cJSON *LP_gettx(char *symbol,bits256 txid) { sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid)); retjson = bitcoin_json(coin,"getrawtransaction",buf); - if ( jobj(retjson,"vin") == 0 ) + if ( strcmp(coin->symbol,"CHIPS") != 0 && strcmp(coin->symbol,"BTC") != 0 ) + { + //if ( jobj(retjson,"vin") == 0 ) printf("%s getrawtransaction %s -> %s\n",symbol,buf,jprint(retjson,0)); + } return(retjson); } else From e8b82b871eae18216cfe0f3fb247849470bbaabd Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 18:49:28 +0300 Subject: [PATCH 052/346] Test --- iguana/exchanges/LP_rpc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 611085e48..2c0d49888 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -133,7 +133,8 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params); if ( retstr != 0 && retstr[0] != 0 ) { - //printf("%s: %s.%s -> (%s)\n",coin->symbol,method,params,retstr); + if ( strcmp("KMD",coin->symbol) == 0 ) + printf("%s: %s.%s -> (%s)\n",coin->symbol,method,params,retstr); retjson = cJSON_Parse(retstr); free(retstr); } @@ -255,7 +256,7 @@ cJSON *LP_gettx(char *symbol,bits256 txid) { sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid)); retjson = bitcoin_json(coin,"getrawtransaction",buf); - if ( strcmp(coin->symbol,"CHIPS") != 0 && strcmp(coin->symbol,"BTC") != 0 ) + if ( strcmp(symbol,"CHIPS") != 0 && strcmp(symbol,"BTC") != 0 ) { //if ( jobj(retjson,"vin") == 0 ) printf("%s getrawtransaction %s -> %s\n",symbol,buf,jprint(retjson,0)); From 831733604d1cdd04f7dc863d6d3ea5ebd6c64354 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 19:04:53 +0300 Subject: [PATCH 053/346] Test --- iguana/exchanges/LP_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 2c0d49888..08aec9037 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -131,10 +131,10 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) if ( coin->electrum == 0 ) { retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params); + if ( strcmp("KMD",coin->symbol) == 0 ) + printf("%s: %s.%s -> (%s)\n",coin->symbol,method,params,retstr); if ( retstr != 0 && retstr[0] != 0 ) { - if ( strcmp("KMD",coin->symbol) == 0 ) - printf("%s: %s.%s -> (%s)\n",coin->symbol,method,params,retstr); retjson = cJSON_Parse(retstr); free(retstr); } From 6b3d37be0a785945be427fe5ef0d63ab717c4fa5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 19:08:15 +0300 Subject: [PATCH 054/346] Test --- iguana/exchanges/LP_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 08aec9037..b2c7cf73c 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -132,7 +132,7 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) { retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params); if ( strcmp("KMD",coin->symbol) == 0 ) - printf("%s: %s.%s -> (%s)\n",coin->symbol,method,params,retstr); + printf("%s.(%s %s): %s.%s -> (%s)\n",coin->symbol,coin->serverport,coin->userpass,method,params,retstr); if ( retstr != 0 && retstr[0] != 0 ) { retjson = cJSON_Parse(retstr); From 5cc219e5d4d05825ee2898d94caadb2e028cec45 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 19:20:01 +0300 Subject: [PATCH 055/346] Test --- iguana/exchanges/LP_coins.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 627cbbe2a..079575fe3 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -54,9 +54,9 @@ char *parse_conf_line(char *line,char *field) return(clonestr(line)); } -void LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) +uint16_t LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) { - char *rpcuser,*rpcpassword,*str,line[8192]; + char *rpcuser,*rpcpassword,*str,line[8192]; uint16_t port = 0; rpcuser = rpcpassword = 0; username[0] = password[0] = 0; while ( fgets(line,sizeof(line),fp) != 0 ) @@ -68,6 +68,16 @@ void LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) rpcuser = parse_conf_line(str,(char *)"rpcuser"); else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 ) rpcpassword = parse_conf_line(str,(char *)"rpcpassword"); + else if ( (str= strstr(line,(char *)"rpcport")) != 0 ) + { + str = parse_conf_line(str,(char *)"rpcport"); + if ( str != 0 ) + { + port = atoi(str); + printf("RPCPORT.%u\n",port); + free(str); + } + } } if ( rpcuser != 0 && rpcpassword != 0 ) { @@ -79,6 +89,7 @@ void LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) free(rpcuser); if ( rpcpassword != 0 ) free(rpcpassword); + return(port); } void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name,char *confpath) @@ -143,9 +154,9 @@ void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name strcat(fname,str); } -int32_t LP_userpass(char *userpass,char *symbol,char *assetname,char *confroot,char *name,char *confpath) +uint16_t LP_userpass(char *userpass,char *symbol,char *assetname,char *confroot,char *name,char *confpath,uint16_t origport) { - FILE *fp; char fname[512],username[512],password[512],confname[512]; + FILE *fp; char fname[512],username[512],password[512],confname[512]; uint16_t port = 0; userpass[0] = 0; sprintf(confname,"%s.conf",confroot); if ( 0 ) @@ -160,14 +171,15 @@ int32_t LP_userpass(char *userpass,char *symbol,char *assetname,char *confroot,c LP_statefname(fname,symbol,assetname,confname,name,confpath); if ( (fp= fopen(fname,"rb")) != 0 ) { - LP_userpassfp(symbol,username,password,fp); + if ( (port= LP_userpassfp(symbol,username,password,fp)) == 0 ) + port = origport; sprintf(userpass,"%s:%s",username,password); fclose(fp); if ( 0 ) printf("LP_statefname.(%s) <- %s %s %s (%s) (%s)\n",fname,name,symbol,assetname,userpass,confpath); - return((int32_t)strlen(userpass)); + return(port); } else printf("cant open.(%s)\n",fname); - return(-1); + return(0); } cJSON *LP_coinjson(struct iguana_info *coin,int32_t showwif) @@ -269,7 +281,7 @@ struct iguana_info *LP_coinadd(struct iguana_info *cdata) return(coin); } -int32_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *assetname,int32_t isPoS,uint16_t port,uint8_t pubtype,uint8_t p2shtype,uint8_t wiftype,uint64_t txfee,double estimatedrate,int32_t longestchain,uint8_t wiftaddr,uint8_t taddr,uint16_t busport,char *confpath) +uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *assetname,int32_t isPoS,uint16_t port,uint8_t pubtype,uint8_t p2shtype,uint8_t wiftype,uint64_t txfee,double estimatedrate,int32_t longestchain,uint8_t wiftaddr,uint8_t taddr,uint16_t busport,char *confpath) { char *name2; memset(coin,0,sizeof(*coin)); @@ -296,7 +308,7 @@ int32_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asset coin->noimportprivkey_flag = 1; printf("truncate importprivkey for %s\n",symbol); } - return(LP_userpass(coin->userpass,symbol,assetname,name,name2,confpath)); + return(LP_userpass(coin->userpass,symbol,assetname,name,name2,confpath,port)); } int32_t LP_isdisabled(char *base,char *rel) @@ -339,7 +351,10 @@ struct iguana_info *LP_coinfind(char *symbol) else if ( strcmp(symbol,"KMD") == 0 ) name = "komodo"; else return(0); - isinactive = LP_coininit(&cdata,symbol,name,assetname,isPoS,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain,0,0,busport,0) < 0; + port = LP_coininit(&cdata,symbol,name,assetname,isPoS,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain,0,0,busport,0); + if ( port == 0 ) + isinactive = 1; + else isinactive = 0; if ( (coin= LP_coinadd(&cdata)) != 0 ) { coin->inactive = isinactive * (uint32_t)time(NULL); From 01811ccbb2f0b438efd8d41e25c45671a21719c8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 19:23:17 +0300 Subject: [PATCH 056/346] Test --- iguana/exchanges/LP_coins.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 079575fe3..7cebd164f 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -286,7 +286,6 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse char *name2; memset(coin,0,sizeof(*coin)); safecopy(coin->symbol,symbol,sizeof(coin->symbol)); - sprintf(coin->serverport,"127.0.0.1:%u",port); coin->updaterate = (uint32_t)time(NULL); coin->isPoS = isPoS; coin->taddr = taddr; @@ -308,7 +307,9 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse coin->noimportprivkey_flag = 1; printf("truncate importprivkey for %s\n",symbol); } - return(LP_userpass(coin->userpass,symbol,assetname,name,name2,confpath,port)); + port = LP_userpass(coin->userpass,symbol,assetname,name,name2,confpath,port); + sprintf(coin->serverport,"127.0.0.1:%u",port); + return(port); } int32_t LP_isdisabled(char *base,char *rel) From 45bd5e6e709ea68d23c17f5eed86a814b7aea981 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 19:27:34 +0300 Subject: [PATCH 057/346] Test --- iguana/exchanges/LP_coins.c | 2 +- iguana/exchanges/LP_rpc.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 7cebd164f..224e3a435 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -74,7 +74,7 @@ uint16_t LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) if ( str != 0 ) { port = atoi(str); - printf("RPCPORT.%u\n",port); + //printf("RPCPORT.%u\n",port); free(str); } } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index b2c7cf73c..aa6296325 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -131,7 +131,7 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) if ( coin->electrum == 0 ) { retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params); - if ( strcmp("KMD",coin->symbol) == 0 ) + if ( 0 && strcmp("KMD",coin->symbol) == 0 ) printf("%s.(%s %s): %s.%s -> (%s)\n",coin->symbol,coin->serverport,coin->userpass,method,params,retstr); if ( retstr != 0 && retstr[0] != 0 ) { @@ -256,11 +256,6 @@ cJSON *LP_gettx(char *symbol,bits256 txid) { sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid)); retjson = bitcoin_json(coin,"getrawtransaction",buf); - if ( strcmp(symbol,"CHIPS") != 0 && strcmp(symbol,"BTC") != 0 ) - { - //if ( jobj(retjson,"vin") == 0 ) - printf("%s getrawtransaction %s -> %s\n",symbol,buf,jprint(retjson,0)); - } return(retjson); } else From 7098200f6a6faed20a3ecd8ff5b48ea0d84ed26e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 19:42:38 +0300 Subject: [PATCH 058/346] Test --- iguana/exchanges/LP_remember.c | 12 +++++------- iguana/exchanges/LP_utxo.c | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 93df5b907..edaeb1701 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -622,10 +622,11 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t return(rswap->iambob); } -int32_t _LP_refht_update(struct iguana_info *coin,int32_t refht) +int32_t _LP_refht_update(struct iguana_info *coin,bits256 txid,int32_t refht) { if ( refht > 0 && (coin->firstrefht == 0 || refht < coin->firstrefht) ) { + char str[65]; printf(">>>>>>>>. 1st refht %s %s <- %d, scan %d %d\n",coin->symbol,bits256_str(str,txid),refht,coin->firstscanht,coin->lastscanht); if ( coin->firstscanht == 0 || refht < coin->firstscanht ) coin->firstscanht = coin->lastscanht = refht; coin->firstrefht = refht; @@ -637,13 +638,10 @@ int32_t _LP_refht_update(struct iguana_info *coin,int32_t refht) int32_t LP_refht_update(char *symbol,bits256 txid) { int32_t refht; struct iguana_info *coin; - if ( (coin= LP_coinfind(symbol)) != 0 ) // && coin->electrum == 0 + if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) { if ( (refht= LP_txheight(coin,txid)) > 0 && refht > 0 ) - { - char str[65]; printf(">>>>>>>>. 1st refht %s %s <- %d, scan %d %d\n",coin->symbol,bits256_str(str,txid),refht,coin->firstscanht,coin->lastscanht); - return(_LP_refht_update(coin,refht)); - } + return(_LP_refht_update(coin,txid,refht)); } return(0); } @@ -783,7 +781,7 @@ int32_t LP_rswap_checktx(struct LP_swap_remember *rswap,char *symbol,int32_t txi if ( coin != 0 && (tx= LP_transactionfind(coin,rswap->txids[txi])) != 0 && tx->height > 0 ) { rswap->sentflags[txi] = 1; - _LP_refht_update(coin,tx->height); + _LP_refht_update(coin,rswap->txids[txi],tx->height); } else LP_refht_update(symbol,rswap->txids[txi]); } return(0); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 85f5cd9db..8fa11b1ab 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -671,9 +671,9 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) if ( bits256_nonz(blockhash) != 0 && (blockobj= LP_getblock(coin->symbol,blockhash)) != 0 ) { height = jint(blockobj,"height"); - char str[65]; - if ( strcmp(coin->symbol,"CHIPS") != 0 && strcmp(coin->symbol,"BTC") != 0 ) - printf("%s %s LP_txheight.%d\n",coin->symbol,bits256_str(str,txid),height); + //char str[65]; + //if ( strcmp(coin->symbol,"CHIPS") != 0 && strcmp(coin->symbol,"BTC") != 0 ) + // printf("%s %s LP_txheight.%d\n",coin->symbol,bits256_str(str,txid),height); free_json(blockobj); } // else printf("%s LP_txheight error (%s)\n",coin->symbol,jprint(txobj,0)); likely just unconfirmed free_json(txobj); From dd7e1e756ebba1c6fb7e91d946ba3bdb92b12a19 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 20:12:27 +0300 Subject: [PATCH 059/346] Test --- iguana/exchanges/LP_nativeDEX.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 981a65e20..813d0e20f 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -416,7 +416,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubsock,char *pushaddr,uint16_t myport) { static uint32_t counter,numpeers; - struct iguana_info *coin,*ctmp; char *retstr,*origipaddr; struct LP_peerinfo *peer,*tmp; uint32_t now; bits256 zero; int32_t needpings,height,nonz = 0; + struct iguana_info *coin,*ctmp; char *retstr,*origipaddr; struct LP_peerinfo *peer,*tmp; uint32_t now; bits256 zero; int32_t needpings,j,height,nonz = 0; now = (uint32_t)time(NULL); if ( (origipaddr= myipaddr) == 0 ) origipaddr = "127.0.0.1"; @@ -511,12 +511,17 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( (coin->lastscanht % 1000) == 0 ) printf("%s ref.%d scan.%d to %d, longest.%d\n",coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); - if ( LP_blockinit(coin,coin->lastscanht) < 0 ) + for (j=0; j<100; j++) { - printf("blockinit.%s %d error\n",coin->symbol,coin->lastscanht); - continue; + if ( LP_blockinit(coin,coin->lastscanht) < 0 ) + { + printf("blockinit.%s %d error\n",coin->symbol,coin->lastscanht); + break; + } + coin->lastscanht++; } - coin->lastscanht++; + if ( j < 100 ) + continue; //LP_getestimatedrate(coin); break; } From b1ea59a6bff205eeb8101f97a4169eb7fdc8d406 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 20:49:30 +0300 Subject: [PATCH 060/346] Skip coins without rpc access --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 9a67d2cda..7dab46c3b 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -742,7 +742,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan userpub = curve25519(userpass,curve25519_basepoint9()); printf("userpass.(%s)\n",bits256_str(G.USERPASS,userpub)); } - if ( coin->electrum == 0 ) + if ( coin->electrum == 0 && coin->userpass[0] != 0 ) { LP_listunspent_issue(coin->symbol,coin->smartaddr); if ( (retjson= LP_importprivkey(coin->symbol,tmpstr,coin->smartaddr,-1)) != 0 ) From 70e327ac99506ddec424f52de901ffdafa3c91cf Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 21:20:23 +0300 Subject: [PATCH 061/346] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_remember.c | 19 ++++++++++++++++--- iguana/exchanges/LP_swap.c | 11 +++++++++-- iguana/exchanges/LP_utxos.c | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index d1a85727e..5faed5c43 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -269,7 +269,7 @@ struct basilisk_swap struct basilisk_swapmessage *messages; int32_t nummessages,sentflag; char Bdeposit[64],Bpayment[64]; uint64_t otherdeck[INSTANTDEX_DECKSIZE][2],deck[INSTANTDEX_DECKSIZE][2]; - uint8_t persistent_pubkey33[33],changermd160[20],pad[15],verifybuf[100000]; + uint8_t persistent_pubkey33[33],persistent_other33[33],changermd160[20],pad[15],verifybuf[100000]; }; diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index edaeb1701..c50a47853 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -152,7 +152,10 @@ void basilisk_dontforget(struct basilisk_swap *swap,struct basilisk_rawtx *rawtx fprintf(fp,",\"otherfee\":\"%s\"",bits256_str(str,swap->otherfee.I.actualtxid)); if ( bits256_nonz(swap->myfee.I.actualtxid) != 0 ) fprintf(fp,",\"myfee\":\"%s\"",bits256_str(str,swap->myfee.I.actualtxid)); - fprintf(fp,",\"dest33\":\""); + fprintf(fp,",\"other33\":\""); + for (i=0; i<33; i++) + fprintf(fp,"%02x",swap->persistent_other33[i]); + fprintf(fp,"\",\"dest33\":\""); for (i=0; i<33; i++) fprintf(fp,"%02x",swap->persistent_pubkey33[i]); fprintf(fp,"\"}\n"); @@ -463,7 +466,7 @@ struct LP_swap_remember uint64_t Atxfee,Btxfee,srcamount,destamount; int64_t values[sizeof(txnames)/sizeof(*txnames)]; uint32_t requestid,quoteid,plocktime,dlocktime,expiration,state,otherstate; int32_t iambob,finishedflag,origfinishedflag,Predeemlen,Dredeemlen,sentflags[sizeof(txnames)/sizeof(*txnames)]; - uint8_t secretAm[20],secretAm256[32],secretBn[20],secretBn256[32],pubkey33[33],Predeemscript[1024],Dredeemscript[1024]; + uint8_t secretAm[20],secretAm256[32],secretBn[20],secretBn256[32],Predeemscript[1024],Dredeemscript[1024],pubkey33[33],other33[33]; char src[64],dest[64],destaddr[64],Adestaddr[64],alicepaymentaddr[64],bobpaymentaddr[64],bobdepositaddr[64],alicecoin[64],bobcoin[64],*txbytes[sizeof(txnames)/sizeof(*txnames)]; }; @@ -508,7 +511,7 @@ cJSON *LP_swap_json(struct LP_swap_remember *rswap) int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t quoteid) { - char fname[1024],*fstr,*secretstr,*srcstr,*deststr,*dest33,*txname; long fsize; cJSON *item,*txobj,*array; bits256 privkey; uint32_t r,q; int32_t i,j,n; + char fname[1024],*fstr,*secretstr,*srcstr,*deststr,*dest33,*txname; long fsize; cJSON *item,*txobj,*array; bits256 privkey; uint32_t r,q; int32_t i,j,n; uint8_t other33[33]; memset(rswap,0,sizeof(*rswap)); rswap->requestid = requestid; rswap->quoteid = quoteid; @@ -537,6 +540,16 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t // printf("%02x",pubkey33[i]); //printf(" <- %s dest33\n",dest33); } + if ( (dest33= jstr(item,"other33")) != 0 && strlen(dest33) == 66 ) + { + decode_hex(other33,33,dest33); + for (i=0; i<33; i++) + if ( other33[i] != 0 ) + break; + if ( i < 33 ) + memcpy(rswap->other33,other33,33); + //printf(" <- %s dest33\n",dest33); + } if ( (rswap->plocktime= juint(item,"plocktime")) == 0 ) rswap->plocktime = LP_extract(requestid,quoteid,fname,"plocktime"); if ( (rswap->dlocktime= juint(item,"dlocktime")) == 0 ) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 22bf882aa..79a495c59 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -177,6 +177,8 @@ uint32_t basilisk_requestid(struct basilisk_request *rp) int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) { int32_t i,datalen = 0; + for (i=0; i<33; i++) + data[datalen++] = swap->persistent_pubkey33[i]; for (i=0; ideck)/sizeof(swap->deck[0][0]); i++) datalen += iguana_rwnum(1,&data[datalen],sizeof(swap->deck[i>>1][i&1]),&swap->deck[i>>1][i&1]); return(datalen); @@ -184,9 +186,14 @@ int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { - int32_t i,len = 0; - if ( datalen == sizeof(swap->otherdeck) ) + int32_t i,nonz=0,len = 0; uint8_t other33[33]; + if ( datalen == sizeof(swap->otherdeck)+33 ) { + for (i=0; i<33; i++) + if ( (other33[i]= data[len++]) != 0 ) + nonz++; + if ( nonz > 8 ) + memcpy(swap->persistent_other33,other33,33); for (i=0; iotherdeck)/sizeof(swap->otherdeck[0][0]); i++) len += iguana_rwnum(0,&data[len],sizeof(swap->otherdeck[i>>1][i&1]),&swap->otherdeck[i>>1][i&1]); return(0); diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 7dab46c3b..fadd1b6de 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -355,7 +355,7 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,char *symbol,bits256 txid,int32_t val2 = value2; } dispflag = 0; - if ( dispflag != 0 ) + //if ( dispflag != 0 ) printf("%.8f %.8f %s iambob.%d %s utxoadd.(%.8f %.8f) %s %s\n",dstr(val),dstr(val2),coinaddr,iambob,symbol,dstr(value),dstr(value2),bits256_str(str,txid),bits256_str(str2,txid2)); dispflag = 1; if ( (utxo= LP_utxofinds(iambob,txid,vout,txid2,vout2)) != 0 ) From 38440265eed9f38cf27d64db9b05da6dc0822eb8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 21:32:07 +0300 Subject: [PATCH 062/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index fadd1b6de..a69890fc6 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -726,7 +726,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,coin->wiftype); bitcoin_addr2rmd160(coin->taddr,&tmptype,G.LP_myrmd160,coin->smartaddr); LP_privkeyadd(privkey,G.LP_myrmd160); - if ( 0 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) + if ( 1 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) printf("%s (%s) %d wif.(%s) (%s)\n",coin->symbol,coin->smartaddr,coin->pubtype,tmpstr,passphrase); if ( G.counter++ == 0 ) { From 0057e22289cf3af7414365d17d01190987f1c1ad Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 21:37:07 +0300 Subject: [PATCH 063/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index a69890fc6..fadd1b6de 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -726,7 +726,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,coin->wiftype); bitcoin_addr2rmd160(coin->taddr,&tmptype,G.LP_myrmd160,coin->smartaddr); LP_privkeyadd(privkey,G.LP_myrmd160); - if ( 1 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) + if ( 0 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) printf("%s (%s) %d wif.(%s) (%s)\n",coin->symbol,coin->smartaddr,coin->pubtype,tmpstr,passphrase); if ( G.counter++ == 0 ) { From c93cdc8f0204fb4fa27f8362511d23a355012bc9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 21:45:51 +0300 Subject: [PATCH 064/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index fadd1b6de..a69890fc6 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -726,7 +726,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,coin->wiftype); bitcoin_addr2rmd160(coin->taddr,&tmptype,G.LP_myrmd160,coin->smartaddr); LP_privkeyadd(privkey,G.LP_myrmd160); - if ( 0 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) + if ( 1 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) printf("%s (%s) %d wif.(%s) (%s)\n",coin->symbol,coin->smartaddr,coin->pubtype,tmpstr,passphrase); if ( G.counter++ == 0 ) { From 56c23183544f2c785458d33c6d2d2c0bbf4bc140 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 21:46:02 +0300 Subject: [PATCH 065/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index a69890fc6..fadd1b6de 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -726,7 +726,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,coin->wiftype); bitcoin_addr2rmd160(coin->taddr,&tmptype,G.LP_myrmd160,coin->smartaddr); LP_privkeyadd(privkey,G.LP_myrmd160); - if ( 1 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) + if ( 0 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) printf("%s (%s) %d wif.(%s) (%s)\n",coin->symbol,coin->smartaddr,coin->pubtype,tmpstr,passphrase); if ( G.counter++ == 0 ) { From 37ae216909ee6e1e78547f5e19d8a28ddbdbc90e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 22:30:15 +0300 Subject: [PATCH 066/346] Test --- iguana/exchanges/LP_commands.c | 11 +++++++++-- iguana/exchanges/LP_utxo.c | 2 -- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index ecf6de1a7..ec5a4eda7 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -372,8 +372,15 @@ dividends(coin, height, )\n\ else if ( strcmp(method,"listunspent") == 0 ) { if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) - return(jprint(LP_address_utxos(ptr,jstr(argjson,"address"),1),1)); - else return(clonestr("{\"error\":\"cant find coind\"}")); + { + char *coinaddr; + if ( (coinaddr= jstr(argjson,"address")) != 0 ) + { + if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) + LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); + return(jprint(LP_address_utxos(ptr,coinaddr,1),1)); + } else return(clonestr("{\"error\":\"no address specified\"}")); + } else return(clonestr("{\"error\":\"cant find coind\"}")); } else if ( strcmp(method,"balance") == 0 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 8fa11b1ab..3572f7551 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -433,8 +433,6 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array) v = jint(item,"tx_pos"); height = jint(item,"height"); val = j64bits(item,"value"); - //if ( strcmp(coin->symbol,"LBC") == 0 ) - // printf("(%s)\n",jprint(item,0)); if ( coin->electrum == 0 && (txobj= LP_gettxout(coin->symbol,coinaddr,txid,v)) != 0 ) { value = LP_value_extract(txobj,0); From 4fb9f0038c36a528aaabdb4987003a4b09ab2974 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 22:46:53 +0300 Subject: [PATCH 067/346] Test --- iguana/exchanges/LP_utxo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 3572f7551..d9ad2b012 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -157,6 +157,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { + char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) From 6c5fac6cf66a92a436133edbed1d792f642b2f40 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 22:55:15 +0300 Subject: [PATCH 068/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index fadd1b6de..7dab46c3b 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -355,7 +355,7 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,char *symbol,bits256 txid,int32_t val2 = value2; } dispflag = 0; - //if ( dispflag != 0 ) + if ( dispflag != 0 ) printf("%.8f %.8f %s iambob.%d %s utxoadd.(%.8f %.8f) %s %s\n",dstr(val),dstr(val2),coinaddr,iambob,symbol,dstr(value),dstr(value2),bits256_str(str,txid),bits256_str(str2,txid2)); dispflag = 1; if ( (utxo= LP_utxofinds(iambob,txid,vout,txid2,vout2)) != 0 ) From 933b24d687a3c7cb014e1e0d8bca703797909de9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 22:59:36 +0300 Subject: [PATCH 069/346] Test --- iguana/exchanges/LP_nativeDEX.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 813d0e20f..694901cf4 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -450,6 +450,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int if ( peer->diduquery == 0 ) { LP_peer_pricesquery(peer); + LP_utxos_sync(peer); peer->diduquery = now; } if ( peer->needping != 0 ) From f3c6321b58cf37d94d1b72dadfe600318df9bace Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 23:10:05 +0300 Subject: [PATCH 070/346] Test --- iguana/exchanges/orderbook | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/orderbook b/iguana/exchanges/orderbook index 0f6e553b4..a61784991 100755 --- a/iguana/exchanges/orderbook +++ b/iguana/exchanges/orderbook @@ -1,3 +1,3 @@ #!/bin/bash source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"JUMBLR\",\"rel\":\"KMD\"}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}" From 4e7d7c2b4e0d025d96558678264d6e6a0963e380 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 23:15:37 +0300 Subject: [PATCH 071/346] Test --- iguana/exchanges/LP_commands.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index ec5a4eda7..602c5a598 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -378,6 +378,7 @@ dividends(coin, height, )\n\ { if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); + LP_listunspent_issue(coin,coinaddr); return(jprint(LP_address_utxos(ptr,coinaddr,1),1)); } else return(clonestr("{\"error\":\"no address specified\"}")); } else return(clonestr("{\"error\":\"cant find coind\"}")); From e0476823fc02327374c9d4d77b62d6702c5fb6d8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 23:23:43 +0300 Subject: [PATCH 072/346] Test --- iguana/exchanges/LP_prices.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index b7c9e04b0..9ceb2623e 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -770,7 +770,12 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) { jaddi(array,LP_orderbookjson(rel,bids[i])); if ( bids[i]->numutxos == 0 )//|| relcoin->electrum == 0 ) - LP_address(relcoin,bids[i]->coinaddr), n++; + { + if ( relcoin->electrum == 0 ) + LP_listunspent_issue(rel,bids[i]->coinaddr); + else LP_address(relcoin,bids[i]->coinaddr); + n++; + } free(bids[i]); bids[i] = 0; } @@ -783,7 +788,12 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) { jaddi(array,LP_orderbookjson(base,asks[i])); if ( asks[i]->numutxos == 0 )//|| basecoin->electrum == 0 ) - LP_address(basecoin,asks[i]->coinaddr), n++; + { + if ( basecoin->electrum == 0 ) + LP_listunspent_issue(base,asks[i]->coinaddr); + else LP_address(basecoin,asks[i]->coinaddr); + n++; + } free(asks[i]); asks[i] = 0; } From c58876fe8875c11ff3ab7767866082452bf5d031 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 23:44:01 +0300 Subject: [PATCH 073/346] Test --- iguana/exchanges/LP_ordermatch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 943a755d6..ccbe56610 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -505,6 +505,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; + printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) { if ( up != 0 && (up2= utxos[mini]) != 0 ) From c9a5374bdff1a5dc507cb6ab3a595b030af4082d Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 12 Oct 2017 23:55:48 +0300 Subject: [PATCH 074/346] Test --- iguana/exchanges/LP_ordermatch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index ccbe56610..a02bf2b84 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -500,24 +500,27 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr); } mini = -1; - if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,utxos,m,targetval)) >= 0 && (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) + if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,utxos,m,targetval)) >= 0 ) { up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); - if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) + if ( (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) { - if ( up != 0 && (up2= utxos[mini]) != 0 ) + if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) { - if ( (utxo= LP_utxoadd(1,coin->symbol,up->U.txid,up->U.vout,up->U.value,up2->U.txid,up2->U.vout,up2->U.value,coinaddr,ap->pubkey,G.gui,0)) != 0 ) + if ( up != 0 && (up2= utxos[mini]) != 0 ) { - utxo->S.satoshis = targetval; - char str[65],str2[65]; printf("butxo.%p targetval %.8f, found val %.8f %s | targetval2 %.8f val2 %.8f %s\n",utxo,dstr(targetval),dstr(up->U.value),bits256_str(str,utxo->payment.txid),dstr(targetval2),dstr(up2->U.value),bits256_str(str2,utxo->deposit.txid)); - return(utxo); + if ( (utxo= LP_utxoadd(1,coin->symbol,up->U.txid,up->U.vout,up->U.value,up2->U.txid,up2->U.vout,up2->U.value,coinaddr,ap->pubkey,G.gui,0)) != 0 ) + { + utxo->S.satoshis = targetval; + char str[65],str2[65]; printf("butxo.%p targetval %.8f, found val %.8f %s | targetval2 %.8f val2 %.8f %s\n",utxo,dstr(targetval),dstr(up->U.value),bits256_str(str,utxo->payment.txid),dstr(targetval2),dstr(up2->U.value),bits256_str(str2,utxo->deposit.txid)); + return(utxo); + } } - } - } else printf("cant find targetval2 %.8f\n",dstr(targetval2)); + } else printf("cant find targetval2 %.8f\n",dstr(targetval2)); + } else printf("failed ratio test %.8f\n",(double)utxos[mini]->U.value/targetval); } else if ( targetval != 0 && mini >= 0 ) printf("targetval %.8f mini.%d ratio %.8f\n",dstr(targetval),mini,(double)utxos[mini]->U.value/targetval); } else printf("no utxos pass LP_address_utxo_ptrs filter\n"); From a5c27d5e7ec91ebee9b2b6595d18057071ef480a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 00:08:17 +0300 Subject: [PATCH 075/346] Test --- iguana/exchanges/LP_ordermatch.c | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a02bf2b84..52b5b1639 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -451,25 +451,29 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u } for (i=0; ispendheight == 0 ) + if ( (up= utxos[i]) != 0 ) { - if ( coin->electrum != 0 ) + dist = (up->U.value - targetval); + printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); + if (up->spendheight == 0 ) { - if (up->SPV == 0 ) - up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); - if ( up->SPV < 0 ) + if ( coin->electrum != 0 ) { - printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); - continue; + if (up->SPV == 0 ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); + printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); + if ( up->SPV < 0 ) + { + printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); + continue; + } + } + if ( dist >= 0 && dist < mindist ) + { + printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); + mini = i; + mindist = dist; } - } - dist = (up->U.value - targetval); - if ( dist >= 0 && dist < mindist ) - { - printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); - mini = i; - mindist = dist; } } } From 48ad29c5b9b8f10c671e8d4b2b65d355a5bf2db8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 00:18:25 +0300 Subject: [PATCH 076/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 52b5b1639..089d2f299 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -449,6 +449,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u if ( (backupep= ep->prev) == 0 ) backupep = ep; } + printf("LP_nearest_utxovalue %s utxos[%d]\n",coin->symbol,n); for (i=0; i Date: Fri, 13 Oct 2017 00:31:13 +0300 Subject: [PATCH 077/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 089d2f299..e6ef44ac0 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -456,7 +456,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u { dist = (up->U.value - targetval); printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); - if (up->spendheight == 0 ) + if ( up->spendheight <= 0 ) { if ( coin->electrum != 0 ) { From ca322e9e66cb39b604e28b66fa265d3e00bda95d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 00:35:20 +0300 Subject: [PATCH 078/346] Test --- iguana/exchanges/LP_ordermatch.c | 8 ++++---- iguana/exchanges/LP_utxo.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index e6ef44ac0..73e25c4b7 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -449,13 +449,13 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u if ( (backupep= ep->prev) == 0 ) backupep = ep; } - printf("LP_nearest_utxovalue %s utxos[%d]\n",coin->symbol,n); + //printf("LP_nearest_utxovalue %s utxos[%d]\n",coin->symbol,n); for (i=0; iU.value - targetval); - printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); + //printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); if ( up->spendheight <= 0 ) { if ( coin->electrum != 0 ) @@ -478,7 +478,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u } } } - printf("return mini.%d\n",mini); + //printf("return mini.%d\n",mini); return(mini); } @@ -511,7 +511,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; - printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); + //printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); if ( (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) { if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index d9ad2b012..982e45cbb 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -157,7 +157,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout); + //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) From 9d01cfda47245d663ad866f05fc05c66c1b6b769 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 01:55:39 +0300 Subject: [PATCH 079/346] Test --- iguana/exchanges/coins | 3 ++- iguana/exchanges/coins.json | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/coins b/iguana/exchanges/coins index 25af22269..356346d6a 100644 --- a/iguana/exchanges/coins +++ b/iguana/exchanges/coins @@ -1,2 +1,3 @@ -export coins="[{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}]" +export coins="[{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}]" +#, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}]" diff --git a/iguana/exchanges/coins.json b/iguana/exchanges/coins.json index d97e39c22..576547207 100644 --- a/iguana/exchanges/coins.json +++ b/iguana/exchanges/coins.json @@ -1,3 +1,3 @@ -[{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}] - +[{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}] +#, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}]" From c922fea7ce71f90886f195000585bdd15462b75e Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 02:06:19 +0300 Subject: [PATCH 080/346] Test --- iguana/exchanges/LP_ordermatch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 73e25c4b7..a99b1bafd 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -512,7 +512,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; //printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); - if ( (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) + if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) { @@ -526,9 +526,9 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** } } } else printf("cant find targetval2 %.8f\n",dstr(targetval2)); - } else printf("failed ratio test %.8f\n",(double)utxos[mini]->U.value/targetval); + } else printf("failed ratio test %.8f\n",(double)up->U.value/targetval); } else if ( targetval != 0 && mini >= 0 ) - printf("targetval %.8f mini.%d ratio %.8f\n",dstr(targetval),mini,(double)utxos[mini]->U.value/targetval); + printf("targetval %.8f mini.%d\n",dstr(targetval),mini); } else printf("no utxos pass LP_address_utxo_ptrs filter\n"); } else printf("couldnt find %s %s\n",coin->symbol,coinaddr); return(0); From 03962717d20800ebd6b6ad5540f8fb01d5fea022 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 02:09:49 +0300 Subject: [PATCH 081/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a99b1bafd..3cb45116e 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -851,7 +851,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, memset(&zero,0,sizeof(zero)); msg2 = clonestr(msg); LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,zero,msg); - LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg2); + //LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg2); //LP_butxo_swapfields_set(butxo); printf("return after RESERVED\n"); return(2); From be0257672fc1decdf241b986d4a7df4dc3db376e Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 02:32:33 +0300 Subject: [PATCH 082/346] Test --- iguana/exchanges/LP_swap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 79a495c59..f71256d87 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -591,7 +591,7 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba txfee = swap->I.Atxfee; else txfee = LP_MIN_TXFEE; } - if ( j64bits(vout,"satoshis") >= rawtx->I.amount+txfee && (skey= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(skey,"hex")) != 0 ) + if ( j64bits(vout,"satoshis") >= rawtx->I.amount && (skey= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(skey,"hex")) != 0 ) { if ( (hexlen= (int32_t)strlen(hexstr) >> 1) < sizeof(rawtx->spendscript) ) { @@ -607,7 +607,7 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba printf("got %s txid.%s (%s) -> %s\n",rawtx->name,bits256_str(str,rawtx->I.signedtxid),jprint(txobj,0),rawtx->p2shaddr); } else bitcoin_address(rawtx->p2shaddr,rawtx->coin->taddr,rawtx->coin->p2shtype,rawtx->spendscript,hexlen); } - } else printf("%s ERROR.(%s) txfees.[%.8f %.8f: %.8f] amount.%.8f -> %.8f\n",rawtx->name,jprint(txobj,0),dstr(swap->I.Atxfee),dstr(swap->I.Btxfee),dstr(txfee),dstr(rawtx->I.amount),dstr(rawtx->I.amount)-dstr(txfee)); + } else printf("%s satoshis %.8f ERROR.(%s) txfees.[%.8f %.8f: %.8f] amount.%.8f -> %.8f\n",rawtx->name,dstr(j64bits(vout,"satoshis")),jprint(txobj,0),dstr(swap->I.Atxfee),dstr(swap->I.Btxfee),dstr(txfee),dstr(rawtx->I.amount),dstr(rawtx->I.amount)-dstr(txfee)); } free_json(txobj); } @@ -1033,14 +1033,14 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 printf(">>>>>>>>>> jumblrflag.%d <<<<<<<<< use smart address, %.8f bobconfs.%d, %.8f aliceconfs.%d taddr.%d %d\n",jumblrflag,dstr(swap->I.bobsatoshis),swap->I.bobconfirms,dstr(swap->I.alicesatoshis),swap->I.aliceconfirms,swap->bobcoin.taddr,swap->alicecoin.taddr); if ( swap->I.iambob != 0 ) { - basilisk_rawtx_setparms("myfee",swap->I.req.quoteid,&swap->myfee,&swap->bobcoin,0,0,LP_DEXFEE(swap->I.bobsatoshis),0,0,jumblrflag); - basilisk_rawtx_setparms("otherfee",swap->I.req.quoteid,&swap->otherfee,&swap->alicecoin,0,0,LP_DEXFEE(swap->I.alicesatoshis),0,0,jumblrflag); + basilisk_rawtx_setparms("myfee",swap->I.req.quoteid,&swap->myfee,&swap->bobcoin,0,0,LP_DEXFEE(swap->I.bobsatoshis) + swap->bobcoin.txfee,0,0,jumblrflag); + basilisk_rawtx_setparms("otherfee",swap->I.req.quoteid,&swap->otherfee,&swap->alicecoin,0,0,LP_DEXFEE(swap->I.alicesatoshis) + swap->alicecoin.txfee,0,0,jumblrflag); bobpub33 = pubkey33; } else { - basilisk_rawtx_setparms("otherfee",swap->I.req.quoteid,&swap->otherfee,&swap->bobcoin,0,0,LP_DEXFEE(swap->I.bobsatoshis),0,0,jumblrflag); - basilisk_rawtx_setparms("myfee",swap->I.req.quoteid,&swap->myfee,&swap->alicecoin,0,0,LP_DEXFEE(swap->I.alicesatoshis),0,0,jumblrflag); + basilisk_rawtx_setparms("otherfee",swap->I.req.quoteid,&swap->otherfee,&swap->bobcoin,0,0,LP_DEXFEE(swap->I.bobsatoshis) + swap->bobcoin.txfee,0,0,jumblrflag); + basilisk_rawtx_setparms("myfee",swap->I.req.quoteid,&swap->myfee,&swap->alicecoin,0,0,LP_DEXFEE(swap->I.alicesatoshis) + swap->alicecoin.txfee,0,0,jumblrflag); alicepub33 = pubkey33; } basilisk_rawtx_setparms("bobdeposit",swap->I.req.quoteid,&swap->bobdeposit,&swap->bobcoin,swap->I.bobconfirms,0,LP_DEPOSITSATOSHIS(swap->I.bobsatoshis) + swap->bobcoin.txfee,4,0,jumblrflag); From 89d66662bbe404a0adc2cbb9a296310db7f1cbc9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 02:52:52 +0300 Subject: [PATCH 083/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 694901cf4..9bc850539 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -308,7 +308,7 @@ void command_rpcloop(void *myipaddr) //if ( LP_mybussock >= 0 ) // nonz += LP_sock_check("BUS",ctx,origipaddr,-1,LP_mybussock); if ( nonz == 0 ) - usleep(10000); + usleep(10); } } From 0725deb0ffcd16ae6053f2a37648c4f4ce3c1381 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 02:53:32 +0300 Subject: [PATCH 084/346] Test --- iguana/exchanges/LP_nativeDEX.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 9bc850539..0d6d6ec1b 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -308,7 +308,11 @@ void command_rpcloop(void *myipaddr) //if ( LP_mybussock >= 0 ) // nonz += LP_sock_check("BUS",ctx,origipaddr,-1,LP_mybussock); if ( nonz == 0 ) - usleep(10); + { + if ( IAMLP != 0 ) + usleep(10); + else usleep(1000); + } } } From 2e011b6ab2762d74921223472f33f8f813390fc8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 02:55:47 +0300 Subject: [PATCH 085/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0d6d6ec1b..627f507ae 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -524,6 +524,8 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int break; } coin->lastscanht++; + if ( coin->lastscanht == coin->longestchain+1 ) + break; } if ( j < 100 ) continue; From 45cae6913d8d4890b588e895e35e9efb37e25081 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 03:03:48 +0300 Subject: [PATCH 086/346] Test --- iguana/exchanges/LP_swap.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index f71256d87..0f839b6af 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -674,8 +674,8 @@ int32_t LP_swapwait(uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t char *retstr; cJSON *retjson=0; uint32_t divisor=8,expiration = (uint32_t)(time(NULL) + duration); printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid); sleep(10); - if ( sleeptime < divisor*60 ) - sleeptime = divisor * 60; + //if ( sleeptime < divisor*60 ) + // sleeptime = divisor * 60; while ( time(NULL) < expiration ) { if ( (retstr= basilisk_swapentry(requestid,quoteid)) != 0 ) @@ -690,9 +690,10 @@ int32_t LP_swapwait(uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t } free(retstr); } - sleep(sleeptime/divisor); - if ( divisor > 1 ) - divisor--; + sleep(sleeptime); + //sleep(sleeptime/divisor); + //if ( divisor > 1 ) + // divisor--; } if ( retjson != 0 ) { @@ -759,7 +760,7 @@ void LP_bobloop(void *_swap) basilisk_bobpayment_reclaim(swap,swap->I.callduration); if ( swap->N.pair >= 0 ) nn_close(swap->N.pair), swap->N.pair = -1; - LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,300); + LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,30); } } } @@ -823,7 +824,7 @@ void LP_aliceloop(void *_swap) } if ( swap->N.pair >= 0 ) nn_close(swap->N.pair), swap->N.pair = -1; - LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,300); + LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,30); } } } From c654fe0b94e4e0ef98406306fc50f8f31a6d47d1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 11:02:23 +0300 Subject: [PATCH 087/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_utxos.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 3cb45116e..ab8d00f5f 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -455,7 +455,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u if ( (up= utxos[i]) != 0 ) { dist = (up->U.value - targetval); - //printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); + printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); if ( up->spendheight <= 0 ) { if ( coin->electrum != 0 ) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 7dab46c3b..2eb7b02de 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -345,7 +345,7 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,char *symbol,bits256 txid,int32_t } if ( (numconfirms= LP_numconfirms(symbol,coinaddr,txid2,vout2,0)) <= 0 ) { - printf("LP_utxoadd reject2 numconfirms.%d\n",numconfirms); + printf("LP_utxoadd reject2 numconfirms.%d %s %s/v%d\n",numconfirms,symbol,bits256_str(str,txid2),vout2); return(0); } } From a1d1d05cd5df9c53abaa963929f34982c4ff96f3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 11:16:44 +0300 Subject: [PATCH 088/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index ab8d00f5f..747353a2e 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -449,7 +449,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u if ( (backupep= ep->prev) == 0 ) backupep = ep; } - //printf("LP_nearest_utxovalue %s utxos[%d]\n",coin->symbol,n); + printf("LP_nearest_utxovalue %s utxos[%d] target %.8f\n",coin->symbol,n,dstr(targetval)); for (i=0; i targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); + printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) From 7f6ce284140f66e0762aa1c84c78cfa32e6d2faf Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 11:20:09 +0300 Subject: [PATCH 089/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 747353a2e..5cf8094f8 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -478,7 +478,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u } } } - //printf("return mini.%d\n",mini); + printf("return mini.%d\n",mini); return(mini); } @@ -511,7 +511,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; - printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); + printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) From dbcbb5fd79d26cb842b5ff46b363cf494ce210d2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 11:47:05 +0300 Subject: [PATCH 090/346] Test --- iguana/exchanges/LP_utxo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 982e45cbb..50bbfc6c8 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -698,10 +698,12 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int if ( (txobj= LP_gettxout(symbol,coinaddr,txid,vout)) != 0 ) { numconfirms = jint(txobj,"confirmations"); + printf("LP_numconfirms.%d (%s)\n",numconfirms,jprint(txobj,0)); free_json(txobj); } else if ( mempool != 0 && LP_mempoolscan(symbol,txid) >= 0 ) numconfirms = 0; + else printf("LP_numconfirms cant gettxout and ignoring mempool\n"); } else { From 5d5ff5d7a2fe3da5bf7dfa3bb3e466087e4e227f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 14:30:13 +0300 Subject: [PATCH 091/346] Test --- iguana/exchanges/LP_utxo.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 50bbfc6c8..6baa2d858 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -333,7 +333,7 @@ int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret) { - cJSON *array,*item; int32_t n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; struct electrum_info *ep,*backupep=0; + cJSON *array,*item; int32_t n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; cJSON *txobj; struct electrum_info *ep,*backupep=0; array = cJSON_CreateArray(); if ( coinaddr != 0 && coinaddr[0] != 0 ) { @@ -350,11 +350,20 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum { if ( up->spendheight <= 0 && up->U.height > 0 ) { - if ( backupep != 0 && up->SPV == 0 ) - up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - jaddi(array,LP_address_item(coin,up,electrumret)); - n++; - total += up->U.value; + if ( coin->electrum == 0 ) + { + if ( (txobj= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) == 0 ) + up->spendheight = 1; + else free_json(txobj); + } + if ( up->spendheight <= 0 ) + { + if ( backupep != 0 && up->SPV == 0 ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); + jaddi(array,LP_address_item(coin,up,electrumret)); + n++; + total += up->U.value; + } //printf("new array %s\n",jprint(array,0)); } } @@ -698,12 +707,10 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int if ( (txobj= LP_gettxout(symbol,coinaddr,txid,vout)) != 0 ) { numconfirms = jint(txobj,"confirmations"); - printf("LP_numconfirms.%d (%s)\n",numconfirms,jprint(txobj,0)); free_json(txobj); } else if ( mempool != 0 && LP_mempoolscan(symbol,txid) >= 0 ) numconfirms = 0; - else printf("LP_numconfirms cant gettxout and ignoring mempool\n"); } else { From f26a8016cedf19a733dabaa9f77a8bd4ebab41f0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 14:51:40 +0300 Subject: [PATCH 092/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_rpc.c | 2 +- iguana/exchanges/LP_utxos.c | 2 +- iguana/exchanges/listunspent | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 627f507ae..b3c2375e3 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -321,7 +321,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) int32_t i,j,n=0,m,v,posted=0; bits256 txid; cJSON *array,*item,*item2,*array2,*array3; uint64_t total,total2,metric; struct iguana_info *coin,*ctmp; struct LP_address *ap; char *retstr,*retstr2,*coinaddr; HASH_ITER(hh,LP_coins,coin,ctmp) { - if ( coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) + if ( IAMLP == 0 && coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; total = 0; LP_listunspent_both(coin->symbol,coin->smartaddr); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index aa6296325..93f9e2fbb 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -425,7 +425,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr) return(cJSON_Parse("{\"error\":\"null symbol\"}")); coin = LP_coinfind(symbol); //printf("LP_listunspent.(%s %s)\n",symbol,coinaddr); - if ( coin == 0 || coin->inactive != 0 ) + if ( coin == 0 || (IAMLP == 0 && coin->inactive != 0) ) return(cJSON_Parse("{\"error\":\"no coin\"}")); if ( coin->electrum == 0 ) { diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 2eb7b02de..cd6015436 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -778,7 +778,7 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase) privkey = LP_privkeycalc(ctx,pubkey33,&pubkey,coin,passphrase,""); } //printf("i.%d of %d\n",i,LP_numcoins); - else if ( coin->inactive == 0 ) + else if ( IAMLP == 0 || coin->inactive == 0 ) { if ( LP_privkey_init(pubsock,coin,G.LP_mypriv25519,G.LP_mypub25519) == 0 && (rand() % 10) == 0 ) LP_postutxos(coin->symbol,coin->smartaddr); diff --git a/iguana/exchanges/listunspent b/iguana/exchanges/listunspent index aa7ca4963..ddb830d7e 100755 --- a/iguana/exchanges/listunspent +++ b/iguana/exchanges/listunspent @@ -1,3 +1,3 @@ #!/bin/bash source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"listunspent\",\"coin\":\"BTC\",\"address\":\"1DPDsPCNNCF5SHhPPrddXcJe78rM6CBcH3\"}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"listunspent\",\"coin\":\"CHIPS\",\"address\":\"RAsvnHfueHcbQTfX69rc9oMEG65zwrk73p\"}" From 389c05b8dbfe3690cab445b4fc09e7e23e6c3155 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 14:54:28 +0300 Subject: [PATCH 093/346] Test --- iguana/exchanges/enable | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/enable b/iguana/exchanges/enable index d6a287b3a..75c0bc838 100755 --- a/iguana/exchanges/enable +++ b/iguana/exchanges/enable @@ -1,3 +1,4 @@ #!/bin/bash source userpass curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"REVS\"}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"CHIPS\"}" From 381817fe8f48986a5cb439c11061a07e6fefe5f2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 14:58:03 +0300 Subject: [PATCH 094/346] Test --- iguana/exchanges/LP_utxos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index cd6015436..62e0757bf 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -512,9 +512,9 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri { int32_t enable_utxos = 0; char *script,destaddr[64]; struct LP_utxoinfo *utxo; cJSON *array,*item; bits256 txid,deposittxid; int32_t used,i,flag=0,height,n,cmpflag,iambob,vout,depositvout; uint64_t *values=0,satoshis,txfee,depositval,value,total = 0; int64_t targetval; - if ( coin == 0 || coin->inactive != 0 ) + if ( coin == 0 || (IAMLP == 0 && coin->inactive != 0) ) { - printf("coin not active\n"); + //printf("coin not active\n"); return(0); } //printf("privkey init.(%s) %s\n",coin->symbol,coin->smartaddr); From 895b22dba573c071b917ded222c6845783676aef Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:02:01 +0300 Subject: [PATCH 095/346] Test --- iguana/exchanges/listunspent | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iguana/exchanges/listunspent b/iguana/exchanges/listunspent index ddb830d7e..9b03640f3 100755 --- a/iguana/exchanges/listunspent +++ b/iguana/exchanges/listunspent @@ -1,3 +1,2 @@ -#!/bin/bash source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"listunspent\",\"coin\":\"CHIPS\",\"address\":\"RAsvnHfueHcbQTfX69rc9oMEG65zwrk73p\"}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"listunspent\",\"coin\":\"CHIPS\",\"address\":\"RMfQwu5ey23eWJ4as2ckd8dqsQJwo836ny\"}" From ea81c79c9ec26d98930d76701f5b4449789518ad Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:14:29 +0300 Subject: [PATCH 096/346] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_nativeDEX.c | 6 +++--- iguana/exchanges/LP_utxo.c | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 602c5a598..9137bb923 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -362,7 +362,7 @@ dividends(coin, height, )\n\ coinaddr = jstr(argjson,"coinaddr"); if ( coin != 0 && coinaddr != 0 ) { - //char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); + char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1); } return(clonestr("{\"result\":\"success\"}")); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index b3c2375e3..f3581b7f1 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -362,15 +362,15 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( j == m ) { - //printf("%s missing %s\n",peer->ipaddr,jprint(item,0)); + printf("%s missing %s\n",peer->ipaddr,jprint(item,0)); if ( (retstr2= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,v,jint(item,"height"),j64bits(item,"value"))) != 0 ) free(retstr2); posted++; } } - if ( 0 && posted != 0 ) + if ( 1 && posted != 0 ) printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m); - } //else printf("%s matches\n",peer->ipaddr); + } else printf("%s matches\n",peer->ipaddr); free_json(array2); } free(retstr); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 6baa2d858..3c4b9213f 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -189,7 +189,7 @@ struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coina int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight) { - struct LP_address *ap; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; + struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; //printf("%s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); if ( coin == 0 ) return(0); @@ -216,6 +216,16 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, } if ( flag == 0 ) { + if ( coin->electrum == 0 ) + { + if ( (txobj= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) == 0 ) + { + if ( up->spendheight <= 0 ) + up->spendheight = 1; + printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,up->U.txid),up->U.vout); + return(0); + } else free_json(txobj); + } up = calloc(1,sizeof(*up)); up->U.txid = txid; up->U.vout = vout; @@ -226,7 +236,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 0 && height > 0 ) + if ( 1 && height > 0 ) printf("ADDRESS_UTXO >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); From 86425b77058f6a9979ca9f62496f3d1128c4bd49 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:22:21 +0300 Subject: [PATCH 097/346] Test --- iguana/exchanges/LP_utxo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 3c4b9213f..293bfa676 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -218,11 +218,11 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, { if ( coin->electrum == 0 ) { - if ( (txobj= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) == 0 ) + if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) == 0 ) { if ( up->spendheight <= 0 ) up->spendheight = 1; - printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,up->U.txid),up->U.vout); + printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,txid),vout); return(0); } else free_json(txobj); } From 04f16ba501414d800d61e10321b39bcd776b4fea Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:27:15 +0300 Subject: [PATCH 098/346] Test --- iguana/exchanges/LP_utxo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 293bfa676..7df7bab78 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -220,8 +220,6 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, { if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) == 0 ) { - if ( up->spendheight <= 0 ) - up->spendheight = 1; printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,txid),vout); return(0); } else free_json(txobj); From 79b5376fe1f5e60ffe26d79e895cd4bdd4fe16de Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:29:59 +0300 Subject: [PATCH 099/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 7df7bab78..85b3b2ac4 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -220,7 +220,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, { if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) == 0 ) { - printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,txid),vout); + //printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,txid),vout); return(0); } else free_json(txobj); } From b6364d9a82058274b0809e47d5e26ad73aa22196 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:39:24 +0300 Subject: [PATCH 100/346] Test --- iguana/exchanges/LP_nativeDEX.c | 7 ++++--- iguana/exchanges/LP_utxo.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index f3581b7f1..9f21e2fba 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -323,6 +323,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) { if ( IAMLP == 0 && coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; + printf("UTXO sync %s -> %s\n",coin->symbol,peer->ipaddr); total = 0; LP_listunspent_both(coin->symbol,coin->smartaddr); if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) @@ -362,7 +363,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( j == m ) { - printf("%s missing %s\n",peer->ipaddr,jprint(item,0)); + printf("%s missing %s %s\n",peer->ipaddr,coin->symbol,jprint(item,0)); if ( (retstr2= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,v,jint(item,"height"),j64bits(item,"value"))) != 0 ) free(retstr2); posted++; @@ -441,15 +442,15 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int if ( IAMLP == 0 ) continue; } - if ( now > peer->lastpeers+60 && peer->numpeers > 0 && (peer->numpeers != numpeers || (rand() % 1000) == 0) ) + if ( now > peer->lastpeers+60 || (rand() % 10000) == 0 ) { - peer->lastpeers = now; if ( strcmp(peer->ipaddr,myipaddr) != 0 ) { LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport); peer->diduquery = 0; LP_utxos_sync(peer); } + peer->lastpeers = now; } if ( peer->diduquery == 0 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 85b3b2ac4..eedac4669 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -234,7 +234,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 1 && height > 0 ) + if ( 0 && height > 0 ) printf("ADDRESS_UTXO >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); From c9a4bdefdb987b2834791249b3150f59636005e9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:46:26 +0300 Subject: [PATCH 101/346] Test --- iguana/exchanges/LP_nativeDEX.c | 7 ++++--- iguana/exchanges/LP_ordermatch.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 9f21e2fba..1dfb9765a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -323,9 +323,10 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) { if ( IAMLP == 0 && coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; - printf("UTXO sync %s -> %s\n",coin->symbol,peer->ipaddr); + //printf("UTXO sync %s -> %s\n",coin->symbol,peer->ipaddr); total = 0; - LP_listunspent_both(coin->symbol,coin->smartaddr); + if ( LP_listunspent_both(coin->symbol,coin->smartaddr) == 0 ) + continue; if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) { if ( (n= cJSON_GetArraySize(array)) > 0 ) @@ -371,7 +372,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( 1 && posted != 0 ) printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m); - } else printf("%s matches\n",peer->ipaddr); + } else printf("%s matches %s\n",peer->ipaddr,coin->symbol); free_json(array2); } free(retstr); diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 5cf8094f8..b44c8c96b 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -724,7 +724,7 @@ char *LP_connectedalice(cJSON *argjson) // alice int32_t LP_listunspent_both(char *symbol,char *coinaddr) { int32_t i,v,height,n=0; uint64_t value; bits256 txid; char buf[512]; cJSON *array,*item; struct iguana_info *coin = LP_coinfind(symbol); - if ( coin != 0 && coin->inactive == 0 ) + if ( coin != 0 && (IAMLP == 0 && coin->inactive == 0) ) { if ( coin->electrum != 0 || LP_address_ismine(symbol,coinaddr) <= 0 ) { From 4ffc93afdb4db8dad7e9fbd482148ab0190a2495 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:52:03 +0300 Subject: [PATCH 102/346] Test --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- iguana/exchanges/LP_ordermatch.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 1dfb9765a..75ca62736 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -323,10 +323,10 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) { if ( IAMLP == 0 && coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; - //printf("UTXO sync %s -> %s\n",coin->symbol,peer->ipaddr); total = 0; - if ( LP_listunspent_both(coin->symbol,coin->smartaddr) == 0 ) + if ( (j= LP_listunspent_both(coin->symbol,coin->smartaddr)) == 0 ) continue; + printf("UTXO sync.%d %s -> %s\n",j,coin->symbol,peer->ipaddr); if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) { if ( (n= cJSON_GetArraySize(array)) > 0 ) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index b44c8c96b..0bc2e2381 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -724,7 +724,7 @@ char *LP_connectedalice(cJSON *argjson) // alice int32_t LP_listunspent_both(char *symbol,char *coinaddr) { int32_t i,v,height,n=0; uint64_t value; bits256 txid; char buf[512]; cJSON *array,*item; struct iguana_info *coin = LP_coinfind(symbol); - if ( coin != 0 && (IAMLP == 0 && coin->inactive == 0) ) + if ( coin != 0 )//&& (IAMLP != 0 || coin->inactive == 0) ) { if ( coin->electrum != 0 || LP_address_ismine(symbol,coinaddr) <= 0 ) { From 78111b1e47a4c2cc0f56758348c015ba499e2539 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 15:56:10 +0300 Subject: [PATCH 103/346] Test --- iguana/exchanges/LP_nativeDEX.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 75ca62736..95c07dfdf 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -337,8 +337,10 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) total += j64bits(item,"value"); } } + printf("n.%d total %.8f\n",n,dstr(total)); if ( n > 0 && total > 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr)) != 0 ) { + printf("%s -> (%s)\n",peer->ipaddr,retstr); total2 = 0; if ( (array2= cJSON_Parse(retstr)) != 0 ) { @@ -374,9 +376,9 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m); } else printf("%s matches %s\n",peer->ipaddr,coin->symbol); free_json(array2); - } + } else printf("parse error (%s)\n",retstr); free(retstr); - } + } else printf("no response from %s\n",peer->ipaddr); } if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")) != 0 ) { From 6dfa5961de405787c42486aeafc76dc6142ece92 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 16:00:18 +0300 Subject: [PATCH 104/346] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_include.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 9137bb923..602c5a598 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -362,7 +362,7 @@ dividends(coin, height, )\n\ coinaddr = jstr(argjson,"coinaddr"); if ( coin != 0 && coinaddr != 0 ) { - char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); + //char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1); } return(clonestr("{\"result\":\"success\"}")); diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 5faed5c43..46bdd0710 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -37,7 +37,7 @@ #define LP_GETINFO_INCR 30 #define LP_ORDERBOOK_DURATION 3600 -#define LP_HTTP_TIMEOUT 2 // 1 is too small due to edge cases of time(NULL) +#define LP_HTTP_TIMEOUT 5 // 1 is too small due to edge cases of time(NULL) #define LP_MAXPEER_ERRORS 3 #define LP_MINPEER_GOOD 20 #define LP_PEERGOOD_ERRORDECAY 0.9 From 96c3d707f008dc9a222245715fdbb73b4eac9451 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 16:03:19 +0300 Subject: [PATCH 105/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 ++ iguana/exchanges/LP_prices.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 95c07dfdf..4fd7dc88d 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -319,6 +319,8 @@ void command_rpcloop(void *myipaddr) int32_t LP_utxos_sync(struct LP_peerinfo *peer) { int32_t i,j,n=0,m,v,posted=0; bits256 txid; cJSON *array,*item,*item2,*array2,*array3; uint64_t total,total2,metric; struct iguana_info *coin,*ctmp; struct LP_address *ap; char *retstr,*retstr2,*coinaddr; + if ( strcmp(peer->ipaddr,LP_myipaddr) == 0 ) + return(0); HASH_ITER(hh,LP_coins,coin,ctmp) { if ( IAMLP == 0 && coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 9ceb2623e..0ac50c0d4 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -360,6 +360,8 @@ void LP_prices_parse(struct LP_peerinfo *peer,cJSON *obj) void LP_peer_pricesquery(struct LP_peerinfo *peer) { char *retstr; cJSON *array; int32_t i,n; + if ( strcmp(peer->ipaddr,LP_myipaddr) == 0 ) + return; peer->needping = (uint32_t)time(NULL); if ( (retstr= issue_LP_getprices(peer->ipaddr,peer->port)) != 0 ) { From e9d900969da46016dcb89296c5cc0a98512f56d5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 16:09:10 +0300 Subject: [PATCH 106/346] Test --- iguana/exchanges/LP_nativeDEX.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 4fd7dc88d..475ad8494 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -380,7 +380,9 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) free_json(array2); } else printf("parse error (%s)\n",retstr); free(retstr); - } else printf("no response from %s\n",peer->ipaddr); + } + else if ( n == 0 && total == 0 ) + printf("no response from %s for %s\n",peer->ipaddr,coin->symbol); } if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")) != 0 ) { From aa666ca0363be81139ee81ba659fdceebee86249 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 16:26:56 +0300 Subject: [PATCH 107/346] Split out roc request packet processing --- iguana/exchanges/LP_swap.c | 2 +- iguana/exchanges/stats.c | 264 +++++++++++++++++++------------------ 2 files changed, 139 insertions(+), 127 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 0f839b6af..c59d9f203 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -671,7 +671,7 @@ uint32_t LP_swapdata_rawtxsend(int32_t pairsock,struct basilisk_swap *swap,uint3 int32_t LP_swapwait(uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t sleeptime) { - char *retstr; cJSON *retjson=0; uint32_t divisor=8,expiration = (uint32_t)(time(NULL) + duration); + char *retstr; cJSON *retjson=0; uint32_t expiration = (uint32_t)(time(NULL) + duration); printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid); sleep(10); //if ( sleeptime < divisor*60 ) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index c946dbc89..f4a2b473e 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -553,159 +553,171 @@ int32_t iguana_getheadersize(char *buf,int32_t recvlen) return(recvlen); } -void stats_rpcloop(void *args) +uint16_t RPC_port; + +void LP_rpc_processreq(void *_ptr) { - static char *jsonbuf; - uint16_t port; char filetype[128],content_type[128]; - int32_t recvlen,flag,bindsock,postflag=0,contentlen,sock,remains,numsent,jsonflag=0,hdrsize,len; - socklen_t clilen; char helpname[512],remoteaddr[64],*buf,*retstr,*space; - struct sockaddr_in cli_addr; uint32_t ipbits,i,size = 32*IGUANA_MAXPACKETSIZE + 512; - if ( (port= *(uint16_t *)args) == 0 ) - port = 7779; - if ( jsonbuf == 0 ) - jsonbuf = calloc(1,IGUANA_MAXPACKETSIZE); - while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) - { - //if ( coin->MAXPEERS == 1 ) - // break; - //exit(-1); - sleep(3); - } - printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock); + uint64_t arg64 = *(uint64_t *)_ptr; + char filetype[128],content_type[128]; + int32_t recvlen,flag,postflag=0,contentlen,remains,sock,numsent,jsonflag=0,hdrsize,len; + char helpname[512],remoteaddr[64],*buf,*retstr,*space,*jsonbuf; + uint32_t ipbits,i,size = 32*IGUANA_MAXPACKETSIZE + 512; + ipbits = (arg64 >> 32); + expand_ipbits(remoteaddr,ipbits); + sock = (arg64 & 0xffffffff); + recvlen = flag = 0; + retstr = 0; space = calloc(1,size); - while ( bindsock >= 0 ) + jsonbuf = calloc(1,size); + remains = size-1; + buf = jsonbuf; + while ( remains > 0 ) { - clilen = sizeof(cli_addr); - sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen); - if ( sock < 0 ) - { - //printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); - continue; - } - memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); - expand_ipbits(remoteaddr,ipbits); - //printf("remote RPC request from (%s) %x\n",remoteaddr,ipbits); - - memset(jsonbuf,0,IGUANA_MAXPACKETSIZE); - remains = (int32_t)(IGUANA_MAXPACKETSIZE - 1); - buf = jsonbuf; - recvlen = flag = 0; - retstr = 0; - while ( remains > 0 ) + //printf("flag.%d remains.%d recvlen.%d\n",flag,remains,recvlen); + if ( (len= (int32_t)recv(sock,buf,remains,0)) < 0 ) { - //printf("flag.%d remains.%d recvlen.%d\n",flag,remains,recvlen); - if ( (len= (int32_t)recv(sock,buf,remains,0)) < 0 ) + if ( errno == EAGAIN ) { - if ( errno == EAGAIN ) - { - printf("EAGAIN for len %d, remains.%d\n",len,remains); - usleep(10000); - } - break; + printf("EAGAIN for len %d, remains.%d\n",len,remains); + usleep(10000); } - else + break; + } + else + { + if ( len > 0 ) { - if ( len > 0 ) + buf[len] = 0; + if ( recvlen == 0 ) { - buf[len] = 0; - if ( recvlen == 0 ) + if ( (contentlen= iguana_getcontentlen(buf,recvlen)) > 0 ) { - if ( (contentlen= iguana_getcontentlen(buf,recvlen)) > 0 ) + hdrsize = iguana_getheadersize(buf,recvlen); + if ( hdrsize > 0 ) { - hdrsize = iguana_getheadersize(buf,recvlen); - if ( hdrsize > 0 ) + if ( len < (hdrsize + contentlen) ) { - if ( len < (hdrsize + contentlen) ) - { - remains = (hdrsize + contentlen) - len; - buf = &buf[len]; - flag = 1; - //printf("got.(%s) %d remains.%d of len.%d contentlen.%d hdrsize.%d remains.%d\n",buf,recvlen,remains,len,contentlen,hdrsize,(hdrsize+contentlen)-len); - continue; - } + remains = (hdrsize + contentlen) - len; + buf = &buf[len]; + flag = 1; + //printf("got.(%s) %d remains.%d of len.%d contentlen.%d hdrsize.%d remains.%d\n",buf,recvlen,remains,len,contentlen,hdrsize,(hdrsize+contentlen)-len); + continue; } } } - recvlen += len; - remains -= len; - buf = &buf[len]; - if ( flag == 0 || remains <= 0 ) - break; - } - else - { - usleep(10000); - //printf("got.(%s) %d remains.%d of total.%d\n",jsonbuf,recvlen,remains,len); - //retstr = iguana_rpcparse(space,size,&postflag,jsonbuf); - if ( flag == 0 ) - break; } + recvlen += len; + remains -= len; + buf = &buf[len]; + if ( flag == 0 || remains <= 0 ) + break; } - } - content_type[0] = 0; - if ( recvlen > 0 ) - { - retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,port); - if ( filetype[0] != 0 ) + else { - static cJSON *mimejson; char *tmp,*typestr=0; long tmpsize; - sprintf(helpname,"%s/mime.json",GLOBAL_HELPDIR); - if ( (tmp= OS_filestr(&tmpsize,helpname)) != 0 ) - { - mimejson = cJSON_Parse(tmp); - free(tmp); - } - if ( mimejson != 0 ) - { - if ( (typestr= jstr(mimejson,filetype)) != 0 ) - sprintf(content_type,"Content-Type: %s\r\n",typestr); - } else printf("parse error.(%s)\n",tmp); - //printf("filetype.(%s) json.%p type.%p tmp.%p [%s]\n",filetype,mimejson,typestr,tmp,content_type); + usleep(10000); + //printf("got.(%s) %d remains.%d of total.%d\n",jsonbuf,recvlen,remains,len); + //retstr = iguana_rpcparse(space,size,&postflag,jsonbuf); + if ( flag == 0 ) + break; } } - if ( retstr != 0 ) + } + content_type[0] = 0; + if ( recvlen > 0 ) + { + jsonflag = postflag = 0; + retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); + if ( filetype[0] != 0 ) { - char *response,hdrs[1024]; - //printf("RETURN.(%s) jsonflag.%d postflag.%d\n",retstr,jsonflag,postflag); - if ( jsonflag != 0 || postflag != 0 ) + static cJSON *mimejson; char *tmp,*typestr=0; long tmpsize; + sprintf(helpname,"%s/mime.json",GLOBAL_HELPDIR); + if ( (tmp= OS_filestr(&tmpsize,helpname)) != 0 ) { - if ( retstr == 0 ) - retstr = clonestr("{}"); - response = malloc(strlen(retstr)+1024+1+1); - sprintf(hdrs,"HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET, POST\r\nCache-Control : no-cache, no-store, must-revalidate\r\n%sContent-Length : %8d\r\n\r\n",content_type,(int32_t)strlen(retstr)); - response[0] = '\0'; - strcat(response,hdrs); - strcat(response,retstr); - strcat(response,"\n"); - if ( retstr != space ) - free(retstr); - retstr = response; - //printf("RET.(%s)\n",retstr); + mimejson = cJSON_Parse(tmp); + free(tmp); } - remains = (int32_t)strlen(retstr); - i = 0; - while ( remains > 0 ) + if ( mimejson != 0 ) { - if ( (numsent= (int32_t)send(sock,&retstr[i],remains,MSG_NOSIGNAL)) < 0 ) - { - if ( errno != EAGAIN && errno != EWOULDBLOCK ) - { - //printf("%s: %s numsent.%d vs remains.%d len.%d errno.%d (%s) usock.%d\n",retstr,ipaddr,numsent,remains,recvlen,errno,strerror(errno),sock); - break; - } - } - else if ( remains > 0 ) + if ( (typestr= jstr(mimejson,filetype)) != 0 ) + sprintf(content_type,"Content-Type: %s\r\n",typestr); + } else printf("parse error.(%s)\n",tmp); + //printf("filetype.(%s) json.%p type.%p tmp.%p [%s]\n",filetype,mimejson,typestr,tmp,content_type); + } + } + if ( retstr != 0 ) + { + char *response,hdrs[1024]; + //printf("RETURN.(%s) jsonflag.%d postflag.%d\n",retstr,jsonflag,postflag); + if ( jsonflag != 0 || postflag != 0 ) + { + if ( retstr == 0 ) + retstr = clonestr("{}"); + response = malloc(strlen(retstr)+1024+1+1); + sprintf(hdrs,"HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET, POST\r\nCache-Control : no-cache, no-store, must-revalidate\r\n%sContent-Length : %8d\r\n\r\n",content_type,(int32_t)strlen(retstr)); + response[0] = '\0'; + strcat(response,hdrs); + strcat(response,retstr); + strcat(response,"\n"); + if ( retstr != space ) + free(retstr); + retstr = response; + //printf("RET.(%s)\n",retstr); + } + remains = (int32_t)strlen(retstr); + i = 0; + while ( remains > 0 ) + { + if ( (numsent= (int32_t)send(sock,&retstr[i],remains,MSG_NOSIGNAL)) < 0 ) + { + if ( errno != EAGAIN && errno != EWOULDBLOCK ) { - remains -= numsent; - i += numsent; - if ( remains > 0 ) - printf("iguana sent.%d remains.%d of len.%d\n",numsent,remains,recvlen); + //printf("%s: %s numsent.%d vs remains.%d len.%d errno.%d (%s) usock.%d\n",retstr,ipaddr,numsent,remains,recvlen,errno,strerror(errno),sock); + break; } } - if ( retstr != space) - free(retstr); + else if ( remains > 0 ) + { + remains -= numsent; + i += numsent; + if ( remains > 0 ) + printf("iguana sent.%d remains.%d of len.%d\n",numsent,remains,recvlen); + } } - closesocket(sock); + if ( retstr != space) + free(retstr); + } + free(space); + free(jsonbuf); + closesocket(sock); +} + +void stats_rpcloop(void *args) +{ + uint16_t port; int32_t sock,bindsock; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; + if ( (port= *(uint16_t *)args) == 0 ) + port = 7779; + RPC_port = port; + while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) + { + //if ( coin->MAXPEERS == 1 ) + // break; + //exit(-1); + sleep(3); + } + printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock); + while ( bindsock >= 0 ) + { + clilen = sizeof(cli_addr); + sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen); + if ( sock < 0 ) + { + //printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); + continue; + } + memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); + //printf("remote RPC request from (%s) %x\n",remoteaddr,ipbits); + arg64 = ((uint64_t)ipbits << 32) | (sock & 0xffffffff); + LP_rpc_processreq((void *)&arg64); } } From 806af4234cc7837e319c91a7a42e033a6f3b67cc Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:01:40 +0300 Subject: [PATCH 108/346] New thread per roc --- iguana/exchanges/LP_nativeDEX.c | 2 ++ iguana/exchanges/stats.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 475ad8494..f6027076a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -257,12 +257,14 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int { if ( jobj(argjson,"method") != 0 && strcmp("connect",jstr(argjson,"method")) == 0 ) printf("self.(%s)\n",str); + portable_mutex_lock(&LP_commandmutex); if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 ) { if ( (retstr= stats_JSON(ctx,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 ) free(retstr); } free_json(argjson); + portable_mutex_unlock(&LP_commandmutex); } free(str); } diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index f4a2b473e..917d67d08 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -554,6 +554,7 @@ int32_t iguana_getheadersize(char *buf,int32_t recvlen) } uint16_t RPC_port; +extern portable_mutex_t LP_commandmutex; void LP_rpc_processreq(void *_ptr) { @@ -626,7 +627,9 @@ void LP_rpc_processreq(void *_ptr) if ( recvlen > 0 ) { jsonflag = postflag = 0; + portable_mutex_lock(&LP_commandmutex); retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); + portable_mutex_unlock(&LP_commandmutex); if ( filetype[0] != 0 ) { static cJSON *mimejson; char *tmp,*typestr=0; long tmpsize; @@ -693,7 +696,7 @@ void LP_rpc_processreq(void *_ptr) void stats_rpcloop(void *args) { - uint16_t port; int32_t sock,bindsock; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; + uint16_t port; int32_t sock,bindsock; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; void *arg64ptr; if ( (port= *(uint16_t *)args) == 0 ) port = 7779; RPC_port = port; @@ -717,11 +720,21 @@ void stats_rpcloop(void *args) memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); //printf("remote RPC request from (%s) %x\n",remoteaddr,ipbits); arg64 = ((uint64_t)ipbits << 32) | (sock & 0xffffffff); - LP_rpc_processreq((void *)&arg64); + arg64ptr = malloc(sizeof(arg64)); + memcpy(arg64ptr,&arg64,sizeof(arg64)); + //LP_rpc_processreq((void *)&arg64); + if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_rpc_processreq,arg64ptr) != 0 ) + { + printf("error launching rpc handler on port %d\n",port); + } + // yes, small leak per command } } #ifndef FROM_MARKETMAKER + +portable_mutex_t LP_commandmutex; + void stats_kvjson(FILE *logfp,int32_t height,int32_t savedheight,uint32_t timestamp,char *key,cJSON *kvjson,bits256 pubkey,bits256 sigprev) { struct tai T; int32_t seconds,datenum,n; From f908bb0c8cf03fa91ed704202dfabb455c809b29 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:05:56 +0300 Subject: [PATCH 109/346] Test --- iguana/exchanges/LP_nativeDEX.c | 3 +-- iguana/exchanges/LP_rpc.c | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index f6027076a..10f936fe9 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -344,7 +344,6 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) printf("n.%d total %.8f\n",n,dstr(total)); if ( n > 0 && total > 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr)) != 0 ) { - printf("%s -> (%s)\n",peer->ipaddr,retstr); total2 = 0; if ( (array2= cJSON_Parse(retstr)) != 0 ) { @@ -383,7 +382,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } else printf("parse error (%s)\n",retstr); free(retstr); } - else if ( n == 0 && total == 0 ) + else if ( n != 0 && total != 0 ) printf("no response from %s for %s\n",peer->ipaddr,coin->symbol); } if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")) != 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 93f9e2fbb..80ac137c7 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -94,10 +94,11 @@ char *issue_LP_getprices(char *destip,uint16_t destport) char *issue_LP_listunspent(char *destip,uint16_t destport,char *symbol,char *coinaddr) { - char url[512]; + char url[512],*retstr; sprintf(url,"http://%s:%u/api/stats/listunspent?coin=%s&address=%s",destip,destport,symbol,coinaddr); - //printf("listunspent.(%s)\n",url); - return(LP_issue_curl("listunspent",destip,destport,url)); + retstr = LP_issue_curl("listunspent",destip,destport,url); + printf("listunspent.(%s) -> (%s)\n",url,retstr); + return(retstr); } char *LP_apicall(struct iguana_info *coin,char *method,char *params) From ca98fe9b0315b7233d4508dd942a1ae01f15bcb6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:16:44 +0300 Subject: [PATCH 110/346] Test --- iguana/exchanges/LP_commands.c | 9 ++++++--- iguana/exchanges/LP_nativeDEX.c | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 602c5a598..817a74988 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -376,9 +376,12 @@ dividends(coin, height, )\n\ char *coinaddr; if ( (coinaddr= jstr(argjson,"address")) != 0 ) { - if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) - LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); - LP_listunspent_issue(coin,coinaddr); + if ( coinaddr[0] != 0 ) + { + if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) + LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); + LP_listunspent_issue(coin,coinaddr); + } return(jprint(LP_address_utxos(ptr,coinaddr,1),1)); } else return(clonestr("{\"error\":\"no address specified\"}")); } else return(clonestr("{\"error\":\"cant find coind\"}")); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 10f936fe9..274d7f6d2 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -327,6 +327,8 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) { if ( IAMLP == 0 && coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; + if ( coin->smartaddr[0] == 0 ) + continue; total = 0; if ( (j= LP_listunspent_both(coin->symbol,coin->smartaddr)) == 0 ) continue; @@ -396,7 +398,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) item = jitem(array2,j); if ( (coinaddr= jfieldname(item)) != 0 ) { - metric = j64bits(item,"coinaddr"); + metric = j64bits(item,coinaddr); //printf("(%s) -> %.8f n.%d\n",coinaddr,dstr(metric>>16),(uint16_t)metric); if ( (ap= LP_addressfind(coin,coinaddr)) == 0 || _LP_unspents_metric(ap->total,ap->n) != metric ) { From 590361d86e25c1e185d77cf1fb5c34b600621a47 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:22:41 +0300 Subject: [PATCH 111/346] Test --- iguana/exchanges/LP_nativeDEX.c | 3 +-- iguana/exchanges/LP_rpc.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 274d7f6d2..923f18977 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -332,7 +332,6 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) total = 0; if ( (j= LP_listunspent_both(coin->symbol,coin->smartaddr)) == 0 ) continue; - printf("UTXO sync.%d %s -> %s\n",j,coin->symbol,peer->ipaddr); if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) { if ( (n= cJSON_GetArraySize(array)) > 0 ) @@ -343,9 +342,9 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) total += j64bits(item,"value"); } } - printf("n.%d total %.8f\n",n,dstr(total)); if ( n > 0 && total > 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr)) != 0 ) { + printf("UTXO sync.%d %s n.%d total %.8f -> %s\n",j,coin->symbol,n,dstr(total),peer->ipaddr); total2 = 0; if ( (array2= cJSON_Parse(retstr)) != 0 ) { diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 80ac137c7..be270d8c5 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -97,7 +97,7 @@ char *issue_LP_listunspent(char *destip,uint16_t destport,char *symbol,char *coi char url[512],*retstr; sprintf(url,"http://%s:%u/api/stats/listunspent?coin=%s&address=%s",destip,destport,symbol,coinaddr); retstr = LP_issue_curl("listunspent",destip,destport,url); - printf("listunspent.(%s) -> (%s)\n",url,retstr); + //printf("listunspent.(%s) -> (%s)\n",url,retstr); return(retstr); } From 47366177ac07ff44abe17f492217752d12a148d2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:38:06 +0300 Subject: [PATCH 112/346] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 46bdd0710..0808149cc 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -37,7 +37,7 @@ #define LP_GETINFO_INCR 30 #define LP_ORDERBOOK_DURATION 3600 -#define LP_HTTP_TIMEOUT 5 // 1 is too small due to edge cases of time(NULL) +#define LP_HTTP_TIMEOUT 3 // 1 is too small due to edge cases of time(NULL) #define LP_MAXPEER_ERRORS 3 #define LP_MINPEER_GOOD 20 #define LP_PEERGOOD_ERRORDECAY 0.9 diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 923f18977..de434d70e 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -318,6 +318,31 @@ void command_rpcloop(void *myipaddr) } } +void LP_smartutxos_push(struct iguana_info *coin) +{ + struct LP_peerinfo *peer,*tmp; uint64_t value; bits256 txid; int32_t i,vout,height,n; char *retstr; cJSON *array,*item; + if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) + { + if ( (n= cJSON_GetArraySize(array)) > 0 ) + { + for (i=0; iipaddr,peer->port,coin->symbol,coin->smartaddr,txid,vout,height,value)) != 0 ) + free(retstr); + } + } + } + free_json(array); + } +} + int32_t LP_utxos_sync(struct LP_peerinfo *peer) { int32_t i,j,n=0,m,v,posted=0; bits256 txid; cJSON *array,*item,*item2,*array2,*array3; uint64_t total,total2,metric; struct iguana_info *coin,*ctmp; struct LP_address *ap; char *retstr,*retstr2,*coinaddr; @@ -463,6 +488,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( peer->diduquery == 0 ) { + needpings++; LP_peer_pricesquery(peer); LP_utxos_sync(peer); peer->diduquery = now; @@ -479,6 +505,10 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int { //printf("needpings.%d send notify\n",needpings); LP_notify_pubkeys(ctx,pubsock); + HASH_ITER(hh,LP_coins,coin,ctmp) + { + LP_smartutxos_push(coin); + } } if ( (counter % 6000) == 10 ) { From a404823f4e97d6e8f181346ea9a8d1b685f9072a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:40:50 +0300 Subject: [PATCH 113/346] Test --- iguana/exchanges/LP_nativeDEX.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index de434d70e..c0b202599 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -321,10 +321,13 @@ void command_rpcloop(void *myipaddr) void LP_smartutxos_push(struct iguana_info *coin) { struct LP_peerinfo *peer,*tmp; uint64_t value; bits256 txid; int32_t i,vout,height,n; char *retstr; cJSON *array,*item; + if ( coin->smartaddr[0] == 0 ) + return; if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) { if ( (n= cJSON_GetArraySize(array)) > 0 ) { + printf("PUSH %s %s\n",coin->symbol,coin->smartaddr); for (i=0; i Date: Fri, 13 Oct 2017 17:58:40 +0300 Subject: [PATCH 114/346] Test --- iguana/exchanges/LP_nativeDEX.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index c0b202599..24a612c22 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -483,6 +483,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int { if ( strcmp(peer->ipaddr,myipaddr) != 0 ) { + nonz++; LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport); peer->diduquery = 0; LP_utxos_sync(peer); @@ -491,6 +492,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( peer->diduquery == 0 ) { + nonz++; needpings++; LP_peer_pricesquery(peer); LP_utxos_sync(peer); @@ -498,6 +500,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( peer->needping != 0 ) { + nonz++; needpings++; if ( (retstr= issue_LP_notify(peer->ipaddr,peer->port,"127.0.0.1",0,numpeers,G.LP_sessionid,G.LP_myrmd160str,G.LP_mypub25519)) != 0 ) free(retstr); @@ -506,15 +509,13 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( needpings != 0 || (counter % 6000) == 5 ) { - //printf("needpings.%d send notify\n",needpings); + nonz++; + printf("needpings.%d send notify\n",needpings); LP_notify_pubkeys(ctx,pubsock); - HASH_ITER(hh,LP_coins,coin,ctmp) - { - LP_smartutxos_push(coin); - } } if ( (counter % 6000) == 10 ) { + nonz++; LP_privkey_updates(ctx,pubsock,0); } HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht @@ -522,12 +523,18 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int memset(&zero,0,sizeof(zero)); if ( coin->inactive != 0 ) continue; + if ( (counter % 6000) == 100 ) + { + LP_smartutxos_push(coin); + nonz++; + } if ( coin->electrum != 0 ) continue; //if ( coin->obooktime == 0 ) // continue; if ( time(NULL) > coin->lastgetinfo+LP_GETINFO_INCR ) { + nonz++; if ( (height= LP_getheight(coin)) > coin->longestchain ) { coin->longestchain = height; @@ -572,6 +579,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( j < 100 ) continue; + nonz++; //LP_getestimatedrate(coin); break; } @@ -580,6 +588,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int if ( (retstr= basilisk_swapentry(0,0)) != 0 ) { //printf("SWAPS.(%s)\n",retstr); + nonz++; free(retstr); } } @@ -816,8 +825,9 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 ) nonz++; if ( nonz == 0 ) - usleep(50000); - else usleep(5000); + usleep(1000); + else if ( IAMLP == 0 ) + usleep(10000); } } From d08f6215e655bf9485dcca538bed6fec3dc92ac3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 18:44:29 +0300 Subject: [PATCH 115/346] Test --- iguana/exchanges/stats.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 917d67d08..507aafb22 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -627,6 +627,7 @@ void LP_rpc_processreq(void *_ptr) if ( recvlen > 0 ) { jsonflag = postflag = 0; + printf("RPC.(%s)\n",jsonbuf); portable_mutex_lock(&LP_commandmutex); retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); portable_mutex_unlock(&LP_commandmutex); From cf342a210f7ec78458ca8c406f7204c27c685e19 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 18:50:43 +0300 Subject: [PATCH 116/346] Test --- iguana/exchanges/stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 507aafb22..27dda90ba 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -627,9 +627,9 @@ void LP_rpc_processreq(void *_ptr) if ( recvlen > 0 ) { jsonflag = postflag = 0; - printf("RPC.(%s)\n",jsonbuf); portable_mutex_lock(&LP_commandmutex); retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); + printf("RPC.(%s)%s\n",jsonbuf,retstr); portable_mutex_unlock(&LP_commandmutex); if ( filetype[0] != 0 ) { From 4dabdc066c43f7907415d349e3118f471f403902 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 18:55:57 +0300 Subject: [PATCH 117/346] Test --- iguana/exchanges/stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 27dda90ba..ab1e5cc2b 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -629,7 +629,7 @@ void LP_rpc_processreq(void *_ptr) jsonflag = postflag = 0; portable_mutex_lock(&LP_commandmutex); retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); - printf("RPC.(%s)%s\n",jsonbuf,retstr); + //printf("RPC.(%s)%s\n",jsonbuf,retstr); portable_mutex_unlock(&LP_commandmutex); if ( filetype[0] != 0 ) { From 4eec1c9c3d4318bda4abeda4bb0d0068c189194f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 19:22:53 +0300 Subject: [PATCH 118/346] Test --- iguana/exchanges/stats.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index ab1e5cc2b..eeee71816 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -629,7 +629,8 @@ void LP_rpc_processreq(void *_ptr) jsonflag = postflag = 0; portable_mutex_lock(&LP_commandmutex); retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); - //printf("RPC.(%s)%s\n",jsonbuf,retstr); + if ( strcmp("5.9.253.195",remoteaddr) == 0 ) + printf("RPC.(%s)%s\n",jsonbuf,retstr); portable_mutex_unlock(&LP_commandmutex); if ( filetype[0] != 0 ) { From 9e0a743ad8c76e276b79237eec9c1e37249d08dc Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 19:52:12 +0300 Subject: [PATCH 119/346] Test --- iguana/exchanges/LP_nativeDEX.c | 15 +++++++++++++-- iguana/exchanges/LP_rpc.c | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 24a612c22..0856747b8 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -372,7 +372,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( n > 0 && total > 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr)) != 0 ) { - printf("UTXO sync.%d %s n.%d total %.8f -> %s\n",j,coin->symbol,n,dstr(total),peer->ipaddr); + printf("UTXO sync.%d %s n.%d total %.8f -> %s (%s)\n",j,coin->symbol,n,dstr(total),peer->ipaddr,retstr); total2 = 0; if ( (array2= cJSON_Parse(retstr)) != 0 ) { @@ -412,7 +412,18 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) free(retstr); } else if ( n != 0 && total != 0 ) - printf("no response from %s for %s\n",peer->ipaddr,coin->symbol); + { + printf("no response from %s for %s %s\n",peer->ipaddr,coin->symbol,coin->smartaddr); + for (i=0; iipaddr,peer->port,coin->symbol,coin->smartaddr,txid,v,jint(item,"height"),j64bits(item,"value"))) != 0 ) + free(retstr2); + } + } + free_json(array); } if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")) != 0 ) { diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index be270d8c5..80ac137c7 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -97,7 +97,7 @@ char *issue_LP_listunspent(char *destip,uint16_t destport,char *symbol,char *coi char url[512],*retstr; sprintf(url,"http://%s:%u/api/stats/listunspent?coin=%s&address=%s",destip,destport,symbol,coinaddr); retstr = LP_issue_curl("listunspent",destip,destport,url); - //printf("listunspent.(%s) -> (%s)\n",url,retstr); + printf("listunspent.(%s) -> (%s)\n",url,retstr); return(retstr); } From b363add7b7e12413e6cdd66a46d70be770bd215a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 19:54:38 +0300 Subject: [PATCH 120/346] Test --- iguana/exchanges/LP_nativeDEX.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0856747b8..f533064e5 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -372,7 +372,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( n > 0 && total > 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr)) != 0 ) { - printf("UTXO sync.%d %s n.%d total %.8f -> %s (%s)\n",j,coin->symbol,n,dstr(total),peer->ipaddr,retstr); + //printf("UTXO sync.%d %s n.%d total %.8f -> %s (%s)\n",j,coin->symbol,n,dstr(total),peer->ipaddr,retstr); total2 = 0; if ( (array2= cJSON_Parse(retstr)) != 0 ) { @@ -398,13 +398,13 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( j == m ) { - printf("%s missing %s %s\n",peer->ipaddr,coin->symbol,jprint(item,0)); + //printf("%s missing %s %s\n",peer->ipaddr,coin->symbol,jprint(item,0)); if ( (retstr2= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,v,jint(item,"height"),j64bits(item,"value"))) != 0 ) free(retstr2); posted++; } } - if ( 1 && posted != 0 ) + if ( 0 && posted != 0 ) printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m); } else printf("%s matches %s\n",peer->ipaddr,coin->symbol); free_json(array2); @@ -413,7 +413,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } else if ( n != 0 && total != 0 ) { - printf("no response from %s for %s %s\n",peer->ipaddr,coin->symbol,coin->smartaddr); + //printf("no response from %s for %s %s\n",peer->ipaddr,coin->symbol,coin->smartaddr); for (i=0; iinactive != 0 ) continue; - if ( (counter % 6000) == 100 ) + /*if ( (counter % 6000) == 100 ) { LP_smartutxos_push(coin); nonz++; - } + }*/ if ( coin->electrum != 0 ) continue; //if ( coin->obooktime == 0 ) From b385cc2e735671632a0c4e700375ee3d3c95021a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 19:57:04 +0300 Subject: [PATCH 121/346] Test --- iguana/exchanges/stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index eeee71816..e3e0060cd 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -629,8 +629,8 @@ void LP_rpc_processreq(void *_ptr) jsonflag = postflag = 0; portable_mutex_lock(&LP_commandmutex); retstr = stats_rpcparse(space,size,&jsonflag,&postflag,jsonbuf,remoteaddr,filetype,RPC_port); - if ( strcmp("5.9.253.195",remoteaddr) == 0 ) - printf("RPC.(%s)%s\n",jsonbuf,retstr); + //if ( strcmp("5.9.253.195",remoteaddr) == 0 ) + // printf("RPC.(%s)%s\n",jsonbuf,retstr); portable_mutex_unlock(&LP_commandmutex); if ( filetype[0] != 0 ) { From 41df4117937bb5adebcfcaa2557c46a4c63dd3d6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 19:57:28 +0300 Subject: [PATCH 122/346] Test --- iguana/exchanges/LP_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 80ac137c7..be270d8c5 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -97,7 +97,7 @@ char *issue_LP_listunspent(char *destip,uint16_t destport,char *symbol,char *coi char url[512],*retstr; sprintf(url,"http://%s:%u/api/stats/listunspent?coin=%s&address=%s",destip,destport,symbol,coinaddr); retstr = LP_issue_curl("listunspent",destip,destport,url); - printf("listunspent.(%s) -> (%s)\n",url,retstr); + //printf("listunspent.(%s) -> (%s)\n",url,retstr); return(retstr); } From 62b3b5d714b10b1818121cd65e39d4441589ce9a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:04:42 +0300 Subject: [PATCH 123/346] Test --- iguana/exchanges/LP_commands.c | 1 + iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_nativeDEX.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 817a74988..535b46cff 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -311,6 +311,7 @@ dividends(coin, height, )\n\ jaddnum(retjson,"timestamp",time(NULL)); jadd(retjson,"alice",LP_inventory(coin)); //jadd(retjson,"bob",LP_inventory(coin,1)); + LP_smartutxos_push(ptr); return(jprint(retjson,1)); } } diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 0808149cc..bb24eccd2 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -312,6 +312,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS int32_t LP_mempoolscan(char *symbol,bits256 searchtxid); int32_t LP_txheight(struct iguana_info *coin,bits256 txid); int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight); +void LP_smartutxos_push(struct iguana_info *coin); cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret); cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout); void LP_postutxos(char *symbol,char *coinaddr); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index f533064e5..570272669 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -406,7 +406,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } if ( 0 && posted != 0 ) printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m); - } else printf("%s matches %s\n",peer->ipaddr,coin->symbol); + } //else printf("%s matches %s\n",peer->ipaddr,coin->symbol); free_json(array2); } else printf("parse error (%s)\n",retstr); free(retstr); @@ -521,7 +521,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int if ( needpings != 0 || (counter % 6000) == 5 ) { nonz++; - printf("needpings.%d send notify\n",needpings); + //printf("needpings.%d send notify\n",needpings); LP_notify_pubkeys(ctx,pubsock); } if ( (counter % 6000) == 10 ) From 7c9e6e6b505fedd00307ac65d015b77e391fa36c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:08:05 +0300 Subject: [PATCH 124/346] Test --- iguana/exchanges/LP_commands.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 535b46cff..4f9860119 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -379,9 +379,12 @@ dividends(coin, height, )\n\ { if ( coinaddr[0] != 0 ) { + LP_listunspent_issue(coin,coinaddr); if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) + { LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); - LP_listunspent_issue(coin,coinaddr); + LP_smartutxos_push(ptr); + } } return(jprint(LP_address_utxos(ptr,coinaddr,1),1)); } else return(clonestr("{\"error\":\"no address specified\"}")); From e906dd4c4ca40d5c9c244935923fa3372c670a1c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:08:32 +0300 Subject: [PATCH 125/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 62e0757bf..499d2af9d 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -472,7 +472,7 @@ cJSON *LP_inventory(char *symbol) // LP_utxo_clientpublish(utxo); jaddi(array,LP_inventoryjson(cJSON_CreateObject(),utxo)); } - else if ( LP_ismine(utxo) > 0 && strcmp(symbol,utxo->coin) == 0 ) + else if ( 0 && LP_ismine(utxo) > 0 && strcmp(symbol,utxo->coin) == 0 ) printf("skip %s %s %d %d %d %d\n",utxo->coin,bits256_str(str,utxo->payment.txid),LP_isunspent(utxo) != 0,strcmp(symbol,utxo->coin) == 0,utxo->iambob == iambob,LP_ismine(utxo) > 0); } return(array); From a7fb628f715c65044d60e256a7510a26b23e5e28 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:14:51 +0300 Subject: [PATCH 126/346] Test --- iguana/exchanges/stats.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index e3e0060cd..8e5099814 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -724,8 +724,12 @@ void stats_rpcloop(void *args) arg64 = ((uint64_t)ipbits << 32) | (sock & 0xffffffff); arg64ptr = malloc(sizeof(arg64)); memcpy(arg64ptr,&arg64,sizeof(arg64)); - //LP_rpc_processreq((void *)&arg64); - if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_rpc_processreq,arg64ptr) != 0 ) + if ( 1 ) + { + LP_rpc_processreq((void *)&arg64); + free(arg64ptr); + } + else if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_rpc_processreq,arg64ptr) != 0 ) { printf("error launching rpc handler on port %d\n",port); } From 786c5ca7241e12d64ca164f1ddc7f6555e885a39 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:18:32 +0300 Subject: [PATCH 127/346] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_include.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 4f9860119..c1de78f0a 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -379,7 +379,7 @@ dividends(coin, height, )\n\ { if ( coinaddr[0] != 0 ) { - LP_listunspent_issue(coin,coinaddr); + //LP_listunspent_issue(coin,coinaddr); if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index bb24eccd2..450f3e67a 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -37,7 +37,7 @@ #define LP_GETINFO_INCR 30 #define LP_ORDERBOOK_DURATION 3600 -#define LP_HTTP_TIMEOUT 3 // 1 is too small due to edge cases of time(NULL) +#define LP_HTTP_TIMEOUT 2 // 1 is too small due to edge cases of time(NULL) #define LP_MAXPEER_ERRORS 3 #define LP_MINPEER_GOOD 20 #define LP_PEERGOOD_ERRORDECAY 0.9 From 0fffd2bf91ea70dddf5e7cf8a1be4a2917fce0b5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:35:46 +0300 Subject: [PATCH 128/346] Test --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 570272669..61c71ea8b 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -312,8 +312,8 @@ void command_rpcloop(void *myipaddr) if ( nonz == 0 ) { if ( IAMLP != 0 ) - usleep(10); - else usleep(1000); + usleep(1000); + else usleep(10000); } } } From 27b856ecf2ed9fe6050f11f076c6c215d716ae31 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 20:36:30 +0300 Subject: [PATCH 129/346] Test --- iguana/exchanges/LP_nativeDEX.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 61c71ea8b..f7d48da5c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -836,9 +836,10 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 ) nonz++; if ( nonz == 0 ) - usleep(1000); - else if ( IAMLP == 0 ) usleep(10000); + else if ( IAMLP != 0 ) + usleep(1000); + else usleep(10000); } } From 0707f72fbdc050a3c16c4d894443803fc0dcfaf4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:03:33 +0300 Subject: [PATCH 130/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 0bc2e2381..0af0c6001 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -247,7 +247,7 @@ void LP_notify_pubkeys(void *ctx,int32_t pubsock) char *LP_postedprice(cJSON *argjson) { bits256 pubkey; double price; char *base,*rel; - //printf("PRICE POSTED.(%s)\n",jprint(argjson,0)); + printf("PRICE POSTED.(%s)\n",jprint(argjson,0)); if ( (base= jstr(argjson,"base")) != 0 && (rel= jstr(argjson,"rel")) != 0 && (price= jdouble(argjson,"price")) > SMALLVAL ) { pubkey = jbits256(argjson,"pubkey"); From bebb405ca895c19351a2b241fbcb47085fbd7dc7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:15:29 +0300 Subject: [PATCH 131/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_prices.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 0af0c6001..0bc2e2381 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -247,7 +247,7 @@ void LP_notify_pubkeys(void *ctx,int32_t pubsock) char *LP_postedprice(cJSON *argjson) { bits256 pubkey; double price; char *base,*rel; - printf("PRICE POSTED.(%s)\n",jprint(argjson,0)); + //printf("PRICE POSTED.(%s)\n",jprint(argjson,0)); if ( (base= jstr(argjson,"base")) != 0 && (rel= jstr(argjson,"rel")) != 0 && (price= jdouble(argjson,"price")) > SMALLVAL ) { pubkey = jbits256(argjson,"pubkey"); diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 0ac50c0d4..0f9604dc7 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -773,9 +773,9 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) jaddi(array,LP_orderbookjson(rel,bids[i])); if ( bids[i]->numutxos == 0 )//|| relcoin->electrum == 0 ) { + LP_address(relcoin,bids[i]->coinaddr); if ( relcoin->electrum == 0 ) LP_listunspent_issue(rel,bids[i]->coinaddr); - else LP_address(relcoin,bids[i]->coinaddr); n++; } free(bids[i]); @@ -791,9 +791,9 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) jaddi(array,LP_orderbookjson(base,asks[i])); if ( asks[i]->numutxos == 0 )//|| basecoin->electrum == 0 ) { + LP_address(basecoin,asks[i]->coinaddr); if ( basecoin->electrum == 0 ) LP_listunspent_issue(base,asks[i]->coinaddr); - else LP_address(basecoin,asks[i]->coinaddr); n++; } free(asks[i]); From 81cadf7ff876610f2876c56ad87d123f93496329 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:23:13 +0300 Subject: [PATCH 132/346] Test --- iguana/exchanges/LP_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index c1de78f0a..4f9860119 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -379,7 +379,7 @@ dividends(coin, height, )\n\ { if ( coinaddr[0] != 0 ) { - //LP_listunspent_issue(coin,coinaddr); + LP_listunspent_issue(coin,coinaddr); if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); From 03ac17d5182c98650b2b8b653cb558b681b1b40f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:23:27 +0300 Subject: [PATCH 133/346] Test --- iguana/exchanges/LP_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 4f9860119..c27d4c3cc 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -383,7 +383,7 @@ dividends(coin, height, )\n\ if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); - LP_smartutxos_push(ptr); + //LP_smartutxos_push(ptr); } } return(jprint(LP_address_utxos(ptr,coinaddr,1),1)); From 6c0021d007599eee2e77281fb143de7f7633668e Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:29:08 +0300 Subject: [PATCH 134/346] Test --- iguana/exchanges/LP_commands.c | 4 ++++ iguana/exchanges/LP_rpc.c | 1 + 2 files changed, 5 insertions(+) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index c27d4c3cc..103950e88 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -385,6 +385,10 @@ dividends(coin, height, )\n\ LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); //LP_smartutxos_push(ptr); } + else + { + + } } return(jprint(LP_address_utxos(ptr,coinaddr,1),1)); } else return(clonestr("{\"error\":\"no address specified\"}")); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index be270d8c5..759b55e64 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -463,6 +463,7 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) else if ( (destport= LP_randpeer(destip)) > 0 ) { retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); + printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); retjson = cJSON_Parse(retstr); } else printf("LP_listunspent_issue couldnt get a random peer?\n"); if ( retjson != 0 ) From 520e5bbf8342cf94d9b095a197e3df038d2a101c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:53:35 +0300 Subject: [PATCH 135/346] Test --- iguana/exchanges/LP_commands.c | 43 +++++++++++++++++++++++++++++++- iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_ordermatch.c | 11 ++++++++ iguana/exchanges/LP_prices.c | 2 ++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 103950e88..71eb62250 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -363,7 +363,7 @@ dividends(coin, height, )\n\ coinaddr = jstr(argjson,"coinaddr"); if ( coin != 0 && coinaddr != 0 ) { - //char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); + char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1); } return(clonestr("{\"result\":\"success\"}")); @@ -416,6 +416,47 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"checktxid") == 0 ) retstr = LP_spentcheck(argjson); + else if ( strcmp(method,"addr_unspents") == 0 ) + { + if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) + { + char *coinaddr; cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; + if ( (coinaddr= jstr(argjson,"address")) != 0 ) + { + if ( coinaddr[0] != 0 ) + { + if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) + { + printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); + if ( (array= LP_address_utxos(ptr,coinaddr,1)) != 0 ) + { + memset(zero.bytes,0,sizeof(zero)); + if ( (n= cJSON_GetArraySize(array)) > 0 ) + { + for (i=0; icoinaddr); if ( relcoin->electrum == 0 ) LP_listunspent_issue(rel,bids[i]->coinaddr); + LP_listunspent_query(rel,bids[i]->coinaddr); n++; } free(bids[i]); @@ -794,6 +795,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) LP_address(basecoin,asks[i]->coinaddr); if ( basecoin->electrum == 0 ) LP_listunspent_issue(base,asks[i]->coinaddr); + LP_listunspent_query(base,asks[i]->coinaddr); n++; } free(asks[i]); From eedbc8de2a8bed43f135f3be24fde46b02c084d9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 21:54:34 +0300 Subject: [PATCH 136/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index f7d48da5c..2b7d1a6fe 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -425,7 +425,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) } free_json(array); } - if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")) != 0 ) + if ( 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")) != 0 ) { if ( (array2= cJSON_Parse(retstr)) != 0 ) { From 786d194ab7c874243005babbe92547d083798d6f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 22:01:03 +0300 Subject: [PATCH 137/346] Test --- iguana/exchanges/LP_commands.c | 1 + iguana/exchanges/LP_ordermatch.c | 1 + iguana/exchanges/LP_rpc.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 71eb62250..acdf5783a 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -418,6 +418,7 @@ dividends(coin, height, )\n\ retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) { + printf("GOT ADDR_UNSPENTS\n"); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { char *coinaddr; cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 6124c5c04..088d05f94 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -252,6 +252,7 @@ void LP_listunspent_query(char *symbol,char *coinaddr) jaddstr(reqjson,"coin",symbol); jaddstr(reqjson,"address",coinaddr); msg = jprint(reqjson,1); + printf("BROADCAST.(%s)\n",msg); LP_broadcast_message(LP_mypubsock,"","",zero,msg); } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 759b55e64..d4a9c1912 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -460,12 +460,12 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) retjson = LP_listunspent(symbol,coinaddr); //printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); } - else if ( (destport= LP_randpeer(destip)) > 0 ) + /*else if ( (destport= LP_randpeer(destip)) > 0 ) { retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); retjson = cJSON_Parse(retstr); - } else printf("LP_listunspent_issue couldnt get a random peer?\n"); + } else printf("LP_listunspent_issue couldnt get a random peer?\n");*/ if ( retjson != 0 ) { n = cJSON_GetArraySize(retjson); From bda40839538e67391c1ce6826f42e62af5ddf902 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 22:04:31 +0300 Subject: [PATCH 138/346] Test --- iguana/exchanges/LP_commands.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index acdf5783a..8f0062b3d 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -448,7 +448,8 @@ dividends(coin, height, )\n\ jaddnum(req,"vout",vout); jaddnum(req,"ht",height); jadd64bits(req,"value",value); - LP_broadcast_message(pubsock,"","",zero,jprint(reqjson,1)); + //printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); + LP_broadcast_message(pubsock,"","",zero,jprint(req,1)); } } free_json(array); @@ -457,6 +458,7 @@ dividends(coin, height, )\n\ } } } + retstr = clonestr("{\"result\":\"success\"}"); } else if ( strcmp(method,"getcoins") == 0 ) return(jprint(LP_coinsjson(0),1)); From 0d496c50839f05b9efec77541a56ea54a4f0fd44 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 22:07:34 +0300 Subject: [PATCH 139/346] Test --- iguana/exchanges/LP_commands.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 8f0062b3d..61d680375 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -443,6 +443,7 @@ dividends(coin, height, )\n\ value = j64bits(item,"value"); req = cJSON_CreateObject(); jaddstr(req,"method","uitem"); + jaddstr(req,"coin",ptr->symbol); jaddstr(req,"coinaddr",coinaddr); jaddbits256(req,"txid",txid); jaddnum(req,"vout",vout); From 247112cf388aa0c3267b66d1598066c63e2d6730 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 22:10:24 +0300 Subject: [PATCH 140/346] Test --- iguana/exchanges/LP_commands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 61d680375..d857c9f5a 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -418,7 +418,7 @@ dividends(coin, height, )\n\ retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) { - printf("GOT ADDR_UNSPENTS\n"); + //printf("GOT ADDR_UNSPENTS\n"); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { char *coinaddr; cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; @@ -428,7 +428,7 @@ dividends(coin, height, )\n\ { if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { - printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); + //printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); if ( (array= LP_address_utxos(ptr,coinaddr,1)) != 0 ) { memset(zero.bytes,0,sizeof(zero)); @@ -437,8 +437,8 @@ dividends(coin, height, )\n\ for (i=0; i Date: Fri, 13 Oct 2017 22:15:38 +0300 Subject: [PATCH 141/346] Test --- iguana/exchanges/LP_ordermatch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 088d05f94..247281d52 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -990,9 +990,10 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i if ( bits256_cmp(pubkey,G.LP_mypub25519) != 0 && (pubp= LP_pubkeyadd(pubkey)) != 0 ) { bitcoin_address(coinaddr,basecoin->taddr,basecoin->pubtype,pubp->rmd160,sizeof(pubp->rmd160)); + LP_listunspent_query(base,coinaddr); n = LP_listunspent_both(base,coinaddr); //printf("unspent.(%s) n.%d\n",coinaddr,n); - if ( n > 1 ) + //if ( n > 1 ) { basesatoshis = LP_basesatoshis(dstr(autxo->S.satoshis),price,txfee,desttxfee); if ( basesatoshis != 0 && (bestutxo= LP_address_utxopair(0,utxos,max,basecoin,coinaddr,txfee,dstr(basesatoshis)*price,price,desttxfee)) != 0 ) @@ -1005,7 +1006,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i printf("ordermatch %.8f %.8f %.8f txfees (%.8f %.8f)\n",price,dstr(*bestsatoshisp),dstr(*bestdestsatoshisp),dstr(txfee),dstr(desttxfee)); break; } - } else printf("no unspents %s %s %s\n",base,coinaddr,bits256_str(str,pubkey)); + } //else printf("no unspents %s %s %s\n",base,coinaddr,bits256_str(str,pubkey)); } else printf("self trading or blacklisted peer\n"); } else From bec2ed0757c4fe47a81fb2a49c9a540ff9c54c44 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 22:20:12 +0300 Subject: [PATCH 142/346] Test --- iguana/exchanges/LP_commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index d857c9f5a..a74d55e22 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -418,7 +418,7 @@ dividends(coin, height, )\n\ retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) { - //printf("GOT ADDR_UNSPENTS\n"); + printf("GOT ADDR_UNSPENTS\n"); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { char *coinaddr; cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; @@ -428,7 +428,7 @@ dividends(coin, height, )\n\ { if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { - //printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); + printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); if ( (array= LP_address_utxos(ptr,coinaddr,1)) != 0 ) { memset(zero.bytes,0,sizeof(zero)); @@ -449,7 +449,7 @@ dividends(coin, height, )\n\ jaddnum(req,"vout",vout); jaddnum(req,"ht",height); jadd64bits(req,"value",value); - //printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); + printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); LP_broadcast_message(pubsock,"","",zero,jprint(req,1)); } } From 0d21044ac2721fc859ed2db0191eef19fd10521c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 22:33:29 +0300 Subject: [PATCH 143/346] Test --- iguana/exchanges/LP_commands.c | 29 ++--------------------------- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 30 ++++++++++++++++++++++++------ iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_rpc.c | 2 +- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index a74d55e22..583b1096d 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -421,7 +421,7 @@ dividends(coin, height, )\n\ printf("GOT ADDR_UNSPENTS\n"); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { - char *coinaddr; cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; + char *coinaddr; //cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; if ( (coinaddr= jstr(argjson,"address")) != 0 ) { if ( coinaddr[0] != 0 ) @@ -429,32 +429,7 @@ dividends(coin, height, )\n\ if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); - if ( (array= LP_address_utxos(ptr,coinaddr,1)) != 0 ) - { - memset(zero.bytes,0,sizeof(zero)); - if ( (n= cJSON_GetArraySize(array)) > 0 ) - { - for (i=0; isymbol); - jaddstr(req,"coinaddr",coinaddr); - jaddbits256(req,"txid",txid); - jaddnum(req,"vout",vout); - jaddnum(req,"ht",height); - jadd64bits(req,"value",value); - printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); - LP_broadcast_message(pubsock,"","",zero,jprint(req,1)); - } - } - free_json(array); - } + ptr->addr_listunspent_requested = (uint32_t)time(NULL); } } } diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 3cc60f12f..c3ee027af 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -183,7 +183,7 @@ struct iguana_info portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses; uint64_t txfee; int32_t longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; - uint32_t lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,unspenttime,obooktime; + uint32_t addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,unspenttime,obooktime; uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag; char symbol[16],smartaddr[64],userpass[1024],serverport[128],lastunspent[64]; // portfolio diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 2b7d1a6fe..4d294fc9c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -320,11 +320,12 @@ void command_rpcloop(void *myipaddr) void LP_smartutxos_push(struct iguana_info *coin) { - struct LP_peerinfo *peer,*tmp; uint64_t value; bits256 txid; int32_t i,vout,height,n; char *retstr; cJSON *array,*item; + struct LP_peerinfo *peer,*tmp; uint64_t value; bits256 zero,txid; int32_t i,vout,height,n; char *retstr; cJSON *array,*item,*req; if ( coin->smartaddr[0] == 0 ) return; if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) { + memset(zero.bytes,0,sizeof(zero)); if ( (n= cJSON_GetArraySize(array)) > 0 ) { printf("PUSH %s %s\n",coin->symbol,coin->smartaddr); @@ -335,11 +336,27 @@ void LP_smartutxos_push(struct iguana_info *coin) vout = jint(item,"tx_pos"); value = j64bits(item,"value"); height = jint(item,"height"); + if ( 0 ) + { HASH_ITER(hh,LP_peerinfos,peer,tmp) { if ( (retstr= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,vout,height,value)) != 0 ) free(retstr); } + } + else + { + req = cJSON_CreateObject(); + jaddstr(req,"method","uitem"); + jaddstr(req,"coin",coin->symbol); + jaddstr(req,"coinaddr",coin->smartaddr); + jaddbits256(req,"txid",txid); + jaddnum(req,"vout",vout); + jaddnum(req,"ht",height); + jadd64bits(req,"value",value); + printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); + LP_broadcast_message(LP_mypubsock,"","",zero,jprint(req,1)); + } } } free_json(array); @@ -532,13 +549,14 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht { memset(&zero,0,sizeof(zero)); - if ( coin->inactive != 0 ) - continue; - /*if ( (counter % 6000) == 100 ) + if ( coin->addr_listunspent_requested != 0 ) { + printf("addr_listunspent_requested %u\n",coin->addr_listunspent_requested); LP_smartutxos_push(coin); - nonz++; - }*/ + coin->addr_listunspent_requested = 0; + } + if ( coin->inactive != 0 ) + continue; if ( coin->electrum != 0 ) continue; //if ( coin->obooktime == 0 ) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 247281d52..d5fef89a5 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -957,7 +957,7 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,char *gui,bits256 *avoids,int32_t numavoids) { - bits256 pubkey; char *obookstr,coinaddr[64],str[65]; cJSON *orderbook,*asks,*item; int32_t i,j,n,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; struct iguana_info *basecoin; uint64_t basesatoshis; struct LP_utxoinfo *bestutxo = 0; + bits256 pubkey; char *obookstr,coinaddr[64]; cJSON *orderbook,*asks,*item; int32_t i,j,n,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; struct iguana_info *basecoin; uint64_t basesatoshis; struct LP_utxoinfo *bestutxo = 0; *ordermatchpricep = 0.; *bestsatoshisp = *bestdestsatoshisp = 0; basecoin = LP_coinfind(base); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index d4a9c1912..5e6dc9105 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -440,7 +440,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr) int32_t LP_listunspent_issue(char *symbol,char *coinaddr) { - struct iguana_info *coin; int32_t n = 0; cJSON *retjson=0; char *retstr=0,destip[64]; uint16_t destport; + struct iguana_info *coin; int32_t n = 0; cJSON *retjson=0; char *retstr=0;// uint16_t destport; if ( symbol == 0 || symbol[0] == 0 ) return(0); if ( (coin= LP_coinfind(symbol)) != 0 ) From f24a6af2183d6ba1b0652527b4221638dd46f092 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 12:10:39 +0300 Subject: [PATCH 144/346] Add prefix field for secret addresses --- iguana/exchanges/LP_commands.c | 4 ++-- iguana/exchanges/LP_ordermatch.c | 40 +++++++++++++++++++++----------- iguana/exchanges/LP_utxos.c | 6 +++-- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 583b1096d..e3ab3c825 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -120,7 +120,7 @@ getprices(base, rel)\n\ sendmessage(base=coin, rel="", pubkey=zero, )\n\ getmessages(firsti=0, num=100)\n\ clearmessages(firsti=0, num=100)\n\ -secretaddresses(passphrase, num=10, pubtype=60, taddr=0)\n\ +secretaddresses(prefix='secretaddress', passphrase, num=10, pubtype=60, taddr=0)\n\ electrum(coin, ipaddr, port)\n\ snapshot(coin, height)\n\ snapshot_balance(coin, height, addresses[])\n\ @@ -186,7 +186,7 @@ dividends(coin, height, )\n\ uint8_t taddr,pubtype; pubtype = (jobj(argjson,"pubtype") == 0) ? 60 : juint(argjson,"pubtype"); taddr = (jobj(argjson,"taddr") == 0) ? 0 : juint(argjson,"taddr"); - return(LP_secretaddresses(ctx,jstr(argjson,"passphrase"),juint(argjson,"num"),taddr,pubtype)); + return(LP_secretaddresses(ctx,jstr(argjson,"prefix"),jstr(argjson,"passphrase"),juint(argjson,"num"),taddr,pubtype)); } if ( base != 0 && rel != 0 ) { diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index d5fef89a5..b3c2844bf 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -955,9 +955,26 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q return(jprint(bestitem,0)); } +int32_t LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t max,double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct iguana_info *basecoin,char *coinaddr,uint64_t asatoshis,double price,uint64_t txfee,uint64_t desttxfee,bits256 pubkey,char *gui) +{ + uint64_t basesatoshis; struct LP_utxoinfo *bestutxo; + basesatoshis = LP_basesatoshis(dstr(asatoshis),price,txfee,desttxfee); + if ( basesatoshis != 0 && (bestutxo= LP_address_utxopair(0,utxos,max,basecoin,coinaddr,txfee,dstr(basesatoshis)*price,price,desttxfee)) != 0 ) + { + bestutxo->pubkey = pubkey; + safecopy(bestutxo->gui,gui,sizeof(bestutxo->gui)); + *bestsatoshisp = basesatoshis; + *ordermatchpricep = price; + *bestdestsatoshisp = asatoshis; + return(0); + } + return(-1); +} + struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,char *gui,bits256 *avoids,int32_t numavoids) { - bits256 pubkey; char *obookstr,coinaddr[64]; cJSON *orderbook,*asks,*item; int32_t i,j,n,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; struct iguana_info *basecoin; uint64_t basesatoshis; struct LP_utxoinfo *bestutxo = 0; + bits256 pubkey; char *obookstr,coinaddr[64]; cJSON *orderbook,*asks,*item; int32_t maxiters,i,j,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; uint64_t asatoshis; struct iguana_info *basecoin; struct LP_utxoinfo *bestutxo = 0; + maxiters = 10; *ordermatchpricep = 0.; *bestsatoshisp = *bestdestsatoshisp = 0; basecoin = LP_coinfind(base); @@ -991,22 +1008,19 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i { bitcoin_address(coinaddr,basecoin->taddr,basecoin->pubtype,pubp->rmd160,sizeof(pubp->rmd160)); LP_listunspent_query(base,coinaddr); - n = LP_listunspent_both(base,coinaddr); - //printf("unspent.(%s) n.%d\n",coinaddr,n); - //if ( n > 1 ) + LP_listunspent_both(base,coinaddr); + asatoshis = autxo->S.satoshis; + for (j=0; jS.satoshis),price,txfee,desttxfee); - if ( basesatoshis != 0 && (bestutxo= LP_address_utxopair(0,utxos,max,basecoin,coinaddr,txfee,dstr(basesatoshis)*price,price,desttxfee)) != 0 ) + if ( LP_ordermatch_iter(utxos,max,ordermatchpricep,bestsatoshisp,bestdestsatoshisp,basecoin,coinaddr,asatoshis,price,txfee,desttxfee,pubp->pubkey,gui) == 0 ) { - bestutxo->pubkey = pubp->pubkey; - safecopy(bestutxo->gui,gui,sizeof(bestutxo->gui)); - *bestsatoshisp = basesatoshis; - *ordermatchpricep = price; - *bestdestsatoshisp = autxo->S.satoshis; - printf("ordermatch %.8f %.8f %.8f txfees (%.8f %.8f)\n",price,dstr(*bestsatoshisp),dstr(*bestdestsatoshisp),dstr(txfee),dstr(desttxfee)); + printf("j.%d/%d ordermatch %.8f best satoshis %.8f destsatoshis %.8f txfees (%.8f %.8f)\n",j,maxiters,price,dstr(*bestsatoshisp),dstr(*bestdestsatoshisp),dstr(txfee),dstr(desttxfee)); break; } - } //else printf("no unspents %s %s %s\n",base,coinaddr,bits256_str(str,pubkey)); + asatoshis = (asatoshis / 64) * 63; + } + if ( j < maxiters ) + break; } else printf("self trading or blacklisted peer\n"); } else diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 499d2af9d..499f6bff1 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -654,10 +654,12 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri return(flag); } -char *LP_secretaddresses(void *ctx,char *passphrase,int32_t n,uint8_t taddr,uint8_t pubtype) +char *LP_secretaddresses(void *ctx,char *prefix,char *passphrase,int32_t n,uint8_t taddr,uint8_t pubtype) { int32_t i; uint8_t tmptype,pubkey33[33],rmd160[20]; char output[777*45],str[65],str2[65],buf[8192],wifstr[128],coinaddr[64]; bits256 checkprivkey,privkey,pubkey; cJSON *retjson; retjson = cJSON_CreateObject(); + if ( prefix == 0 || prefix[0] == 0 ) + prefix = "secretaddress"; if ( passphrase == 0 || passphrase[0] == 0 ) passphrase = "password"; if ( n <= 0 ) @@ -670,7 +672,7 @@ char *LP_secretaddresses(void *ctx,char *passphrase,int32_t n,uint8_t taddr,uint sprintf(output,"\"addresses\":["); for (i=0; i Date: Sat, 14 Oct 2017 12:19:20 +0300 Subject: [PATCH 145/346] Test --- iguana/exchanges/LP_remember.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index c50a47853..671a3d15b 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1075,25 +1075,28 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("depositspent.(%s) alice.%d bob.%d %s %.8f\n",bits256_str(str,rswap.depositspent),rswap.sentflags[BASILISK_ALICECLAIM],rswap.sentflags[BASILISK_BOBREFUND],rswap.bobcoin,dstr(rswap.values[BASILISK_BOBDEPOSIT])); } LP_totals_update(rswap.iambob,rswap.alicecoin,rswap.bobcoin,KMDtotals,BTCtotals,rswap.sentflags,rswap.values); + int32_t numspent = 0; if ( bits256_nonz(rswap.paymentspent) == 0 ) { if ( bits256_nonz(rswap.txids[BASILISK_ALICESPEND]) != 0 ) rswap.paymentspent = rswap.txids[BASILISK_ALICESPEND]; else rswap.paymentspent = rswap.txids[BASILISK_BOBRECLAIM]; - } + } else numspent++; if ( bits256_nonz(rswap.depositspent) == 0 ) { if ( bits256_nonz(rswap.txids[BASILISK_BOBREFUND]) != 0 ) rswap.depositspent = rswap.txids[BASILISK_BOBREFUND]; else rswap.depositspent = rswap.txids[BASILISK_ALICECLAIM]; - } + } else numspent++; if ( bits256_nonz(rswap.Apaymentspent) == 0 ) { if ( bits256_nonz(rswap.txids[BASILISK_BOBSPEND]) != 0 ) rswap.Apaymentspent = rswap.txids[BASILISK_BOBSPEND]; else rswap.Apaymentspent = rswap.txids[BASILISK_ALICERECLAIM]; - } - rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); + } else numspent++; + if ( numspent == 3 ) + rswap.finishedflag = 1; + else rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); item = LP_swap_json(&rswap); if ( rswap.origfinishedflag == 0 && rswap.finishedflag != 0 ) { From c4f20d41eb997202c1a0334ddeaee40a08ed29f1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 12:20:53 +0300 Subject: [PATCH 146/346] Test --- iguana/exchanges/LP_commands.c | 6 +++--- iguana/exchanges/LP_ordermatch.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index e3ab3c825..bb2fb1c4c 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -363,7 +363,7 @@ dividends(coin, height, )\n\ coinaddr = jstr(argjson,"coinaddr"); if ( coin != 0 && coinaddr != 0 ) { - char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); + //char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1); } return(clonestr("{\"result\":\"success\"}")); @@ -418,7 +418,7 @@ dividends(coin, height, )\n\ retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) { - printf("GOT ADDR_UNSPENTS\n"); + //printf("GOT ADDR_UNSPENTS\n"); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { char *coinaddr; //cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; @@ -428,7 +428,7 @@ dividends(coin, height, )\n\ { if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { - printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); + //printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); ptr->addr_listunspent_requested = (uint32_t)time(NULL); } } diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index b3c2844bf..738a77066 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -252,7 +252,7 @@ void LP_listunspent_query(char *symbol,char *coinaddr) jaddstr(reqjson,"coin",symbol); jaddstr(reqjson,"address",coinaddr); msg = jprint(reqjson,1); - printf("BROADCAST.(%s)\n",msg); + //printf("BROADCAST.(%s)\n",msg); LP_broadcast_message(LP_mypubsock,"","",zero,msg); } From 76fa6b69ba83addd602775ebf2372bd7eb05d220 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:11:09 +0300 Subject: [PATCH 147/346] Test --- iguana/exchanges/LP_remember.c | 8 ++++---- iguana/exchanges/LP_transaction.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 671a3d15b..6979c9afe 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -346,7 +346,7 @@ int32_t basilisk_swap_isfinished(int32_t iambob,bits256 *txids,int32_t *sentflag n++; if ( n == 0 ) { - printf("if nothing sent, it is finished\n"); + //printf("if nothing sent, it is finished\n"); return(1); } if ( iambob != 0 ) @@ -851,13 +851,13 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } - printf("ALICE.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.Adestaddr,alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); - printf("BOB.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.destaddr,bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); if ( rswap.finishedflag == 0 && rswap.bobcoin[0] != 0 && rswap.alicecoin[0] != 0 ) { + //printf("ALICE.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.Adestaddr,alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); + //printf("BOB.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.destaddr,bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); if ( alice->inactive != 0 || bob->inactive != 0 ) { printf("Alice.%s inactive.%u or Bob.%s inactive.%u\n",rswap.alicecoin,alice->inactive,rswap.bobcoin,bob->inactive); @@ -1101,7 +1101,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( rswap.origfinishedflag == 0 && rswap.finishedflag != 0 ) { char fname[1024],*itemstr; FILE *fp; - //printf("SWAP %u-%u finished!\n",requestid,quoteid); + printf("SWAP %u-%u finished!\n",requestid,quoteid); sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,rswap.requestid,rswap.quoteid), OS_compatible_path(fname); if ( (fp= fopen(fname,"wb")) != 0 ) { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index a5d66d712..18537ce9b 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -935,13 +935,22 @@ bits256 _LP_swap_spendtxid(char *symbol,char *destaddr,char *coinaddr,bits256 ut bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t vout) { - bits256 spendtxid; int32_t spendvin; char coinaddr[64],str[65]; + bits256 spendtxid; int32_t spendvin; char coinaddr[64],str[65]; cJSON *retjson; struct iguana_info *coin; // listtransactions or listspents destaddr[0] = 0; coinaddr[0] = 0; memset(&spendtxid,0,sizeof(spendtxid)); if ( LP_spendsearch(&spendtxid,&spendvin,symbol,utxotxid,vout) > 0 ) printf("spend of %s/v%d detected\n",bits256_str(str,utxotxid),vout); + else if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) + { + if ( (retjson= LP_gettxout(symbol,coinaddr,utxotxid,vout)) != 0 ) + { + free_json(retjson); + decode_hex(spendtxid.bytes,32,"deadbeefdeadbeefdeadbeefdeadbeef"); + printf("couldnt find spend of %s/v%d, but no gettxout\n",bits256_str(str,utxotxid),vout); + } + } return(spendtxid); //char str[65]; printf("swap %s spendtxid.(%s)\n",symbol,bits256_str(str,utxotxid)); } From 6e552395a7fec598f6df874bcf25bd4ae8348816 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:13:24 +0300 Subject: [PATCH 148/346] Test --- iguana/exchanges/LP_transaction.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 18537ce9b..a8ddd2a0e 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -944,12 +944,11 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t v printf("spend of %s/v%d detected\n",bits256_str(str,utxotxid),vout); else if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) { - if ( (retjson= LP_gettxout(symbol,coinaddr,utxotxid,vout)) != 0 ) + if ( (retjson= LP_gettxout(symbol,coinaddr,utxotxid,vout)) == 0 ) { - free_json(retjson); decode_hex(spendtxid.bytes,32,"deadbeefdeadbeefdeadbeefdeadbeef"); printf("couldnt find spend of %s/v%d, but no gettxout\n",bits256_str(str,utxotxid),vout); - } + } else free_json(retjson); } return(spendtxid); //char str[65]; printf("swap %s spendtxid.(%s)\n",symbol,bits256_str(str,utxotxid)); From 31c75fa109c51251c80b5096817c7ca3ad2dfaed Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:14:49 +0300 Subject: [PATCH 149/346] Test --- iguana/exchanges/LP_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index a8ddd2a0e..869b17d59 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -946,7 +946,7 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t v { if ( (retjson= LP_gettxout(symbol,coinaddr,utxotxid,vout)) == 0 ) { - decode_hex(spendtxid.bytes,32,"deadbeefdeadbeefdeadbeefdeadbeef"); + decode_hex(spendtxid.bytes,32,"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); printf("couldnt find spend of %s/v%d, but no gettxout\n",bits256_str(str,utxotxid),vout); } else free_json(retjson); } From 285e46235f10e260e5642ae93a29f8e4624c4cca Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:22:40 +0300 Subject: [PATCH 150/346] Test --- iguana/exchanges/LP_remember.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 6979c9afe..4486bd685 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -661,7 +661,7 @@ int32_t LP_refht_update(char *symbol,bits256 txid) int32_t LP_swap_load(struct LP_swap_remember *rswap) { - int32_t i,needflag,addflag; long fsize; char fname[1024],str[65],*fstr,*symbol,*rstr; cJSON *txobj,*sentobj; bits256 txid,checktxid; uint64_t value; + int32_t i,needflag,addflag; long fsize; char fname[1024],str[65],*fstr,*symbol,*rstr; cJSON *txobj,*sentobj,*fileobj; bits256 txid,checktxid; uint64_t value; rswap->iambob = -1; for (i=0; isrc,rswap->bobcoin); if ( rswap->dest[0] == 0 ) strcpy(rswap->dest,rswap->alicecoin); + sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,rswap->requestid,rswap->quoteid), OS_compatible_path(fname); + if ( (fstr= OS_filestr(&fsize,fname)) != 0 ) + { + if ( (fileobj= cJSON_Parse(fstr)) != 0 ) + { + rswap->finishedflag = 1; + free_json(fileobj); + } + free(fstr); + } return(rswap->finishedflag); } From b4abc136ccbc2f32113d9fa523f4d8c683a16e91 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:25:42 +0300 Subject: [PATCH 151/346] Test --- iguana/exchanges/LP_remember.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 4486bd685..8fe16bacc 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -748,7 +748,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) } free_json(sentobj); } - if ( rswap->finishedflag == 0 ) + if ( 0 && rswap->finishedflag == 0 ) printf("%s %s %.8f\n",txnames[i],bits256_str(str,txid),dstr(value)); } } @@ -770,7 +770,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) { if ( (fileobj= cJSON_Parse(fstr)) != 0 ) { - rswap->finishedflag = 1; + rswap->origfinishedflag = rswap->finishedflag = 1; free_json(fileobj); } free(fstr); From cbf1699ee6c4a19bbe05002adb79c16da766d6ff Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:28:58 +0300 Subject: [PATCH 152/346] Test --- iguana/exchanges/LP_remember.c | 23 +++++++++++------------ iguana/exchanges/LP_socket.c | 2 +- iguana/exchanges/mm.c | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 8fe16bacc..fca22ef2a 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -663,6 +663,16 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) { int32_t i,needflag,addflag; long fsize; char fname[1024],str[65],*fstr,*symbol,*rstr; cJSON *txobj,*sentobj,*fileobj; bits256 txid,checktxid; uint64_t value; rswap->iambob = -1; + sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,rswap->requestid,rswap->quoteid), OS_compatible_path(fname); + if ( (fstr= OS_filestr(&fsize,fname)) != 0 ) + { + if ( (fileobj= cJSON_Parse(fstr)) != 0 ) + { + rswap->origfinishedflag = rswap->finishedflag = 1; + free_json(fileobj); + } + free(fstr); + } for (i=0; ifinishedflag == 0 ) - printf("%s %s %.8f\n",txnames[i],bits256_str(str,txid),dstr(value)); + printf("%s %s %.8f\n",txnames[i],bits256_str(str,txid),dstr(value)); } } } //else printf("no symbol\n"); @@ -765,16 +774,6 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap) strcpy(rswap->src,rswap->bobcoin); if ( rswap->dest[0] == 0 ) strcpy(rswap->dest,rswap->alicecoin); - sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,rswap->requestid,rswap->quoteid), OS_compatible_path(fname); - if ( (fstr= OS_filestr(&fsize,fname)) != 0 ) - { - if ( (fileobj= cJSON_Parse(fstr)) != 0 ) - { - rswap->origfinishedflag = rswap->finishedflag = 1; - free_json(fileobj); - } - free(fstr); - } return(rswap->finishedflag); } diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index a56737148..f4b7fe22c 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -909,7 +909,7 @@ cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port) } else { - printf("launched.(%s:%u)\n",ep->ipaddr,ep->port); + printf("launched electrum.(%s:%u)\n",ep->ipaddr,ep->port); jaddstr(retjson,"result","success"); ep->prev = coin->electrum; coin->electrum = ep; diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index 618b9d494..e262972b3 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -880,7 +880,7 @@ int main(int argc, const char * argv[]) { printf("error launching LP_main (%s)\n",jprint(retjson,0)); exit(-1); - } else printf("(%s) launched.(%s)\n",argv[1],passphrase); + } //else printf("(%s) launched.(%s)\n",argv[1],passphrase); incr = 100.; while ( (1) ) sleep(1); From d3f0616c3c0bd3218b21d31b9416cf6806a9bdbd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:34:37 +0300 Subject: [PATCH 153/346] Test --- iguana/exchanges/LP_rpc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 5e6dc9105..f6a66ead1 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -460,6 +460,8 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) retjson = LP_listunspent(symbol,coinaddr); //printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); } + else if ( IAMLP == 0 ) + LP_listunspent_query(coin->symbol,coin->smartaddr); /*else if ( (destport= LP_randpeer(destip)) > 0 ) { retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); From 41cce6e61eb276b4719c016ae716bbfa20955e14 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:39:35 +0300 Subject: [PATCH 154/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 4d294fc9c..655cdb012 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -354,7 +354,7 @@ void LP_smartutxos_push(struct iguana_info *coin) jaddnum(req,"vout",vout); jaddnum(req,"ht",height); jadd64bits(req,"value",value); - printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); + //printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); LP_broadcast_message(LP_mypubsock,"","",zero,jprint(req,1)); } } diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 738a77066..696452ebb 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -974,7 +974,7 @@ int32_t LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t max,double *or struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,char *gui,bits256 *avoids,int32_t numavoids) { bits256 pubkey; char *obookstr,coinaddr[64]; cJSON *orderbook,*asks,*item; int32_t maxiters,i,j,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; uint64_t asatoshis; struct iguana_info *basecoin; struct LP_utxoinfo *bestutxo = 0; - maxiters = 10; + maxiters = 100; *ordermatchpricep = 0.; *bestsatoshisp = *bestdestsatoshisp = 0; basecoin = LP_coinfind(base); From 6497b4e2a916e445b0c5e3f9ea2081ad413d2d40 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:43:13 +0300 Subject: [PATCH 155/346] Test --- iguana/exchanges/LP_ordermatch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 696452ebb..cd28e6ac9 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -955,7 +955,7 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q return(jprint(bestitem,0)); } -int32_t LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t max,double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct iguana_info *basecoin,char *coinaddr,uint64_t asatoshis,double price,uint64_t txfee,uint64_t desttxfee,bits256 pubkey,char *gui) +struct LP_utxoinfo *LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t max,double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct iguana_info *basecoin,char *coinaddr,uint64_t asatoshis,double price,uint64_t txfee,uint64_t desttxfee,bits256 pubkey,char *gui) { uint64_t basesatoshis; struct LP_utxoinfo *bestutxo; basesatoshis = LP_basesatoshis(dstr(asatoshis),price,txfee,desttxfee); @@ -966,9 +966,9 @@ int32_t LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t max,double *or *bestsatoshisp = basesatoshis; *ordermatchpricep = price; *bestdestsatoshisp = asatoshis; - return(0); + return(bestutxo); } - return(-1); + return(0); } struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,char *gui,bits256 *avoids,int32_t numavoids) @@ -1012,7 +1012,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i asatoshis = autxo->S.satoshis; for (j=0; jpubkey,gui) == 0 ) + if ( (bestutxo= LP_ordermatch_iter(utxos,max,ordermatchpricep,bestsatoshisp,bestdestsatoshisp,basecoin,coinaddr,asatoshis,price,txfee,desttxfee,pubp->pubkey,gui)) != 0 ) { printf("j.%d/%d ordermatch %.8f best satoshis %.8f destsatoshis %.8f txfees (%.8f %.8f)\n",j,maxiters,price,dstr(*bestsatoshisp),dstr(*bestdestsatoshisp),dstr(txfee),dstr(desttxfee)); break; From 8272f7ecd83aa8dcfde3f1377d89f31000cb60fb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:46:36 +0300 Subject: [PATCH 156/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index cd28e6ac9..f9bb6b3e9 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -252,7 +252,7 @@ void LP_listunspent_query(char *symbol,char *coinaddr) jaddstr(reqjson,"coin",symbol); jaddstr(reqjson,"address",coinaddr); msg = jprint(reqjson,1); - //printf("BROADCAST.(%s)\n",msg); + printf("BROADCAST.(%s)\n",msg); LP_broadcast_message(LP_mypubsock,"","",zero,msg); } From 625ebe1383414a8341dae057ef35fda7377873cf Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:49:22 +0300 Subject: [PATCH 157/346] Test --- iguana/exchanges/LP_rpc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index f6a66ead1..fcca1d487 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -440,7 +440,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr) int32_t LP_listunspent_issue(char *symbol,char *coinaddr) { - struct iguana_info *coin; int32_t n = 0; cJSON *retjson=0; char *retstr=0;// uint16_t destport; + struct iguana_info *coin; int32_t n = 0; cJSON *retjson=0; char *retstr=0,destip[64]; uint16_t destport; if ( symbol == 0 || symbol[0] == 0 ) return(0); if ( (coin= LP_coinfind(symbol)) != 0 ) @@ -461,13 +461,15 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) //printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); } else if ( IAMLP == 0 ) - LP_listunspent_query(coin->symbol,coin->smartaddr); - /*else if ( (destport= LP_randpeer(destip)) > 0 ) { - retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); - printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); - retjson = cJSON_Parse(retstr); - } else printf("LP_listunspent_issue couldnt get a random peer?\n");*/ + LP_listunspent_query(coin->symbol,coin->smartaddr); + if ( (destport= LP_randpeer(destip)) > 0 ) + { + retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); + printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); + retjson = cJSON_Parse(retstr); + } else printf("LP_listunspent_issue couldnt get a random peer?\n"); + } if ( retjson != 0 ) { n = cJSON_GetArraySize(retjson); From c92909932dac9c19ed2fe642a72a39e3822d7592 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:54:04 +0300 Subject: [PATCH 158/346] Test --- iguana/exchanges/LP_prices.c | 4 ++-- iguana/exchanges/LP_rpc.c | 8 ++++---- iguana/exchanges/LP_socket.c | 12 ++++++------ iguana/exchanges/LP_utxo.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 9bf11f909..3eba63939 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -771,7 +771,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) for (i=n=0; inumutxos == 0 )//|| relcoin->electrum == 0 ) + if ( n < 10 && bids[i]->numutxos == 0 )//|| relcoin->electrum == 0 ) { LP_address(relcoin,bids[i]->coinaddr); if ( relcoin->electrum == 0 ) @@ -790,7 +790,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) for (i=n=0; inumutxos == 0 )//|| basecoin->electrum == 0 ) + if ( n < 10 && asks[i]->numutxos == 0 )//|| basecoin->electrum == 0 ) { LP_address(basecoin,asks[i]->coinaddr); if ( basecoin->electrum == 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index fcca1d487..c79e0fde8 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -326,7 +326,7 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) return(0); return(LP_gettxout_json(txid,vout,up->U.height,coinaddr,up->U.value)); } - if ( (array= electrum_address_listunspent(coin->symbol,0,&array,coinaddr)) != 0 ) + if ( (array= electrum_address_listunspent(coin->symbol,0,&array,coinaddr,1)) != 0 ) { //printf("array.(%s)\n",jprint(array,0)); if ( array != 0 && (n= cJSON_GetArraySize(array)) > 0 ) @@ -435,7 +435,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr) sprintf(buf,"[0, 99999999, [\"%s\"]]",coinaddr); return(bitcoin_json(coin,"listunspent",buf)); } else return(LP_address_utxos(coin,coinaddr,0)); - } else return(electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr)); + } else return(electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr,1)); } int32_t LP_listunspent_issue(char *symbol,char *coinaddr) @@ -447,7 +447,7 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) { if ( coin->electrum != 0 ) { - if ( (retjson= electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr)) != 0 ) + if ( (retjson= electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr,1)) != 0 ) { n = cJSON_GetArraySize(retjson); //printf("LP_listunspent_issue.%s %s.%d %s\n",symbol,coinaddr,n,jprint(retjson,0)); @@ -473,7 +473,7 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) if ( retjson != 0 ) { n = cJSON_GetArraySize(retjson); - if ( electrum_process_array(coin,0,coinaddr,retjson) != 0 ) + if ( electrum_process_array(coin,0,coinaddr,retjson,1) != 0 ) { //LP_postutxos(symbol,coinaddr); // might be good to not saturate } diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index f4b7fe22c..1c49e20ac 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -295,7 +295,7 @@ struct electrum_info *electrum_server(char *symbol,struct electrum_info *ep) return(ep); } -int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep,char *coinaddr,cJSON *array) +int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep,char *coinaddr,cJSON *array,int32_t electrumflag) { int32_t i,v,n,ht,flag = 0; char str[65]; uint64_t value; bits256 txid; cJSON *item,*retjson,*txobj; struct LP_transaction *tx; if ( array != 0 && coin != 0 && (n= cJSON_GetArraySize(array)) > 0 ) @@ -304,7 +304,7 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep for (i=0; ielectrum == 0 ) + if ( electrumflag == 0 ) { txid = jbits256(item,"txid"); v = jint(item,"vout"); @@ -493,11 +493,11 @@ cJSON *electrum_address_getmempool(char *symbol,struct electrum_info *ep,cJSON * cJSON *retjson; struct iguana_info *coin = LP_coinfind(symbol); retjson = electrum_strarg(symbol,ep,retjsonp,"blockchain.address.get_mempool",addr,ELECTRUM_TIMEOUT); //printf("MEMPOOL.(%s)\n",jprint(retjson,0)); - electrum_process_array(coin,ep,addr,retjson); + electrum_process_array(coin,ep,addr,retjson,1); return(retjson); } -cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr) +cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr,int32_t electrumflag) { cJSON *retjson=0; struct iguana_info *coin = LP_coinfind(symbol); //printf("electrum.%s/%s listunspent last.(%s lag %d)\n",ep->symbol,coin->symbol,coin->lastunspent,(int32_t)(time(NULL) - coin->unspenttime)); @@ -506,7 +506,7 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON if ( (retjson= electrum_strarg(symbol,ep,retjsonp,"blockchain.address.listunspent",addr,ELECTRUM_TIMEOUT)) != 0 ) { //printf("LISTUNSPENT.(%s)\n",jprint(retjson,0)); - if ( electrum_process_array(coin,ep,addr,retjson) != 0 ) + if ( electrum_process_array(coin,ep,addr,retjson,electrumflag) != 0 ) LP_postutxos(coin->symbol,addr); safecopy(coin->lastunspent,addr,sizeof(coin->lastunspent)); coin->unspenttime = (uint32_t)time(NULL); @@ -654,7 +654,7 @@ void electrum_test() printf("electrum_address_getmempool %s\n",jprint(retjson,1)); if ( (retjson= electrum_address_getbalance(symbol,ep,0,addr)) != 0 ) printf("electrum_address_getbalance %s\n",jprint(retjson,1)); - if ( (retjson= electrum_address_listunspent(symbol,ep,0,addr)) != 0 ) + if ( (retjson= electrum_address_listunspent(symbol,ep,0,addr,1)) != 0 ) printf("electrum_address_listunspent %s\n",jprint(retjson,1)); if ( (retjson= electrum_addpeer(symbol,ep,0,"electrum.be:50001")) != 0 ) printf("electrum_addpeer %s\n",jprint(retjson,1)); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index eedac4669..17e260145 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -489,7 +489,7 @@ char *LP_postedutxos(cJSON *argjson) if ( (array= jarray(&n,argjson,"utxos")) != 0 ) LP_unspents_array(coin,coinaddr,array); } - else if ( (array= electrum_address_listunspent(symbol,coin->electrum,&array,coinaddr)) != 0 ) + else if ( (array= electrum_address_listunspent(symbol,coin->electrum,&array,coinaddr,1)) != 0 ) free_json(array); } return(clonestr("{\"result\":\"success\"}")); From ee721e5a1b031bd56fdf6c465aa9c842038c31f2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 13:59:14 +0300 Subject: [PATCH 159/346] Test --- iguana/exchanges/LP_ordermatch.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index f9bb6b3e9..e6e89bc05 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -461,13 +461,13 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u if ( (backupep= ep->prev) == 0 ) backupep = ep; } - printf("LP_nearest_utxovalue %s utxos[%d] target %.8f\n",coin->symbol,n,dstr(targetval)); + //printf("LP_nearest_utxovalue %s utxos[%d] target %.8f\n",coin->symbol,n,dstr(targetval)); for (i=0; iU.value - targetval); - printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); + //printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); if ( up->spendheight <= 0 ) { if ( coin->electrum != 0 ) @@ -483,20 +483,20 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u } if ( dist >= 0 && dist < mindist ) { - printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); + //printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); mini = i; mindist = dist; } } } } - printf("return mini.%d\n",mini); + //printf("return mini.%d\n",mini); return(mini); } uint64_t LP_basesatoshis(double relvolume,double price,uint64_t txfee,uint64_t desttxfee) { - printf("basesatoshis %.8f (rel %.8f / price %.8f)\n",dstr(SATOSHIDEN * ((relvolume) / price) + 2*txfee),relvolume,price); + //printf("basesatoshis %.8f (rel %.8f / price %.8f)\n",dstr(SATOSHIDEN * ((relvolume) / price) + 2*txfee),relvolume,price); if ( relvolume > dstr(desttxfee) && price > SMALLVAL ) return(SATOSHIDEN * (relvolume / price) + 2*txfee); else return(0); @@ -510,7 +510,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** if ( (m= LP_address_utxo_ptrs(iambob,utxos,max,ap)) > 1 ) { targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee); - if ( 1 ) + if ( 0 ) { int32_t i; for (i=0; i targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); + //printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) @@ -537,7 +537,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** return(utxo); } } - } else printf("cant find targetval2 %.8f\n",dstr(targetval2)); + } //else printf("cant find targetval2 %.8f\n",dstr(targetval2)); } else printf("failed ratio test %.8f\n",(double)up->U.value/targetval); } else if ( targetval != 0 && mini >= 0 ) printf("targetval %.8f mini.%d\n",dstr(targetval),mini); @@ -863,7 +863,8 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, memset(&zero,0,sizeof(zero)); msg2 = clonestr(msg); LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,zero,msg); - //LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg2); + sleep(1); + LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg2); //LP_butxo_swapfields_set(butxo); printf("return after RESERVED\n"); return(2); @@ -984,7 +985,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i return(0); utxos = calloc(max,sizeof(*utxos)); LP_txfees(&txfee,&desttxfee,base,autxo->coin); - printf("LP_buyutxo maxprice %.8f relvol %.8f %s/%s %.8f %.8f\n",maxprice,dstr(autxo->S.satoshis),base,autxo->coin,dstr(txfee),dstr(desttxfee)); + //printf("LP_buyutxo maxprice %.8f relvol %.8f %s/%s %.8f %.8f\n",maxprice,dstr(autxo->S.satoshis),base,autxo->coin,dstr(txfee),dstr(desttxfee)); if ( (obookstr= LP_orderbook(base,autxo->coin,duration)) != 0 ) { if ( (orderbook= cJSON_Parse(obookstr)) != 0 ) @@ -996,7 +997,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i item = jitem(asks,i); price = jdouble(item,"price"); pubkey = jbits256(item,"pubkey"); - printf("[%d/%d] %s pubcmp %d price %.8f vs maxprice %.8f\n",i,numasks,jprint(item,0),bits256_cmp(pubkey,G.LP_mypub25519),price,maxprice); + //printf("[%d/%d] %s pubcmp %d price %.8f vs maxprice %.8f\n",i,numasks,jprint(item,0),bits256_cmp(pubkey,G.LP_mypub25519),price,maxprice); if ( LP_pricevalid(price) > 0 && price <= maxprice ) { for (j=0; j Date: Sat, 14 Oct 2017 14:07:37 +0300 Subject: [PATCH 160/346] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 10 +++++----- iguana/exchanges/LP_prices.c | 6 +++--- iguana/exchanges/LP_rpc.c | 15 +++++++++------ iguana/exchanges/LP_scan.c | 2 +- iguana/exchanges/LP_utxo.c | 2 +- iguana/exchanges/LP_utxos.c | 6 +++--- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index bb2fb1c4c..8acc60b7c 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -379,7 +379,7 @@ dividends(coin, height, )\n\ { if ( coinaddr[0] != 0 ) { - LP_listunspent_issue(coin,coinaddr); + LP_listunspent_issue(coin,coinaddr,1); if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index c3ee027af..cda18e7f7 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -316,7 +316,7 @@ void LP_smartutxos_push(struct iguana_info *coin); cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret); cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout); void LP_postutxos(char *symbol,char *coinaddr); -int32_t LP_listunspent_both(char *symbol,char *coinaddr); +int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag); uint16_t LP_randpeer(char *destip); cJSON *bitcoin_data2json(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,bits256 *txidp,struct iguana_msgtx *msgtx,uint8_t *extraspace,int32_t extralen,uint8_t *serialized,int32_t len,cJSON *vins,int32_t suppress_pubkeys); //int32_t LP_butxo_findeither(bits256 txid,int32_t vout); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 655cdb012..e5686e5a3 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -375,7 +375,7 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer) if ( coin->smartaddr[0] == 0 ) continue; total = 0; - if ( (j= LP_listunspent_both(coin->symbol,coin->smartaddr)) == 0 ) + if ( (j= LP_listunspent_both(coin->symbol,coin->smartaddr,0)) == 0 ) continue; if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) { diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index e6e89bc05..d12d66312 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -252,7 +252,7 @@ void LP_listunspent_query(char *symbol,char *coinaddr) jaddstr(reqjson,"coin",symbol); jaddstr(reqjson,"address",coinaddr); msg = jprint(reqjson,1); - printf("BROADCAST.(%s)\n",msg); + //printf("BROADCAST.(%s)\n",msg); LP_broadcast_message(LP_mypubsock,"","",zero,msg); } @@ -733,7 +733,7 @@ char *LP_connectedalice(cJSON *argjson) // alice } } -int32_t LP_listunspent_both(char *symbol,char *coinaddr) +int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag) { int32_t i,v,height,n=0; uint64_t value; bits256 txid; char buf[512]; cJSON *array,*item; struct iguana_info *coin = LP_coinfind(symbol); if ( coin != 0 )//&& (IAMLP != 0 || coin->inactive == 0) ) @@ -743,7 +743,7 @@ int32_t LP_listunspent_both(char *symbol,char *coinaddr) //printf("issue path electrum.%p\n",coin->electrum); //if ( coin->electrum != 0 && (array= electrum_address_gethistory(symbol,coin->electrum,&array,coinaddr)) != 0 ) // free_json(array); - n = LP_listunspent_issue(symbol,coinaddr); + n = LP_listunspent_issue(symbol,coinaddr,fullflag); } else { @@ -799,7 +799,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, if ( LP_allocated(butxo->payment.txid,butxo->payment.vout) != 0 || LP_allocated(butxo->deposit.txid,butxo->deposit.vout) != 0 || (qprice= LP_quote_validate(autxo,butxo,&Q,1)) <= SMALLVAL ) { printf("butxo.%p replace path %p %s, %p %s, %.8f\n",butxo,LP_allocated(butxo->payment.txid,butxo->payment.vout),bits256_str(str,butxo->payment.txid),LP_allocated(butxo->deposit.txid,butxo->deposit.vout),bits256_str(str2,butxo->deposit.txid),LP_quote_validate(autxo,butxo,&Q,1)); - LP_listunspent_both(Q.srccoin,Q.coinaddr); + LP_listunspent_both(Q.srccoin,Q.coinaddr,0); if ( (butxo= LP_address_utxopair(1,utxos,max,LP_coinfind(Q.srccoin),Q.coinaddr,Q.txfee,dstr(Q.destsatoshis),price,Q.desttxfee)) != 0 ) { Q.txid = butxo->payment.txid; @@ -1009,7 +1009,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i { bitcoin_address(coinaddr,basecoin->taddr,basecoin->pubtype,pubp->rmd160,sizeof(pubp->rmd160)); LP_listunspent_query(base,coinaddr); - LP_listunspent_both(base,coinaddr); + LP_listunspent_both(base,coinaddr,1); asatoshis = autxo->S.satoshis; for (j=0; jsymbol,coinaddr); + LP_listunspent_both(coin->symbol,coinaddr,0); if ( (array= LP_address_utxos(coin,coinaddr,1)) != 0 ) { total = 0; @@ -775,7 +775,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) { LP_address(relcoin,bids[i]->coinaddr); if ( relcoin->electrum == 0 ) - LP_listunspent_issue(rel,bids[i]->coinaddr); + LP_listunspent_issue(rel,bids[i]->coinaddr,0); LP_listunspent_query(rel,bids[i]->coinaddr); n++; } @@ -794,7 +794,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) { LP_address(basecoin,asks[i]->coinaddr); if ( basecoin->electrum == 0 ) - LP_listunspent_issue(base,asks[i]->coinaddr); + LP_listunspent_issue(base,asks[i]->coinaddr,0); LP_listunspent_query(base,asks[i]->coinaddr); n++; } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index c79e0fde8..1ebceefeb 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -438,7 +438,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr) } else return(electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr,1)); } -int32_t LP_listunspent_issue(char *symbol,char *coinaddr) +int32_t LP_listunspent_issue(char *symbol,char *coinaddr,int32_t fullflag) { struct iguana_info *coin; int32_t n = 0; cJSON *retjson=0; char *retstr=0,destip[64]; uint16_t destport; if ( symbol == 0 || symbol[0] == 0 ) @@ -463,12 +463,15 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr) else if ( IAMLP == 0 ) { LP_listunspent_query(coin->symbol,coin->smartaddr); - if ( (destport= LP_randpeer(destip)) > 0 ) + if ( fullflag != 0 ) { - retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); - printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); - retjson = cJSON_Parse(retstr); - } else printf("LP_listunspent_issue couldnt get a random peer?\n"); + if ( (destport= LP_randpeer(destip)) > 0 ) + { + retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); + printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); + retjson = cJSON_Parse(retstr); + } else printf("LP_listunspent_issue couldnt get a random peer?\n"); + } } if ( retjson != 0 ) { diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index 23e76098e..eb721e2ee 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -481,7 +481,7 @@ int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int } free(array); } - LP_listunspent_issue(coin->symbol,coinaddr); + LP_listunspent_issue(coin->symbol,coinaddr,1); struct LP_address_utxo *up; if ( (up= LP_address_utxofind(coin,coinaddr,txid,vout)) != 0 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 17e260145..d15ae08b1 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -722,7 +722,7 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int } else { - LP_listunspent_issue(symbol,coinaddr); + LP_listunspent_issue(symbol,coinaddr,1); if ( (ht= LP_txheight(coin,txid)) > 0 && ht <= coin->height ) numconfirms = (LP_getheight(coin) - ht + 1); else if ( mempool != 0 ) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 499f6bff1..376158308 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -452,7 +452,7 @@ cJSON *LP_inventory(char *symbol) if ( (coin= LP_coinfind(symbol)) != 0 ) { coin->unspenttime = (uint32_t)time(NULL) - 777; - LP_listunspent_both(symbol,coin->smartaddr); + LP_listunspent_both(symbol,coin->smartaddr,0); } HASH_ITER(hh,G.LP_utxoinfos[iambob],utxo,tmp) { @@ -519,7 +519,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri } //printf("privkey init.(%s) %s\n",coin->symbol,coin->smartaddr); if ( coin->inactive == 0 ) - LP_listunspent_issue(coin->symbol,coin->smartaddr); + LP_listunspent_issue(coin->symbol,coin->smartaddr,0); if ( coin->inactive == 0 && (array= LP_listunspent(coin->symbol,coin->smartaddr)) != 0 ) { txfee = LP_txfeecalc(coin,0); @@ -746,7 +746,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan } if ( coin->electrum == 0 && coin->userpass[0] != 0 ) { - LP_listunspent_issue(coin->symbol,coin->smartaddr); + LP_listunspent_issue(coin->symbol,coin->smartaddr,0); if ( (retjson= LP_importprivkey(coin->symbol,tmpstr,coin->smartaddr,-1)) != 0 ) { if ( jobj(retjson,"error") != 0 ) From fc7a9e3e4d8d66d17ed642b8734b0311b62b75e1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 14:24:48 +0300 Subject: [PATCH 161/346] Test --- iguana/exchanges/LP_nativeDEX.c | 19 +++++++++++++++---- iguana/exchanges/LP_ordermatch.c | 17 +++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index e5686e5a3..ef38ff29f 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -21,7 +21,6 @@ // // SPV at tx level and limit SPV proofing -// coins file // stats, fix pricearray // sign packets // dPoW security @@ -33,9 +32,10 @@ #include #include "LP_include.h" -portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex; +portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex; int32_t LP_canbind; -char *Broadcaststr; +char *Broadcaststr,*Reserved_msgs[1000]; +int32_t num_Reserved_msgs; struct LP_peerinfo *LP_peerinfos,*LP_mypeer; struct LP_forwardinfo *LP_forwardinfos; struct iguana_info *LP_coins; @@ -689,7 +689,7 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybusport,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson) { - char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); + char *myipaddr=0; bits256 zero; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); LP_showwif = juint(argjson,"wif"); if ( passphrase == 0 || passphrase[0] == 0 ) { @@ -747,6 +747,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu portable_mutex_init(&LP_messagemutex); portable_mutex_init(&LP_portfoliomutex); portable_mutex_init(&LP_butxomutex); + portable_mutex_init(&LP_reservedmutex); #ifndef _WIN32 if ( system("curl -s4 checkip.amazonaws.com > DB/myipaddr") == 0 ) { @@ -853,6 +854,16 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu } if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 ) nonz++; + memset(zero.bytes,0,sizeof(zero)); + portable_mutex_lock(&LP_reservedmutex); + while ( num_Reserved_msgs > 0 ) + { + num_Reserved_msgs--; + printf("BROADCASTING RESERVED.(%s)\n",Reserved_msgs[num_Reserved_msgs]); + LP_broadcast_message(pubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); + Reserved_msgs[num_Reserved_msgs] = 0; + } + portable_mutex_unlock(&LP_reservedmutex); if ( nonz == 0 ) usleep(10000); else if ( IAMLP != 0 ) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index d12d66312..ab79fdb7a 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -474,12 +474,11 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u { if (up->SPV == 0 ) up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); if ( up->SPV < 0 ) { printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); continue; - } + } else printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); } if ( dist >= 0 && dist < mindist ) { @@ -859,14 +858,12 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, butxo->T.lasttime = (uint32_t)time(NULL); printf("set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",butxo->T.swappending,qprice,price,msg); { - bits256 zero; char *msg2; - memset(&zero,0,sizeof(zero)); - msg2 = clonestr(msg); - LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,zero,msg); - sleep(1); - LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg2); - //LP_butxo_swapfields_set(butxo); - printf("return after RESERVED\n"); + portable_mutex_lock(&LP_reservedmutex); + if ( num_Reserved_msgs < sizeof(Reserved_msgs)/sizeof(*Reserved_msgs) ) + Reserved_msgs[num_Reserved_msgs++] = msg; + else LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg); + portable_mutex_unlock(&LP_reservedmutex); + printf("return after queued RESERVED\n"); return(2); } } else printf("warning swappending.%u swap.%p\n",butxo->T.swappending,butxo->S.swap); From 22bf05fd51d7a12a3339bcb89bb612a30739ca22 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 14:26:04 +0300 Subject: [PATCH 162/346] Test --- crypto777/bitcoind_RPC.c | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 0ef7dfab0..559ea4d02 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -55,6 +55,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * long i,j,len; char *retstr = 0; cJSON *json,*result,*error; + usleep(1000); //printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 ) { From 6024c12d6328c2c75b3ee924c7e0d5c7626ff844 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 14:34:20 +0300 Subject: [PATCH 163/346] Test --- iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_nativeDEX.c | 31 +++++++++++++++++++------------ iguana/exchanges/LP_network.c | 3 ++- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index cda18e7f7..8dadf593a 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -295,6 +295,7 @@ int32_t LP_pullsock_check(void *ctx,char **retstrp,char *myipaddr,int32_t pubsoc uint16_t LP_psock_get(char *connectaddr,char *publicaddr,int32_t ispaired); //void LP_utxo_clientpublish(struct LP_utxoinfo *utxo); int32_t LP_coinbus(uint16_t coin_busport); +int32_t LP_reserved_msgs(); struct iguana_info *LP_coinfind(char *symbol); int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32); char *LP_pricepings(void *ctx,char *myipaddr,int32_t pubsock,char *base,char *rel,double price); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index ef38ff29f..cb75ec172 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -551,7 +551,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int memset(&zero,0,sizeof(zero)); if ( coin->addr_listunspent_requested != 0 ) { - printf("addr_listunspent_requested %u\n",coin->addr_listunspent_requested); + //printf("addr_listunspent_requested %u\n",coin->addr_listunspent_requested); LP_smartutxos_push(coin); coin->addr_listunspent_requested = 0; } @@ -687,9 +687,26 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint } } +int32_t LP_reserved_msgs() +{ + bits256 zero; int32_t n = 0; + memset(zero.bytes,0,sizeof(zero)); + portable_mutex_lock(&LP_reservedmutex); + while ( num_Reserved_msgs > 0 ) + { + num_Reserved_msgs--; + printf("BROADCASTING RESERVED.(%s)\n",Reserved_msgs[num_Reserved_msgs]); + LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); + Reserved_msgs[num_Reserved_msgs] = 0; + n++; + } + portable_mutex_unlock(&LP_reservedmutex); + return(n); +} + void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybusport,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson) { - char *myipaddr=0; bits256 zero; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); + char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); LP_showwif = juint(argjson,"wif"); if ( passphrase == 0 || passphrase[0] == 0 ) { @@ -854,16 +871,6 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu } if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 ) nonz++; - memset(zero.bytes,0,sizeof(zero)); - portable_mutex_lock(&LP_reservedmutex); - while ( num_Reserved_msgs > 0 ) - { - num_Reserved_msgs--; - printf("BROADCASTING RESERVED.(%s)\n",Reserved_msgs[num_Reserved_msgs]); - LP_broadcast_message(pubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); - Reserved_msgs[num_Reserved_msgs] = 0; - } - portable_mutex_unlock(&LP_reservedmutex); if ( nonz == 0 ) usleep(10000); else if ( IAMLP != 0 ) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 582c1f37a..961f36ef3 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -144,6 +144,7 @@ void queue_loop(void *ignore) struct LP_queue *ptr,*tmp; int32_t sentbytes,nonz,flag,duplicate,n=0; while ( 1 ) { + LP_reserved_msgs(); nonz = 0; //printf("LP_Q.%p next.%p prev.%p\n",LP_Q,LP_Q!=0?LP_Q->next:0,LP_Q!=0?LP_Q->prev:0); n = 0; @@ -199,7 +200,7 @@ void queue_loop(void *ignore) //if ( n != 0 ) // printf("LP_Q.[%d]\n",n); if ( nonz == 0 ) - usleep(50000); + usleep(5000); } } From c25a6936236181a5fe0827a6e24812027b749a6b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:01:44 +0300 Subject: [PATCH 164/346] Test --- iguana/exchanges/LP_commands.c | 4 +-- iguana/exchanges/LP_include.h | 3 +- iguana/exchanges/LP_nativeDEX.c | 24 ++++++++++++++-- iguana/exchanges/LP_ordermatch.c | 47 ++++++++++++++------------------ iguana/exchanges/LP_peers.c | 5 ++-- iguana/exchanges/LP_utxo.c | 5 ++-- 6 files changed, 48 insertions(+), 40 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 8acc60b7c..a61fe617c 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -521,11 +521,9 @@ dividends(coin, height, )\n\ } else { - char *msg; memset(zero.bytes,0,sizeof(zero)); - msg = jprint(reqjson,0); //printf("broadcast.(%s)\n",msg); - LP_broadcast_message(LP_mypubsock,base!=0?base:jstr(argjson,"coin"),rel,zero,msg); + LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); } retstr = clonestr("{\"result\":\"success\"}"); } else retstr = clonestr("{\"error\":\"couldnt dereference sendmessage\"}"); diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 8dadf593a..34f16721a 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -43,7 +43,7 @@ #define LP_PEERGOOD_ERRORDECAY 0.9 #define LP_SWAPSTEP_TIMEOUT 30 -#define LP_AUTOTRADE_TIMEOUT 60 +#define LP_AUTOTRADE_TIMEOUT 10 #define LP_MIN_TXFEE 10000 #define LP_MINVOL 20 #define LP_MINCLIENTVOL 50 @@ -296,6 +296,7 @@ uint16_t LP_psock_get(char *connectaddr,char *publicaddr,int32_t ispaired); //void LP_utxo_clientpublish(struct LP_utxoinfo *utxo); int32_t LP_coinbus(uint16_t coin_busport); int32_t LP_reserved_msgs(); +int32_t LP_reserved_msg(char *base,char *rel,bits256 pubkey,char *msg); struct iguana_info *LP_coinfind(char *symbol); int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32); char *LP_pricepings(void *ctx,char *myipaddr,int32_t pubsock,char *base,char *rel,double price); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index cb75ec172..be9c2519f 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -20,7 +20,7 @@ // marketmaker // -// SPV at tx level and limit SPV proofing +// -SPV at tx level and limit SPV proofing // stats, fix pricearray // sign packets // dPoW security @@ -35,7 +35,7 @@ portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex; int32_t LP_canbind; char *Broadcaststr,*Reserved_msgs[1000]; -int32_t num_Reserved_msgs; +int32_t num_Reserved_msgs,max_Reserved_msgs; struct LP_peerinfo *LP_peerinfos,*LP_mypeer; struct LP_forwardinfo *LP_forwardinfos; struct iguana_info *LP_coins; @@ -355,7 +355,7 @@ void LP_smartutxos_push(struct iguana_info *coin) jaddnum(req,"ht",height); jadd64bits(req,"value",value); //printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); - LP_broadcast_message(LP_mypubsock,"","",zero,jprint(req,1)); + LP_reserved_msg("","",zero,jprint(req,1)); } } } @@ -704,6 +704,24 @@ int32_t LP_reserved_msgs() return(n); } +int32_t LP_reserved_msg(char *base,char *rel,bits256 pubkey,char *msg) +{ + int32_t n = 0; + portable_mutex_lock(&LP_reservedmutex); + if ( num_Reserved_msgs < sizeof(Reserved_msgs)/sizeof(*Reserved_msgs) ) + { + Reserved_msgs[num_Reserved_msgs++] = msg; + n = num_Reserved_msgs; + } else LP_broadcast_message(LP_mypubsock,base,rel,pubkey,msg); + portable_mutex_unlock(&LP_reservedmutex); + if ( num_Reserved_msgs > max_Reserved_msgs ) + { + max_Reserved_msgs = num_Reserved_msgs; + printf("New max_Reserved_msgs.%d\n",max_Reserved_msgs); + } + return(n); +} + void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybusport,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson) { char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index ab79fdb7a..9779c1c55 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -219,41 +219,37 @@ char *LP_quotereceived(cJSON *argjson) char *LP_pricepings(void *ctx,char *myipaddr,int32_t pubsock,char *base,char *rel,double price) { - bits256 zero; char *msg; cJSON *reqjson = cJSON_CreateObject(); + bits256 zero; cJSON *reqjson = cJSON_CreateObject(); memset(zero.bytes,0,sizeof(zero)); jaddbits256(reqjson,"pubkey",G.LP_mypub25519); jaddstr(reqjson,"base",base); jaddstr(reqjson,"rel",rel); jaddnum(reqjson,"price",price); jaddstr(reqjson,"method","postprice"); - msg = jprint(reqjson,1); - LP_broadcast_message(pubsock,base,rel,zero,msg); + LP_reserved_msg(base,rel,zero,jprint(reqjson,1)); return(clonestr("{\"result\":\"success\"}")); } void LP_notify_pubkeys(void *ctx,int32_t pubsock) { - bits256 zero; char *msg,secpstr[67]; cJSON *reqjson = cJSON_CreateObject(); + bits256 zero; char secpstr[67]; cJSON *reqjson = cJSON_CreateObject(); memset(zero.bytes,0,sizeof(zero)); jaddstr(reqjson,"method","notify"); jaddstr(reqjson,"rmd160",G.LP_myrmd160str); jaddbits256(reqjson,"pub",G.LP_mypub25519); init_hexbytes_noT(secpstr,G.LP_pubsecp,33); jaddstr(reqjson,"pubsecp",secpstr); - msg = jprint(reqjson,1); - LP_broadcast_message(pubsock,"","",zero,msg); + LP_reserved_msg("","",zero,jprint(reqjson,1)); } void LP_listunspent_query(char *symbol,char *coinaddr) { - bits256 zero; char *msg; cJSON *reqjson = cJSON_CreateObject(); + bits256 zero; cJSON *reqjson = cJSON_CreateObject(); memset(zero.bytes,0,sizeof(zero)); jaddstr(reqjson,"method","addr_unspents"); jaddstr(reqjson,"coin",symbol); jaddstr(reqjson,"address",coinaddr); - msg = jprint(reqjson,1); - //printf("BROADCAST.(%s)\n",msg); - LP_broadcast_message(LP_mypubsock,"","",zero,msg); + LP_reserved_msg("","",zero,jprint(reqjson,1)); } char *LP_postedprice(cJSON *argjson) @@ -401,11 +397,16 @@ double LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct L msg = jprint(reqjson,1); printf("QUERY.(%s)\n",msg); memset(&zero,0,sizeof(zero)); - if ( 1 && strcmp(method,"request") == 0 ) + portable_mutex_lock(&LP_reservedmutex); + if ( num_Reserved_msgs < sizeof(Reserved_msgs)/sizeof(*Reserved_msgs) ) + Reserved_msgs[num_Reserved_msgs++] = msg; + else { - sleep(3); - LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,zero,msg); - } else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); + if ( 1 && strcmp(method,"request") == 0 ) + LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,zero,msg); + else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); + } + portable_mutex_unlock(&LP_reservedmutex); for (i=0; i<20; i++) { if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL ) @@ -581,7 +582,7 @@ void LP_abutxo_set(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,struct LP int32_t LP_connectstartbob(void *ctx,int32_t pubsock,struct LP_utxoinfo *utxo,cJSON *argjson,char *base,char *rel,double price,struct LP_quoteinfo *qp) { - char pairstr[512],*msg; cJSON *retjson; bits256 privkey; int32_t pair=-1,retval = -1,DEXselector = 0; struct basilisk_swap *swap; struct iguana_info *coin; + char pairstr[512]; cJSON *retjson; bits256 privkey; int32_t pair=-1,retval = -1,DEXselector = 0; struct basilisk_swap *swap; struct iguana_info *coin; printf("LP_connectstartbob.(%s) with.(%s) %s\n",LP_myipaddr,jprint(argjson,0),LP_myipaddr); qp->quotetime = (uint32_t)time(NULL); if ( (coin= LP_coinfind(utxo->coin)) == 0 ) @@ -609,8 +610,7 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,struct LP_utxoinfo *utxo,cJ jaddnum(retjson,"requestid",qp->R.requestid); jaddnum(retjson,"quoteid",qp->R.quoteid); char str[65]; printf("BOB pubsock.%d binds to %d (%s)\n",pubsock,pair,bits256_str(str,utxo->S.otherpubkey)); - msg = jprint(retjson,1); - LP_broadcast_message(pubsock,base,rel,utxo->S.otherpubkey,msg); + LP_reserved_msg(base,rel,utxo->S.otherpubkey,jprint(retjson,1)); retval = 0; } else printf("error launching swaploop\n"); } else printf("couldnt bind to any port %s\n",pairstr); @@ -856,16 +856,9 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, jaddstr(retjson,"method","reserved"); msg = jprint(retjson,1); butxo->T.lasttime = (uint32_t)time(NULL); - printf("set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",butxo->T.swappending,qprice,price,msg); - { - portable_mutex_lock(&LP_reservedmutex); - if ( num_Reserved_msgs < sizeof(Reserved_msgs)/sizeof(*Reserved_msgs) ) - Reserved_msgs[num_Reserved_msgs++] = msg; - else LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg); - portable_mutex_unlock(&LP_reservedmutex); - printf("return after queued RESERVED\n"); - return(2); - } + printf("return after queued RESERVED: set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",butxo->T.swappending,qprice,price,msg); + LP_reserved_msg(Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg); + return(2); } else printf("warning swappending.%u swap.%p\n",butxo->T.swappending,butxo->S.swap); } else if ( strcmp(method,"connect") == 0 ) // bob diff --git a/iguana/exchanges/LP_peers.c b/iguana/exchanges/LP_peers.c index 5c7efb7e7..a7ffdf846 100644 --- a/iguana/exchanges/LP_peers.c +++ b/iguana/exchanges/LP_peers.c @@ -128,11 +128,10 @@ struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char portable_mutex_unlock(&LP_peermutex); if ( IAMLP != 0 && mypubsock >= 0 ) { - struct iguana_info *coin,*ctmp; bits256 zero; char *msg,busaddr[64]; - msg = jprint(LP_peerjson(peer),1); + struct iguana_info *coin,*ctmp; bits256 zero; char busaddr[64]; memset(zero.bytes,0,sizeof(zero)); //LP_send(mypubsock,msg,(int32_t)strlen(msg)+1,1); - LP_broadcast_message(mypubsock,"","",zero,msg); + LP_reserved_msg("","",zero,jprint(LP_peerjson(peer),1)); if ( 0 ) { HASH_ITER(hh,LP_coins,coin,ctmp) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index d15ae08b1..214bef80b 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -417,7 +417,7 @@ cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electr void LP_postutxos(char *symbol,char *coinaddr) { - bits256 zero; char *msg; struct iguana_info *coin; cJSON *array,*reqjson = cJSON_CreateObject(); + bits256 zero; struct iguana_info *coin; cJSON *array,*reqjson = cJSON_CreateObject(); if ( (coin= LP_coinfind(symbol)) != 0 && (array= LP_address_utxos(coin,coinaddr,1)) != 0 ) { //printf("LP_postutxos pubsock.%d %s %s\n",pubsock,symbol,coin->smartaddr); @@ -430,9 +430,8 @@ void LP_postutxos(char *symbol,char *coinaddr) jaddstr(reqjson,"coin",symbol); jaddstr(reqjson,"coinaddr",coinaddr); jadd(reqjson,"utxos",array); - msg = jprint(reqjson,1); //printf("post (%s) -> %d\n",msg,LP_mypubsock); - LP_broadcast_message(LP_mypubsock,symbol,symbol,zero,msg); + LP_reserved_msg(symbol,symbol,zero,jprint(reqjson,1)); } } } From 2b085290d1b0ae03c0640a1a87b11ce35569f008 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:05:30 +0300 Subject: [PATCH 165/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index be9c2519f..92a8de55d 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -695,7 +695,7 @@ int32_t LP_reserved_msgs() while ( num_Reserved_msgs > 0 ) { num_Reserved_msgs--; - printf("BROADCASTING RESERVED.(%s)\n",Reserved_msgs[num_Reserved_msgs]); + //printf("BROADCASTING RESERVED.(%s)\n",Reserved_msgs[num_Reserved_msgs]); LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); Reserved_msgs[num_Reserved_msgs] = 0; n++; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 9779c1c55..825f45e31 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -596,9 +596,7 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,struct LP_utxoinfo *utxo,cJ if ( (pair= LP_nanobind(ctx,pairstr)) >= 0 ) { LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-2*qp->txfee,rel,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); - printf("call swapinit\n"); swap = LP_swapinit(1,0,privkey,&qp->R,qp); - printf("swapinit.%p\n",swap); swap->N.pair = pair; utxo->S.swap = swap; swap->utxo = utxo; From e78962ae7c14f6a55b27a3dcbfd4b1905e94bedb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:15:09 +0300 Subject: [PATCH 166/346] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_ordermatch.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index a61fe617c..3c7b70358 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -406,7 +406,7 @@ dividends(coin, height, )\n\ retstr = clonestr("{\"result\":\"coin is disabled\"}"); else if ( strcmp(method,"reserved") == 0 ) { - //printf("RESERVED.(%s)\n",jprint(argjson,0)); + printf("received RESERVED.(%s)\n",jprint(argjson,0)); retstr = LP_quotereceived(argjson); } else if ( strcmp(method,"connected") == 0 ) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 92a8de55d..3594d76e5 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -282,6 +282,7 @@ void command_rpcloop(void *myipaddr) origipaddr = "127.0.0.1"; while ( 1 ) { + fprintf(stderr,"."); nonz = 0; HASH_ITER(hh,LP_peerinfos,peer,tmp) { diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 825f45e31..4d8fb64ee 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -402,9 +402,9 @@ double LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct L Reserved_msgs[num_Reserved_msgs++] = msg; else { - if ( 1 && strcmp(method,"request") == 0 ) + //if ( 1 && strcmp(method,"request") == 0 ) LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,zero,msg); - else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); + //else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); } portable_mutex_unlock(&LP_reservedmutex); for (i=0; i<20; i++) @@ -772,7 +772,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, char *method,*msg; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"request") == 0 ||strcmp(method,"connect") == 0) ) { - printf("LP_tradecommand: check received %s\n",method); + printf("LP_tradecommand: check received method %s\n",method); retval = 1; if ( LP_quoteparse(&Q,argjson) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0 ) { From 2458905607b2963a21934a3cd2c945cef11ed5c8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:22:55 +0300 Subject: [PATCH 167/346] Test --- iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_nativeDEX.c | 65 ++++++++++++++++++-------------- iguana/exchanges/LP_ordermatch.c | 3 ++ 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 34f16721a..8f1698718 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -295,6 +295,7 @@ int32_t LP_pullsock_check(void *ctx,char **retstrp,char *myipaddr,int32_t pubsoc uint16_t LP_psock_get(char *connectaddr,char *publicaddr,int32_t ispaired); //void LP_utxo_clientpublish(struct LP_utxoinfo *utxo); int32_t LP_coinbus(uint16_t coin_busport); +int32_t LP_nanomsg_recvs(void *ctx); int32_t LP_reserved_msgs(); int32_t LP_reserved_msg(char *base,char *rel,bits256 pubkey,char *msg); struct iguana_info *LP_coinfind(char *symbol); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 3594d76e5..652aab67e 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -32,7 +32,7 @@ #include #include "LP_include.h" -portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex; +portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex; int32_t LP_canbind; char *Broadcaststr,*Reserved_msgs[1000]; int32_t num_Reserved_msgs,max_Reserved_msgs; @@ -274,40 +274,48 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int return(nonz); } -void command_rpcloop(void *myipaddr) +int32_t LP_nanomsg_recvs(void *ctx) { - int32_t nonz = 0; char *origipaddr; struct LP_peerinfo *peer,*tmp; void *ctx; - ctx = bitcoin_ctx(); - if ( (origipaddr= myipaddr) == 0 ) + int32_t nonz = 0; char *origipaddr; struct LP_peerinfo *peer,*tmp; + if ( (origipaddr= LP_myipaddr) == 0 ) origipaddr = "127.0.0.1"; - while ( 1 ) + fprintf(stderr,"."); + portable_mutex_lock(&LP_nanorecvsmutex); + HASH_ITER(hh,LP_peerinfos,peer,tmp) { - fprintf(stderr,"."); - nonz = 0; - HASH_ITER(hh,LP_peerinfos,peer,tmp) + if ( peer->errors >= LP_MAXPEER_ERRORS ) { - if ( peer->errors >= LP_MAXPEER_ERRORS ) + if ( (rand() % 10000) == 0 ) + peer->errors--; + else { - if ( (rand() % 10000) == 0 ) - peer->errors--; - else - { - //printf("skip %s\n",peer->ipaddr); - continue; - } + //printf("skip %s\n",peer->ipaddr); + continue; } - //printf("check %s pubsock.%d\n",peer->ipaddr,peer->subsock); - nonz += LP_sock_check("PULL",ctx,origipaddr,LP_mypubsock,peer->subsock,peer->ipaddr); } - /*HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht - { - if ( coin->inactive != 0 ) - continue; - if ( coin->bussock >= 0 ) - nonz += LP_sock_check(coin->symbol,ctx,origipaddr,-1,coin->bussock,LP_profitratio - 1.); - }*/ - if ( LP_mypullsock >= 0 ) - nonz += LP_sock_check("SUB",ctx,origipaddr,-1,LP_mypullsock,"127.0.0.1"); + //printf("check %s pubsock.%d\n",peer->ipaddr,peer->subsock); + nonz += LP_sock_check("PULL",ctx,origipaddr,LP_mypubsock,peer->subsock,peer->ipaddr); + } + /*HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht + { + if ( coin->inactive != 0 ) + continue; + if ( coin->bussock >= 0 ) + nonz += LP_sock_check(coin->symbol,ctx,origipaddr,-1,coin->bussock,LP_profitratio - 1.); + }*/ + if ( LP_mypullsock >= 0 ) + nonz += LP_sock_check("SUB",ctx,origipaddr,-1,LP_mypullsock,"127.0.0.1"); + portable_mutex_unlock(&LP_nanorecvsmutex); + return(nonz); +} + +void command_rpcloop(void *myipaddr) +{ + int32_t nonz = 0; void *ctx; + ctx = bitcoin_ctx(); + while ( 1 ) + { + nonz = LP_nanomsg_recvs(ctx); //if ( LP_mybussock >= 0 ) // nonz += LP_sock_check("BUS",ctx,origipaddr,-1,LP_mybussock); if ( nonz == 0 ) @@ -784,6 +792,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu portable_mutex_init(&LP_portfoliomutex); portable_mutex_init(&LP_butxomutex); portable_mutex_init(&LP_reservedmutex); + portable_mutex_init(&LP_nanorecvsmutex); #ifndef _WIN32 if ( system("curl -s4 checkip.amazonaws.com > DB/myipaddr") == 0 ) { diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 4d8fb64ee..adb37bddf 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -417,6 +417,9 @@ double LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct L break; } } + while ( 1 ) + if ( LP_nanomsg_recvs(ctx) <= 0 ) + break; sleep(1); } return(price); From d616e9d50ac04e1c609585f2170b811d67a29c9d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:25:41 +0300 Subject: [PATCH 168/346] Test --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 652aab67e..9556a9eb9 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -280,7 +280,7 @@ int32_t LP_nanomsg_recvs(void *ctx) if ( (origipaddr= LP_myipaddr) == 0 ) origipaddr = "127.0.0.1"; fprintf(stderr,"."); - portable_mutex_lock(&LP_nanorecvsmutex); + //portable_mutex_lock(&LP_nanorecvsmutex); HASH_ITER(hh,LP_peerinfos,peer,tmp) { if ( peer->errors >= LP_MAXPEER_ERRORS ) @@ -305,7 +305,7 @@ int32_t LP_nanomsg_recvs(void *ctx) }*/ if ( LP_mypullsock >= 0 ) nonz += LP_sock_check("SUB",ctx,origipaddr,-1,LP_mypullsock,"127.0.0.1"); - portable_mutex_unlock(&LP_nanorecvsmutex); + //portable_mutex_unlock(&LP_nanorecvsmutex); return(nonz); } From fc3162c5aeecdc553b3404b8af1671d948cefb17 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:39:52 +0300 Subject: [PATCH 169/346] Test --- iguana/exchanges/LP_commands.c | 10 ------ iguana/exchanges/LP_nativeDEX.c | 4 +-- iguana/exchanges/LP_ordermatch.c | 55 +++++++++++++++++++------------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 3c7b70358..bd7f000c9 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -404,16 +404,6 @@ dividends(coin, height, )\n\ return(clonestr("{\"result\":\"at least one of coins disabled\"}")); else if ( IAMLP == 0 && LP_isdisabled(jstr(argjson,"coin"),0) != 0 ) retstr = clonestr("{\"result\":\"coin is disabled\"}"); - else if ( strcmp(method,"reserved") == 0 ) - { - printf("received RESERVED.(%s)\n",jprint(argjson,0)); - retstr = LP_quotereceived(argjson); - } - else if ( strcmp(method,"connected") == 0 ) - { - //printf("CONNECTED.(%s)\n",jprint(argjson,0)); - retstr = LP_connectedalice(argjson); - } else if ( strcmp(method,"checktxid") == 0 ) retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 9556a9eb9..c34b6c997 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -257,14 +257,14 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int { if ( jobj(argjson,"method") != 0 && strcmp("connect",jstr(argjson,"method")) == 0 ) printf("self.(%s)\n",str); - portable_mutex_lock(&LP_commandmutex); if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 ) { + portable_mutex_lock(&LP_commandmutex); if ( (retstr= stats_JSON(ctx,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 ) free(retstr); + portable_mutex_unlock(&LP_commandmutex); } free_json(argjson); - portable_mutex_unlock(&LP_commandmutex); } free(str); } diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index adb37bddf..1c462ce17 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -376,9 +376,9 @@ int32_t LP_arrayfind(cJSON *array,bits256 txid,int32_t vout) return(-1); } -double LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_quoteinfo *qp) +void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_quoteinfo *qp) { - cJSON *reqjson; bits256 zero; char *msg; int32_t i,flag = 0; double price = 0.; struct LP_utxoinfo *utxo; + cJSON *reqjson; bits256 zero; char *msg; int32_t flag = 0; struct LP_utxoinfo *utxo; if ( strcmp(method,"request") == 0 ) { if ( (utxo= LP_utxofind(0,qp->desttxid,qp->destvout)) != 0 && LP_ismine(utxo) > 0 && LP_isavailable(utxo) > 0 ) @@ -386,7 +386,7 @@ double LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct L else { printf("couldnt find my txid to make request\n"); - return(0.); + return; } } reqjson = LP_quotejson(qp); @@ -407,22 +407,6 @@ double LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct L //else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); } portable_mutex_unlock(&LP_reservedmutex); - for (i=0; i<20; i++) - { - if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL ) - { - if ( flag == 0 || bits256_nonz(qp->desthash) != 0 ) - { - printf("break out of loop.%d price %.8f %s/%s\n",i,price,qp->srccoin,qp->destcoin); - break; - } - } - while ( 1 ) - if ( LP_nanomsg_recvs(ctx) <= 0 ) - break; - sleep(1); - } - return(price); } int32_t LP_nanobind(void *ctx,char *pairstr) @@ -772,11 +756,25 @@ int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag) int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen) { - char *method,*msg; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); + char *method,*msg,*retstr; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"request") == 0 ||strcmp(method,"connect") == 0) ) { printf("LP_tradecommand: check received method %s\n",method); retval = 1; + if ( strcmp(method,"reserved") == 0 ) + { + printf("alice received RESERVED.(%s)\n",jprint(argjson,0)); + if ( (retstr= LP_quotereceived(argjson)) != 0 ) + free(retstr); + return(1); + } + else if ( strcmp(method,"connected") == 0 ) + { + printf("alice received CONNECTED.(%s)\n",jprint(argjson,0)); + if ( (retstr= LP_connectedalice(argjson)) != 0 ) + free(retstr); + return(1); + } if ( LP_quoteparse(&Q,argjson) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0 ) { if ( (coin= LP_coinfind(Q.srccoin)) == 0 || (price= LP_myprice(&bid,&ask,Q.srccoin,Q.destcoin)) <= SMALLVAL || ask <= SMALLVAL ) @@ -898,15 +896,26 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q char str[65],str2[65]; printf("dest.(%s)/v%d fee.(%s)/v%d\n",bits256_str(str,qp->desttxid),qp->destvout,bits256_str(str2,qp->feetxid),qp->feevout); return(clonestr("{\"error\":\"cant find alice utxopair\"}")); } - price = LP_query(ctx,myipaddr,mypubsock,"request",qp); + expiration = (uint32_t)time(NULL) + timeout; + price = 0.; + LP_query(ctx,myipaddr,mypubsock,"request",qp); + while ( time(NULL) < expiration ) + { + if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL ) + { + printf("break out of price %.8f %s/%s\n",price,qp->srccoin,qp->destcoin); + break; + } + sleep(1); + } bestitem = LP_quotejson(qp); if ( LP_pricevalid(price) > 0 ) { if ( price <= maxprice ) { - price = LP_query(ctx,myipaddr,mypubsock,"connect",qp); + LP_query(ctx,myipaddr,mypubsock,"connect",qp); + //price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout); LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-2*qp->txfee,qp->destcoin,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); - expiration = (uint32_t)time(NULL) + timeout; while ( time(NULL) < expiration ) { if ( aliceutxo->S.swap != 0 ) From f6c0ad1e19a5e7e734eb7812892e9f3faa6130f7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:42:46 +0300 Subject: [PATCH 170/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 1c462ce17..acddaf616 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -757,7 +757,7 @@ int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag) int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen) { char *method,*msg,*retstr; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); - if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"request") == 0 ||strcmp(method,"connect") == 0) ) + if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"reserved") == 0 ||strcmp(method,"connected") == 0 || strcmp(method,"request") == 0 || strcmp(method,"connect") == 0) ) { printf("LP_tradecommand: check received method %s\n",method); retval = 1; From 0b3a51b0a37447e2579ac9c99453d7010061255f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 15:46:13 +0300 Subject: [PATCH 171/346] Test --- iguana/exchanges/LP_nativeDEX.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index c34b6c997..24ac8410b 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -276,10 +276,14 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int int32_t LP_nanomsg_recvs(void *ctx) { - int32_t nonz = 0; char *origipaddr; struct LP_peerinfo *peer,*tmp; + static double lastmilli; + int32_t nonz = 0; char *origipaddr; struct LP_peerinfo *peer,*tmp; double milli; if ( (origipaddr= LP_myipaddr) == 0 ) origipaddr = "127.0.0.1"; - fprintf(stderr,"."); + milli = OS_milliseconds(); + if ( milli > lastmilli+100 ) + fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f\n",milli-lastmilli); + lastmilli = milli; //portable_mutex_lock(&LP_nanorecvsmutex); HASH_ITER(hh,LP_peerinfos,peer,tmp) { From cbb95b4aaa756331140ff8ed5f35acc8405c4c0e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 16:15:36 +0300 Subject: [PATCH 172/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 151 +++++++++++++---------------- iguana/exchanges/LP_statemachine.c | 58 +++++++++++ 3 files changed, 124 insertions(+), 87 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 24ac8410b..8792b7abb 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -282,7 +282,7 @@ int32_t LP_nanomsg_recvs(void *ctx) origipaddr = "127.0.0.1"; milli = OS_milliseconds(); if ( milli > lastmilli+100 ) - fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f\n",milli-lastmilli); + fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds\n",milli-lastmilli); lastmilli = milli; //portable_mutex_lock(&LP_nanorecvsmutex); HASH_ITER(hh,LP_peerinfos,peer,tmp) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index acddaf616..5987e084d 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -754,28 +754,85 @@ int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag) return(n); } +char *LP_bestfit(char *rel,double relvolume) +{ + struct LP_utxoinfo *autxo; + if ( relvolume <= 0. || LP_priceinfofind(rel) == 0 ) + return(clonestr("{\"error\":\"invalid parameter\"}")); + if ( (autxo= LP_utxo_bestfit(rel,SATOSHIDEN * relvolume)) == 0 ) + return(clonestr("{\"error\":\"cant find utxo that is big enough\"}")); + return(jprint(LP_utxojson(autxo),1)); +} + +struct LP_quoteinfo LP_Alicequery; +double LP_Alicemaxprice; +char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp,double maxprice,int32_t timeout,int32_t duration) +{ + struct LP_utxoinfo *aliceutxo; double price; //cJSON *bestitem=0; int32_t DEXselector=0; uint32_t expiration; double price; struct LP_pubkeyinfo *pubp; struct basilisk_swap *swap; + if ( (aliceutxo= LP_utxopairfind(0,qp->desttxid,qp->destvout,qp->feetxid,qp->feevout)) == 0 ) + { + char str[65],str2[65]; printf("dest.(%s)/v%d fee.(%s)/v%d\n",bits256_str(str,qp->desttxid),qp->destvout,bits256_str(str2,qp->feetxid),qp->feevout); + return(clonestr("{\"error\":\"cant find alice utxopair\"}")); + } + price = 0.; + LP_query(ctx,myipaddr,mypubsock,"request",qp); + LP_Alicequery = *qp, LP_Alicemaxprice = maxprice; + return(clonestr("{\"result\":\"success\"}")); +} + +int32_t LP_quotecmp(struct LP_quoteinfo *qp,struct LP_quoteinfo *qp2) +{ + if ( bits256_cmp(qp->srchash,qp2->srchash) == 0 && bits256_cmp(qp->desthash,qp2->desthash) == 0 && strcmp(qp->srccoin,qp2->srccoin) == 0 && strcmp(qp->destcoin,qp2->destcoin) == 0 && bits256_cmp(qp->desttxid,qp2->desttxid) == 0 && qp->destvout == qp2->destvout && bits256_cmp(qp->feetxid,qp2->feetxid) == 0 && qp->feevout == qp2->feevout && qp->destsatoshis == qp2->destsatoshis && qp->txfee >= qp2->txfee && qp->desttxfee == qp2->desttxfee ) + return(0); + else return(-1); +} + +void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp) +{ + double price,maxprice = LP_Alicemaxprice; + if ( LP_quotecmp(qp,&LP_Alicequery) == 0 ) + { + price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout); + if ( LP_pricevalid(price) > 0 && maxprice > SMALLVAL && price <= maxprice ) + { + memset(&LP_Alicequery,0,sizeof(LP_Alicequery)); + LP_Alicemaxprice = 0.; + LP_query(ctx,myipaddr,mypubsock,"connect",qp); + } + } +} + int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen) { - char *method,*msg,*retstr; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); + char *method,*msg,*retstr; int32_t DEXselector = 0; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"reserved") == 0 ||strcmp(method,"connected") == 0 || strcmp(method,"request") == 0 || strcmp(method,"connect") == 0) ) { + LP_quoteparse(&Q,argjson); + LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-2*Q.txfee,Q.destcoin,Q.destsatoshis-2*Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); printf("LP_tradecommand: check received method %s\n",method); retval = 1; if ( strcmp(method,"reserved") == 0 ) { - printf("alice received RESERVED.(%s)\n",jprint(argjson,0)); - if ( (retstr= LP_quotereceived(argjson)) != 0 ) - free(retstr); + if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 ) + { + printf("alice received RESERVED.(%s)\n",jprint(argjson,0)); + if ( (retstr= LP_quotereceived(argjson)) != 0 ) + free(retstr); + LP_reserved(ctx,myipaddr,pubsock,&Q); + } return(1); } else if ( strcmp(method,"connected") == 0 ) { - printf("alice received CONNECTED.(%s)\n",jprint(argjson,0)); - if ( (retstr= LP_connectedalice(argjson)) != 0 ) - free(retstr); + if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 ) + { + printf("alice received CONNECTED.(%s)\n",jprint(argjson,0)); + if ( (retstr= LP_connectedalice(argjson)) != 0 ) + free(retstr); + } return(1); } - if ( LP_quoteparse(&Q,argjson) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0 ) + if ( bits256_cmp(G.LP_mypub25519,Q.srchash) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0 ) { if ( (coin= LP_coinfind(Q.srccoin)) == 0 || (price= LP_myprice(&bid,&ask,Q.srccoin,Q.destcoin)) <= SMALLVAL || ask <= SMALLVAL ) { @@ -878,84 +935,6 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, return(retval); } -char *LP_bestfit(char *rel,double relvolume) -{ - struct LP_utxoinfo *autxo; - if ( relvolume <= 0. || LP_priceinfofind(rel) == 0 ) - return(clonestr("{\"error\":\"invalid parameter\"}")); - if ( (autxo= LP_utxo_bestfit(rel,SATOSHIDEN * relvolume)) == 0 ) - return(clonestr("{\"error\":\"cant find utxo that is big enough\"}")); - return(jprint(LP_utxojson(autxo),1)); -} - -char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp,double maxprice,int32_t timeout,int32_t duration) -{ - struct LP_utxoinfo *aliceutxo; cJSON *bestitem=0; int32_t DEXselector=0; uint32_t expiration; double price; struct LP_pubkeyinfo *pubp; struct basilisk_swap *swap; - if ( (aliceutxo= LP_utxopairfind(0,qp->desttxid,qp->destvout,qp->feetxid,qp->feevout)) == 0 ) - { - char str[65],str2[65]; printf("dest.(%s)/v%d fee.(%s)/v%d\n",bits256_str(str,qp->desttxid),qp->destvout,bits256_str(str2,qp->feetxid),qp->feevout); - return(clonestr("{\"error\":\"cant find alice utxopair\"}")); - } - expiration = (uint32_t)time(NULL) + timeout; - price = 0.; - LP_query(ctx,myipaddr,mypubsock,"request",qp); - while ( time(NULL) < expiration ) - { - if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL ) - { - printf("break out of price %.8f %s/%s\n",price,qp->srccoin,qp->destcoin); - break; - } - sleep(1); - } - bestitem = LP_quotejson(qp); - if ( LP_pricevalid(price) > 0 ) - { - if ( price <= maxprice ) - { - LP_query(ctx,myipaddr,mypubsock,"connect",qp); - //price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout); - LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-2*qp->txfee,qp->destcoin,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); - while ( time(NULL) < expiration ) - { - if ( aliceutxo->S.swap != 0 ) - break; - sleep(3); - } - jaddnum(bestitem,"quotedprice",price); - jaddnum(bestitem,"maxprice",maxprice); - if ( (swap= aliceutxo->S.swap) == 0 ) - { - if ( (pubp= LP_pubkeyadd(qp->srchash)) != 0 ) - pubp->numerrors++; - jaddstr(bestitem,"status","couldnt establish connection"); - } - else - { - jaddstr(bestitem,"status","connected"); - jaddnum(bestitem,"requestid",swap->I.req.requestid); - jaddnum(bestitem,"quoteid",swap->I.req.quoteid); - printf("Alice r.%u qp->%u\n",swap->I.req.requestid,swap->I.req.quoteid); - } - } - else - { - jaddnum(bestitem,"quotedprice",price); - jaddnum(bestitem,"maxprice",maxprice); - jaddstr(bestitem,"status","too expensive"); - } - } - else - { - printf("invalid price %.8f\n",price); - jaddnum(bestitem,"maxprice",maxprice); - jaddstr(bestitem,"status","no response to request"); - } - if ( aliceutxo->S.swap == 0 ) - LP_availableset(aliceutxo); - return(jprint(bestitem,0)); -} - struct LP_utxoinfo *LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t max,double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct iguana_info *basecoin,char *coinaddr,uint64_t asatoshis,double price,uint64_t txfee,uint64_t desttxfee,bits256 pubkey,char *gui) { uint64_t basesatoshis; struct LP_utxoinfo *bestutxo; diff --git a/iguana/exchanges/LP_statemachine.c b/iguana/exchanges/LP_statemachine.c index b32dbc83a..7eafd0392 100644 --- a/iguana/exchanges/LP_statemachine.c +++ b/iguana/exchanges/LP_statemachine.c @@ -1871,6 +1871,64 @@ int32_t LP_peer_utxosquery(struct LP_peerinfo *mypeer,uint16_t myport,int32_t pu } //else printf("LP_peer_utxosquery skip.(%s) %u\n",peer->ipaddr,peer->lastutxos); return(n); } +bestitem = LP_quotejson(qp); +if ( LP_pricevalid(price) > 0 ) +{ + if ( price <= maxprice ) + { + LP_query(ctx,myipaddr,mypubsock,"connect",qp); + //price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout); + LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-2*qp->txfee,qp->destcoin,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + while ( time(NULL) < expiration ) + { + if ( aliceutxo->S.swap != 0 ) + break; + sleep(3); + } + jaddnum(bestitem,"quotedprice",price); + jaddnum(bestitem,"maxprice",maxprice); + if ( (swap= aliceutxo->S.swap) == 0 ) + { + if ( (pubp= LP_pubkeyadd(qp->srchash)) != 0 ) + pubp->numerrors++; + jaddstr(bestitem,"status","couldnt establish connection"); + } + else + { + jaddstr(bestitem,"status","connected"); + jaddnum(bestitem,"requestid",swap->I.req.requestid); + jaddnum(bestitem,"quoteid",swap->I.req.quoteid); + printf("Alice r.%u qp->%u\n",swap->I.req.requestid,swap->I.req.quoteid); + } + } + else + { + jaddnum(bestitem,"quotedprice",price); + jaddnum(bestitem,"maxprice",maxprice); + jaddstr(bestitem,"status","too expensive"); + } +} +else +{ + printf("invalid price %.8f\n",price); + jaddnum(bestitem,"maxprice",maxprice); + jaddstr(bestitem,"status","no response to request"); +} +/*while ( time(NULL) < expiration ) + { + if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL ) + { + printf("break out of price %.8f %s/%s\n",price,qp->srccoin,qp->destcoin); + break; + } + sleep(1); + }*/ + +if ( aliceutxo->S.swap == 0 ) +LP_availableset(aliceutxo); +return(jprint(bestitem,0)); +} + /*if ( time(NULL) > coin->lastmonitor+60 ) { //portable_mutex_lock(&coin->addrmutex); From b5ca59087c72e4f7856501b46e4c28503d184ab1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 16:32:22 +0300 Subject: [PATCH 173/346] Test --- iguana/exchanges/LP_swap.c | 10 ++++++---- iguana/exchanges/LP_transaction.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index c59d9f203..fd2cd3ec7 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -419,10 +419,10 @@ int32_t LP_waitfor(int32_t pairsock,struct basilisk_swap *swap,int32_t timeout,i pfd.events = NN_POLLIN; if ( nn_poll(&pfd,1,1) > 0 ) { - printf("start wait\n"); + //printf("start wait\n"); if ( (datalen= nn_recv(pairsock,&data,NN_MSG,0)) >= 0 ) { - printf("wait for got.%d\n",datalen); + //printf("wait for got.%d\n",datalen); retval = (*verify)(swap,data,datalen); nn_freemsg(data); //printf("retval.%d\n",retval); @@ -754,6 +754,8 @@ void LP_bobloop(void *_swap) } if ( LP_swapdata_rawtxsend(swap->N.pair,swap,0x8000,data,maxlen,&swap->bobpayment,0x4000,0) == 0 ) printf("error sending bobpayment\n"); + //if ( LP_waitfor(swap->N.pair,swap,10,LP_verify_alicespend) < 0 ) + // printf("error waiting for alicespend\n"); swap->sentflag = 1; swap->bobreclaim.utxovout = 0; swap->bobreclaim.utxotxid = swap->bobpayment.I.signedtxid; @@ -815,13 +817,13 @@ void LP_aliceloop(void *_swap) char str[65];printf("%d waiting for bobpayment %s to be confirmed.%d %s %s\n",n,swap->bobpayment.I.destaddr,swap->I.bobconfirms,swap->bobcoin.symbol,bits256_str(str,swap->bobpayment.I.signedtxid)); sleep(LP_SWAPSTEP_TIMEOUT); } - if ( LP_swapdata_rawtxsend(swap->N.pair,swap,0x20000,data,maxlen,&swap->alicespend,0x40000,0) == 0 ) + /*if ( LP_swapdata_rawtxsend(swap->N.pair,swap,0x20000,data,maxlen,&swap->alicespend,0x40000,0) == 0 ) printf("error sending alicespend\n"); while ( (n= LP_numconfirms(swap->alicecoin.symbol,swap->alicespend.I.destaddr,swap->alicespend.I.signedtxid,0,1)) < swap->I.aliceconfirms ) { char str[65];printf("%d waiting for alicespend %s to be confirmed.%d %s %s\n",n,swap->alicespend.I.destaddr,swap->I.aliceconfirms,swap->bobcoin.symbol,bits256_str(str,swap->alicespend.I.signedtxid)); sleep(LP_SWAPSTEP_TIMEOUT); - } + }*/ if ( swap->N.pair >= 0 ) nn_close(swap->N.pair), swap->N.pair = -1; LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,30); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 869b17d59..c49486171 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1329,6 +1329,20 @@ int32_t LP_verify_otherfee(struct basilisk_swap *swap,uint8_t *data,int32_t data return(-1); } +int32_t LP_verify_alicespend(struct basilisk_swap *swap,uint8_t *data,int32_t datalen) +{ + if ( LP_rawtx_spendscript(swap,swap->bobcoin.longestchain,&swap->alicespend,0,data,datalen,0) == 0 ) + { + printf("alicespend amount %.8f -> %s vs %s\n",dstr(swap->alicespend.I.amount),swap->alicespend.p2shaddr,swap->alicespend.I.destaddr); + if ( strcmp(swap->alicespend.I.destaddr,swap->alicespend.p2shaddr) == 0 ) + { + printf("alicespend verified\n"); + return(0); + } + } + return(-1); +} + /* Bob deposit: OP_IF OP_CLTV OP_DROP OP_CHECKSIG From 72c1886ee38dafc61697224f49520e105b97dec1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 16:40:33 +0300 Subject: [PATCH 174/346] Test --- iguana/exchanges/LP_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index c49486171..a1a00ef5b 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -942,7 +942,7 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t v memset(&spendtxid,0,sizeof(spendtxid)); if ( LP_spendsearch(&spendtxid,&spendvin,symbol,utxotxid,vout) > 0 ) printf("spend of %s/v%d detected\n",bits256_str(str,utxotxid),vout); - else if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) + else if ( 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) { if ( (retjson= LP_gettxout(symbol,coinaddr,utxotxid,vout)) == 0 ) { From b01f14849820ecb62336faa94a80da09a4ce905b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 16:58:17 +0300 Subject: [PATCH 175/346] Test --- iguana/exchanges/LP_remember.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index fca22ef2a..dcfecc5b2 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -548,7 +548,7 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t break; if ( i < 33 ) memcpy(rswap->other33,other33,33); - //printf(" <- %s dest33\n",dest33); + printf(" <- %s other33\n",dest33); } if ( (rswap->plocktime= juint(item,"plocktime")) == 0 ) rswap->plocktime = LP_extract(requestid,quoteid,fname,"plocktime"); @@ -860,6 +860,11 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } + if ( rswap.iambob != 0 && rswap.Adestaddr[0] == 0 ) + bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.other33,33); + if ( rswap.iambob == 0 && rswap.destaddr[0] == 0 ) + bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.other33,33); + //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); From 20782429041d555b2fd1b6ade2d67a49be2b2577 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:04:52 +0300 Subject: [PATCH 176/346] Test --- iguana/exchanges/LP_remember.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index dcfecc5b2..3724b0394 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -511,7 +511,7 @@ cJSON *LP_swap_json(struct LP_swap_remember *rswap) int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t quoteid) { - char fname[1024],*fstr,*secretstr,*srcstr,*deststr,*dest33,*txname; long fsize; cJSON *item,*txobj,*array; bits256 privkey; uint32_t r,q; int32_t i,j,n; uint8_t other33[33]; + char fname[1024],*fstr,*secretstr,*srcstr,*deststr,*dest33,*txname; long fsize; cJSON *item,*txobj,*array; bits256 privkey; struct iguana_info *coin; uint32_t r,q; int32_t i,j,n; uint8_t other33[33]; memset(rswap,0,sizeof(*rswap)); rswap->requestid = requestid; rswap->quoteid = quoteid; @@ -548,7 +548,11 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t break; if ( i < 33 ) memcpy(rswap->other33,other33,33); - printf(" <- %s other33\n",dest33); + if ( rswap->iambob != 0 && (coin= LP_coinfind(rswap->dest)) != 0 ) + bitcoin_address(rswap->Adestaddr,coin->taddr,coin->pubtype,rswap->other33,33); + else if ( (coin= LP_coinfind(rswap->src)) != 0 ) + bitcoin_address(rswap->destaddr,coin->taddr,coin->pubtype,rswap->other33,33); + printf("(%s %s) <- %s other33\n",rswap->destaddr,rswap->Adestaddr,dest33); } if ( (rswap->plocktime= juint(item,"plocktime")) == 0 ) rswap->plocktime = LP_extract(requestid,quoteid,fname,"plocktime"); @@ -860,10 +864,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } - if ( rswap.iambob != 0 && rswap.Adestaddr[0] == 0 ) - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.other33,33); - if ( rswap.iambob == 0 && rswap.destaddr[0] == 0 ) - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.other33,33); //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); From 3b6d6231801f7412984db1ab5544226a5caab6de Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:10:00 +0300 Subject: [PATCH 177/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_prices.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 5987e084d..a26e487d3 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -954,7 +954,7 @@ struct LP_utxoinfo *LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t ma struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,char *gui,bits256 *avoids,int32_t numavoids) { bits256 pubkey; char *obookstr,coinaddr[64]; cJSON *orderbook,*asks,*item; int32_t maxiters,i,j,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; uint64_t asatoshis; struct iguana_info *basecoin; struct LP_utxoinfo *bestutxo = 0; - maxiters = 100; + maxiters = 50; *ordermatchpricep = 0.; *bestsatoshisp = *bestdestsatoshisp = 0; basecoin = LP_coinfind(base); diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 640512d18..d6244d1e0 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -666,8 +666,8 @@ cJSON *LP_orderbookjson(char *symbol,struct LP_orderbookentry *op) jaddstr(item,"address",op->coinaddr); jaddnum(item,"price",op->price); jaddnum(item,"numutxos",op->numutxos); - jaddnum(item,"minvolume",dstr(op->minsatoshis)); - jaddnum(item,"maxvolume",dstr(op->maxsatoshis)); + jaddnum(item,"minvolume",dstr(op->minsatoshis)*0.8); + jaddnum(item,"maxvolume",dstr(op->maxsatoshis)*0.8); jaddbits256(item,"pubkey",op->pubkey); jaddnum(item,"age",time(NULL)-op->timestamp); } From 9edbaf27bce0ba67cbf26fa5b257fa321ac9ae78 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:14:59 +0300 Subject: [PATCH 178/346] Test --- iguana/exchanges/LP_remember.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 3724b0394..fee76ad9a 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -536,6 +536,10 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t if ( (dest33= jstr(item,"dest33")) != 0 && strlen(dest33) == 66 ) { decode_hex(rswap->pubkey33,33,dest33); + if ( rswap->iambob != 0 && (coin= LP_coinfind(rswap->src)) != 0 ) + bitcoin_address(rswap->destaddr,coin->taddr,coin->pubtype,rswap->pubkey33,33); + else if ( rswap->iambob == 0 && (coin= LP_coinfind(rswap->dest)) != 0 ) + bitcoin_address(rswap->Adestaddr,coin->taddr,coin->pubtype,rswap->pubkey33,33); //for (i=0; i<33; i++) // printf("%02x",pubkey33[i]); //printf(" <- %s dest33\n",dest33); @@ -550,9 +554,9 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t memcpy(rswap->other33,other33,33); if ( rswap->iambob != 0 && (coin= LP_coinfind(rswap->dest)) != 0 ) bitcoin_address(rswap->Adestaddr,coin->taddr,coin->pubtype,rswap->other33,33); - else if ( (coin= LP_coinfind(rswap->src)) != 0 ) + else if ( rswap->iambob == 0 && (coin= LP_coinfind(rswap->src)) != 0 ) bitcoin_address(rswap->destaddr,coin->taddr,coin->pubtype,rswap->other33,33); - printf("(%s %s) <- %s other33\n",rswap->destaddr,rswap->Adestaddr,dest33); + printf("(%s, %s) <- %s other33\n",rswap->destaddr,rswap->Adestaddr,dest33); } if ( (rswap->plocktime= juint(item,"plocktime")) == 0 ) rswap->plocktime = LP_extract(requestid,quoteid,fname,"plocktime"); @@ -842,7 +846,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); + bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.other33,33); Adest = rswap.destaddr; } } @@ -855,7 +859,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) { - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); + bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.other33,33); ABdest = rswap.Adestaddr; } } From bb12899d57879ad86a4e39f098220c5eb27d054a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:19:06 +0300 Subject: [PATCH 179/346] Test --- iguana/exchanges/LP_remember.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index fee76ad9a..7db2324eb 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -267,7 +267,7 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag if ( bits256_nonz(spendtxid) != 0 ) { sentflags[utxoind] = 1; - printf("utxoind.%d Alice.(%s) Bob.(%s)\n",utxoind,aliceaddr,bobaddr); + printf("utxoind.%d Alice.(%s %s) Bob.(%s %s) vs destaddr.(%s)\n",utxoind,aliceaddr,Adest,bobaddr,dest,destaddr); if ( aliceaddr != 0 && (strcmp(destaddr,aliceaddr) == 0 || strcmp(Adest,destaddr) == 0) ) { printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); From 337c73429097485a4bb4f7b78d5cfce0e791c1e1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:26:00 +0300 Subject: [PATCH 180/346] Test --- iguana/exchanges/LP_remember.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 7db2324eb..3548c0b96 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -846,7 +846,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.other33,33); + bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); Adest = rswap.destaddr; } } @@ -859,7 +859,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) { - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.other33,33); + bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); ABdest = rswap.Adestaddr; } } From 6ff716c84d51af96db766d5cac45216f1afc0af0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:30:59 +0300 Subject: [PATCH 181/346] Test --- iguana/exchanges/LP_remember.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 3548c0b96..780e8a812 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -467,7 +467,7 @@ struct LP_swap_remember uint32_t requestid,quoteid,plocktime,dlocktime,expiration,state,otherstate; int32_t iambob,finishedflag,origfinishedflag,Predeemlen,Dredeemlen,sentflags[sizeof(txnames)/sizeof(*txnames)]; uint8_t secretAm[20],secretAm256[32],secretBn[20],secretBn256[32],Predeemscript[1024],Dredeemscript[1024],pubkey33[33],other33[33]; - char src[64],dest[64],destaddr[64],Adestaddr[64],alicepaymentaddr[64],bobpaymentaddr[64],bobdepositaddr[64],alicecoin[64],bobcoin[64],*txbytes[sizeof(txnames)/sizeof(*txnames)]; + char src[64],dest[64],destaddr[64],Adestaddr[64],Sdestaddr[64],alicepaymentaddr[64],bobpaymentaddr[64],bobdepositaddr[64],alicecoin[64],bobcoin[64],*txbytes[sizeof(txnames)/sizeof(*txnames)]; }; cJSON *LP_swap_json(struct LP_swap_remember *rswap) @@ -841,26 +841,26 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti { if ( alice != 0 ) { - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); + //bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); AAdest = rswap.Adestaddr; } if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); - Adest = rswap.destaddr; + bitcoin_address(rswap.Sdestaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); + ABdest = rswap.Sdestaddr; } } else { if ( bob != 0 ) { - bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); + //bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); Bdest = rswap.destaddr; } if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) { - bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - ABdest = rswap.Adestaddr; + bitcoin_address(rswap.Sdestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); + ABdest = rswap.Sdestaddr; } } if ( bob == 0 || alice == 0 ) From 56337413036c7cd946ca3fa4d527e0af57765e97 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:37:08 +0300 Subject: [PATCH 182/346] Test --- iguana/exchanges/LP_remember.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 780e8a812..08604a1ab 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -842,13 +842,14 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( alice != 0 ) { //bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - AAdest = rswap.Adestaddr; + AAdest = Adest = rswap.Adestaddr; } if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { bitcoin_address(rswap.Sdestaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); ABdest = rswap.Sdestaddr; } + Bdest = rswap.destaddr; } else { @@ -860,8 +861,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) { bitcoin_address(rswap.Sdestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - ABdest = rswap.Sdestaddr; + AAdest = ABdest = rswap.Sdestaddr; } + Adest = rswap.Adestaddr; } if ( bob == 0 || alice == 0 ) { From addbb66d521dbfcd8f8ce72ce1a14e65a869d0ab Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:40:51 +0300 Subject: [PATCH 183/346] Test --- iguana/exchanges/LP_remember.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 08604a1ab..51e4692d0 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -842,14 +842,14 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( alice != 0 ) { //bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - AAdest = Adest = rswap.Adestaddr; + Adest = rswap.Adestaddr; } if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { bitcoin_address(rswap.Sdestaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); - ABdest = rswap.Sdestaddr; + AAdest = rswap.Sdestaddr; } - Bdest = rswap.destaddr; + ABdest = Bdest = rswap.destaddr; } else { @@ -861,9 +861,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) { bitcoin_address(rswap.Sdestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - AAdest = ABdest = rswap.Sdestaddr; + ABdest = rswap.Sdestaddr; } - Adest = rswap.Adestaddr; + AAdest = Adest = rswap.Adestaddr; } if ( bob == 0 || alice == 0 ) { From 93a3a93c71df96c0efbc7054be75536ffaf7a91b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:51:41 +0300 Subject: [PATCH 184/346] Test --- iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_scan.c | 9 +++++---- iguana/exchanges/LP_transaction.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 8f1698718..f274f45e4 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -288,6 +288,7 @@ int32_t LP_ismine(struct LP_utxoinfo *utxo); int32_t LP_isavailable(struct LP_utxoinfo *utxo); struct LP_peerinfo *LP_peerfind(uint32_t ipbits,uint16_t port); uint64_t LP_value_extract(cJSON *obj,int32_t addinterest); +int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vout); char *LP_command_process(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen); void LP_availableset(struct LP_utxoinfo *utxo); int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol,bits256 txid,int32_t vout,uint64_t satoshis,bits256 txid2,int32_t vout2); diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index eb721e2ee..6b71d89e9 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -391,7 +391,7 @@ char *LP_dividends(struct iguana_info *coin,int32_t height,cJSON *argjson) return(clonestr("{\"error\":\"symbol not found\"}")); } -int32_t LP_spendsearch(bits256 *spendtxidp,int32_t *indp,char *symbol,bits256 searchtxid,int32_t searchvout) +int32_t LP_spendsearch(char *coinaddr,bits256 *spendtxidp,int32_t *indp,char *symbol,bits256 searchtxid,int32_t searchvout) { struct LP_transaction *tx; struct iguana_info *coin; *indp = -1; @@ -402,6 +402,7 @@ int32_t LP_spendsearch(bits256 *spendtxidp,int32_t *indp,char *symbol,bits256 se { if ( searchvout < tx->numvouts && tx->outpoints[searchvout].spendvini >= 0 ) { + LP_swap_getcoinaddr(symbol,coinaddr,*spendtxidp,*indp); *spendtxidp = tx->outpoints[searchvout].spendtxid; *indp = tx->outpoints[searchvout].spendvini; return(tx->outpoints[searchvout].spendheight); @@ -504,7 +505,7 @@ int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int int32_t LP_mempool_vinscan(bits256 *spendtxidp,int32_t *spendvinp,char *symbol,char *coinaddr,bits256 searchtxid,int32_t searchvout,bits256 searchtxid2,int32_t searchvout2) { - struct iguana_info *coin; int32_t selector; cJSON *array; + struct iguana_info *coin; int32_t selector; cJSON *array; char addr[64]; if ( symbol == 0 || symbol[0] == 0 || bits256_nonz(searchtxid) == 0 || bits256_nonz(searchtxid2) == 0 ) return(-1); if ( (coin= LP_coinfind(symbol)) == 0 || coin->inactive != 0 ) @@ -517,9 +518,9 @@ int32_t LP_mempool_vinscan(bits256 *spendtxidp,int32_t *spendvinp,char *symbol,c coin->lastmempool = (uint32_t)time(NULL); } } - if ( (selector= LP_spendsearch(spendtxidp,spendvinp,symbol,searchtxid,searchvout)) >= 0 ) + if ( (selector= LP_spendsearch(addr,spendtxidp,spendvinp,symbol,searchtxid,searchvout)) >= 0 ) return(selector); - else if ( (selector= LP_spendsearch(spendtxidp,spendvinp,symbol,searchtxid2,searchvout2)) >= 0 ) + else if ( (selector= LP_spendsearch(addr,spendtxidp,spendvinp,symbol,searchtxid2,searchvout2)) >= 0 ) return(selector); return(-1); } diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index a1a00ef5b..320e6c745 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -940,7 +940,7 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t v destaddr[0] = 0; coinaddr[0] = 0; memset(&spendtxid,0,sizeof(spendtxid)); - if ( LP_spendsearch(&spendtxid,&spendvin,symbol,utxotxid,vout) > 0 ) + if ( LP_spendsearch(destaddr,&spendtxid,&spendvin,symbol,utxotxid,vout) > 0 ) printf("spend of %s/v%d detected\n",bits256_str(str,utxotxid),vout); else if ( 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) { From 3db8022cf3f65dfe9bdebd83923121d7f5ac8fb2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 17:58:46 +0300 Subject: [PATCH 185/346] Test --- iguana/exchanges/LP_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index 6b71d89e9..193ee7e92 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -402,9 +402,9 @@ int32_t LP_spendsearch(char *coinaddr,bits256 *spendtxidp,int32_t *indp,char *sy { if ( searchvout < tx->numvouts && tx->outpoints[searchvout].spendvini >= 0 ) { - LP_swap_getcoinaddr(symbol,coinaddr,*spendtxidp,*indp); *spendtxidp = tx->outpoints[searchvout].spendtxid; *indp = tx->outpoints[searchvout].spendvini; + LP_swap_getcoinaddr(symbol,coinaddr,*spendtxidp,*indp); return(tx->outpoints[searchvout].spendheight); } } From d7e9262583d143129be686674236b6e5501136f2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 18:09:50 +0300 Subject: [PATCH 186/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a26e487d3..a08ef9d75 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -954,7 +954,7 @@ struct LP_utxoinfo *LP_ordermatch_iter(struct LP_address_utxo **utxos,int32_t ma struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,char *gui,bits256 *avoids,int32_t numavoids) { bits256 pubkey; char *obookstr,coinaddr[64]; cJSON *orderbook,*asks,*item; int32_t maxiters,i,j,numasks,max = 10000; struct LP_address_utxo **utxos; double price; struct LP_pubkeyinfo *pubp; uint64_t asatoshis; struct iguana_info *basecoin; struct LP_utxoinfo *bestutxo = 0; - maxiters = 50; + maxiters = 100; *ordermatchpricep = 0.; *bestsatoshisp = *bestdestsatoshisp = 0; basecoin = LP_coinfind(base); @@ -964,7 +964,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i return(0); utxos = calloc(max,sizeof(*utxos)); LP_txfees(&txfee,&desttxfee,base,autxo->coin); - //printf("LP_buyutxo maxprice %.8f relvol %.8f %s/%s %.8f %.8f\n",maxprice,dstr(autxo->S.satoshis),base,autxo->coin,dstr(txfee),dstr(desttxfee)); + printf("LP_buyutxo maxprice %.8f relvol %.8f %s/%s %.8f %.8f\n",maxprice,dstr(autxo->S.satoshis),base,autxo->coin,dstr(txfee),dstr(desttxfee)); if ( (obookstr= LP_orderbook(base,autxo->coin,duration)) != 0 ) { if ( (orderbook= cJSON_Parse(obookstr)) != 0 ) From 9531dc745ba4f2510afd8463e4bf92d7b81b041c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 18:15:54 +0300 Subject: [PATCH 187/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 8792b7abb..a496f6094 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -281,7 +281,7 @@ int32_t LP_nanomsg_recvs(void *ctx) if ( (origipaddr= LP_myipaddr) == 0 ) origipaddr = "127.0.0.1"; milli = OS_milliseconds(); - if ( milli > lastmilli+100 ) + if ( lastmilli > 0. && milli > lastmilli+100 ) fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds\n",milli-lastmilli); lastmilli = milli; //portable_mutex_lock(&LP_nanorecvsmutex); From 2b962fd334c68a8a5d7b9cb750fab42dc35096a8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 18:48:19 +0300 Subject: [PATCH 188/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a08ef9d75..706b4e13a 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -679,7 +679,7 @@ char *LP_connectedalice(cJSON *argjson) // alice return(clonestr("{\"error\":\"cant get alicecoin\"}")); } Q.privkey = LP_privkey(Q.destaddr,coin->taddr); - if ( bits256_nonz(Q.privkey) != 0 && Q.quotetime >= Q.timestamp-3 ) + if ( bits256_nonz(Q.privkey) != 0 )//&& Q.quotetime >= Q.timestamp-3 ) { retjson = cJSON_CreateObject(); if ( (pairstr= jstr(argjson,"pair")) == 0 || (pairsock= nn_socket(AF_SP,NN_PAIR)) < 0 ) @@ -712,7 +712,7 @@ char *LP_connectedalice(cJSON *argjson) // alice else { LP_availableset(autxo); - printf("no privkey found\n"); + printf("no privkey found coin.%s %s taddr.%u\n",Q.destcoin,Q.destaddr,coin->taddr); return(clonestr("{\"error\",\"no privkey\"}")); } } From 3ad4c4efb2abcf2e2b4315910a55da31c14d503d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 19:36:29 +0300 Subject: [PATCH 189/346] Fix state machine --- iguana/exchanges/LP_remember.c | 4 ++-- iguana/exchanges/LP_transaction.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 51e4692d0..ebb6cf3d3 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1052,9 +1052,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } if ( rswap.sentflags[BASILISK_BOBREFUND] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 ) { - if ( bits256_nonz(rswap.paymentspent) != 0 || time(NULL) > rswap.expiration ) + if ( bits256_nonz(rswap.Apaymentspent) != 0 || time(NULL) > rswap.expiration ) { - printf("do the refund!\n"); + printf("do the refund! paymentspent.%s now.%u vs expiration.%u\n",bits256_str(str,rswap.paymentspent),(uint32_t)time(NULL),rswap.expiration); //if ( txbytes[BASILISK_BOBREFUND] == 0 ) { revcalc_rmd160_sha256(rswap.secretBn,rswap.privBn); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 320e6c745..95ce5fcb0 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1077,16 +1077,16 @@ int32_t basilisk_swapuserdata(uint8_t *userdata,bits256 privkey,int32_t ifpath,b int32_t basilisk_bobpayment_reclaim(struct basilisk_swap *swap,int32_t delay) { - uint8_t userdata[512]; int32_t retval,len = 0; static bits256 zero; + uint8_t userdata[512]; int32_t retval,i,len = 0; static bits256 zero; //printf("basilisk_bobpayment_reclaim\n"); len = basilisk_swapuserdata(userdata,zero,1,swap->I.myprivs[1],swap->bobpayment.redeemscript,swap->bobpayment.I.redeemlen); memcpy(swap->I.userdata_bobreclaim,userdata,len); swap->I.userdata_bobreclaimlen = len; if ( (retval= basilisk_rawtx_sign(swap->bobcoin.symbol,swap->bobcoin.wiftaddr,swap->bobcoin.taddr,swap->bobcoin.pubtype,swap->bobcoin.p2shtype,swap->bobcoin.isPoS,swap->bobcoin.wiftype,swap,&swap->bobreclaim,&swap->bobpayment,swap->I.myprivs[1],0,userdata,len,1,swap->changermd160,swap->bobpayment.I.destaddr)) == 0 ) { - //for (i=0; ibobreclaim.I.datalen; i++) - // printf("%02x",swap->bobreclaim.txbytes[i]); - //printf(" <- bobreclaim\n"); + for (i=0; ibobreclaim.I.datalen; i++) + printf("%02x",swap->bobreclaim.txbytes[i]); + printf(" <- bobreclaim\n"); //basilisk_txlog(swap,&swap->bobreclaim,delay); return(retval); } From 64759d4b8006931f8e9badd4c9cf26db1eb0147f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 19:45:21 +0300 Subject: [PATCH 190/346] Test --- iguana/exchanges/LP_remember.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index ebb6cf3d3..8c8f22050 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -556,7 +556,7 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t bitcoin_address(rswap->Adestaddr,coin->taddr,coin->pubtype,rswap->other33,33); else if ( rswap->iambob == 0 && (coin= LP_coinfind(rswap->src)) != 0 ) bitcoin_address(rswap->destaddr,coin->taddr,coin->pubtype,rswap->other33,33); - printf("(%s, %s) <- %s other33\n",rswap->destaddr,rswap->Adestaddr,dest33); + //printf("(%s, %s) <- %s other33\n",rswap->destaddr,rswap->Adestaddr,dest33); } if ( (rswap->plocktime= juint(item,"plocktime")) == 0 ) rswap->plocktime = LP_extract(requestid,quoteid,fname,"plocktime"); From 1d7a72a64a6c1068f2722476a50e26ef4b45ce31 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 19:49:54 +0300 Subject: [PATCH 191/346] Test --- iguana/exchanges/LP_ordermatch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 706b4e13a..939d9301e 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -804,7 +804,7 @@ void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen) { - char *method,*msg,*retstr; int32_t DEXselector = 0; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); + char *method,*msg,*retstr,str[65]; int32_t DEXselector = 0; uint64_t value,value2; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct iguana_info *coin; struct LP_address_utxo *utxos[1000]; struct LP_quoteinfo Q; int32_t retval = -1,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"reserved") == 0 ||strcmp(method,"connected") == 0 || strcmp(method,"request") == 0 || strcmp(method,"connect") == 0) ) { LP_quoteparse(&Q,argjson); @@ -815,7 +815,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, { if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 ) { - printf("alice received RESERVED.(%s)\n",jprint(argjson,0)); + printf("alice %s received RESERVED.(%s)\n",bits256_str(str,G.LP_mypub25519),jprint(argjson,0)); if ( (retstr= LP_quotereceived(argjson)) != 0 ) free(retstr); LP_reserved(ctx,myipaddr,pubsock,&Q); @@ -826,7 +826,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, { if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 ) { - printf("alice received CONNECTED.(%s)\n",jprint(argjson,0)); + printf("alice %s received CONNECTED.(%s)\n",bits256_str(str,G.LP_mypub25519),jprint(argjson,0)); if ( (retstr= LP_connectedalice(argjson)) != 0 ) free(retstr); } From 5dfecd6f7a8f3d7c0c176c7d520be7bbe300e2d9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 20:25:07 +0300 Subject: [PATCH 192/346] Reasonably stable --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index a496f6094..416aea3d4 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -21,11 +21,11 @@ // // -SPV at tx level and limit SPV proofing +// withdraw // stats, fix pricearray // sign packets -// dPoW security // electrum peers -// withdraw +// dPoW security and zeroconf // verify portfolio // bittrex balancing From f8d8268a4f4f52c3140c18425573f84296a46a19 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 21:18:10 +0300 Subject: [PATCH 193/346] Test --- iguana/exchanges/LP_remember.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 8c8f22050..1785676a6 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -358,7 +358,7 @@ int32_t basilisk_swap_isfinished(int32_t iambob,bits256 *txids,int32_t *sentflag if ( bits256_nonz(depositspent) != 0 ) return(1); } - else if ( bits256_nonz(paymentspent) != 0 ) + else if ( bits256_nonz(Apaymentspent) != 0 ) return(1); } else From fa8a1412f1f4118be8fd569ef2c28395da3745ea Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 21:47:56 +0300 Subject: [PATCH 194/346] Test --- iguana/exchanges/LP_remember.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 1785676a6..fc3c7598c 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -645,7 +645,8 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t int32_t _LP_refht_update(struct iguana_info *coin,bits256 txid,int32_t refht) { - if ( refht > 0 && (coin->firstrefht == 0 || refht < coin->firstrefht) ) + refht -= 9; + if ( refht > 10 && (coin->firstrefht == 0 || refht < coin->firstrefht) ) { char str[65]; printf(">>>>>>>>. 1st refht %s %s <- %d, scan %d %d\n",coin->symbol,bits256_str(str,txid),refht,coin->firstscanht,coin->lastscanht); if ( coin->firstscanht == 0 || refht < coin->firstscanht ) From f05e427e23e738b28d055e500e28c2e35bc1a528 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 22:10:42 +0300 Subject: [PATCH 195/346] Test --- iguana/exchanges/LP_coins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 224e3a435..54450c061 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -84,7 +84,7 @@ uint16_t LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) strcpy(username,rpcuser); strcpy(password,rpcpassword); } - //printf("%s rpcuser.(%s) rpcpassword.(%s)\n",symbol,rpcuser,rpcpassword); + printf("%s rpcuser.(%s) rpcpassword.(%s)\n",symbol,rpcuser,rpcpassword); if ( rpcuser != 0 ) free(rpcuser); if ( rpcpassword != 0 ) From ee12b77aa4012ad3e59206adf04a5ff2a9e52525 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 22:12:09 +0300 Subject: [PATCH 196/346] Test --- iguana/exchanges/LP_coins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 54450c061..224e3a435 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -84,7 +84,7 @@ uint16_t LP_userpassfp(char *symbol,char *username,char *password,FILE *fp) strcpy(username,rpcuser); strcpy(password,rpcpassword); } - printf("%s rpcuser.(%s) rpcpassword.(%s)\n",symbol,rpcuser,rpcpassword); + //printf("%s rpcuser.(%s) rpcpassword.(%s)\n",symbol,rpcuser,rpcpassword); if ( rpcuser != 0 ) free(rpcuser); if ( rpcpassword != 0 ) From f74d3fa4d145f7f9c3bee5bfbb6f8125ce4baafd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 22:15:47 +0300 Subject: [PATCH 197/346] Test --- crypto777/bitcoind_RPC.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 559ea4d02..803c0cb40 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -60,13 +60,13 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 ) { if ( strcmp(command,"signrawtransaction") != 0 && strcmp(command,"getrawtransaction") != 0 ) - printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); + printf("<<<<<<<<<<< A bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,params); return(rpcstr); } json = cJSON_Parse(rpcstr); if ( json == 0 ) { - printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s can't parse.(%s) params.(%s)\n",debugstr,command,rpcstr,params); + printf("<<<<<<<<<<< B bitcoind_RPC: %s post_process_bitcoind_RPC.%s can't parse.(%s) params.(%s)\n",debugstr,command,rpcstr,params); free(rpcstr); return(0); } From 7ea562fc5e7f26400c0ffe7f7d9ef3c743f01657 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 22:18:42 +0300 Subject: [PATCH 198/346] Test --- crypto777/bitcoind_RPC.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 803c0cb40..6a465fd91 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -55,7 +55,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * long i,j,len; char *retstr = 0; cJSON *json,*result,*error; - usleep(1000); + usleep(2500); //printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 ) { From 2176e55fd79630bc42c209fa98553bca000877b3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Oct 2017 23:49:05 +0300 Subject: [PATCH 199/346] Update spent taxis twice --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_remember.c | 49 +++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 416aea3d4..7d97b203d 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -20,7 +20,7 @@ // marketmaker // -// -SPV at tx level and limit SPV proofing +// -verify SPV checking is working // withdraw // stats, fix pricearray // sign packets diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index fc3c7598c..bbfc387b6 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -818,10 +818,34 @@ int32_t LP_rswap_checktx(struct LP_swap_remember *rswap,char *symbol,int32_t txi return(0); } +int32_t LP_spends_set(struct LP_swap_remember *rswap) +{ + int32_t numspent = 0; + if ( bits256_nonz(rswap->paymentspent) == 0 ) + { + if ( bits256_nonz(rswap->txids[BASILISK_ALICESPEND]) != 0 ) + rswap->paymentspent = rswap->txids[BASILISK_ALICESPEND]; + else rswap->paymentspent = rswap->txids[BASILISK_BOBRECLAIM]; + } else numspent++; + if ( bits256_nonz(rswap->depositspent) == 0 ) + { + if ( bits256_nonz(rswap->txids[BASILISK_BOBREFUND]) != 0 ) + rswap->depositspent = rswap->txids[BASILISK_BOBREFUND]; + else rswap->depositspent = rswap->txids[BASILISK_ALICECLAIM]; + } else numspent++; + if ( bits256_nonz(rswap->Apaymentspent) == 0 ) + { + if ( bits256_nonz(rswap->txids[BASILISK_BOBSPEND]) != 0 ) + rswap->Apaymentspent = rswap->txids[BASILISK_BOBSPEND]; + else rswap->Apaymentspent = rswap->txids[BASILISK_ALICERECLAIM]; + } else numspent++; + return(numspent); +} + cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requestid,uint32_t quoteid) { static void *ctx; - struct LP_swap_remember rswap; int32_t i,j,len,secretstart,redeemlen; char str[65],*Adest,*Bdest,*AAdest,*ABdest; cJSON *item; bits256 rev,signedtxid,zero; struct iguana_info *bob=0,*alice=0; uint8_t redeemscript[1024],userdata[1024]; + struct LP_swap_remember rswap; int32_t i,j,numspent,len,secretstart,redeemlen; char str[65],*Adest,*Bdest,*AAdest,*ABdest; cJSON *item; bits256 rev,signedtxid,zero; struct iguana_info *bob=0,*alice=0; uint8_t redeemscript[1024],userdata[1024]; if ( ctx == 0 ) ctx = bitcoin_ctx(); if ( (rswap.iambob= LP_rswap_init(&rswap,requestid,quoteid)) < 0 ) @@ -891,6 +915,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,AAdest,ABdest,rswap.Adestaddr,rswap.destaddr); rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); + LP_spends_set(&rswap); if ( rswap.iambob == 0 ) { if ( rswap.sentflags[BASILISK_ALICESPEND] == 0 ) @@ -1003,6 +1028,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti if ( bits256_nonz(rswap.privAm) == 0 ) { rswap.privAm = basilisk_swap_privbob_extract(rswap.bobcoin,rswap.txids[BASILISK_ALICESPEND],0,1); + printf("try to bobspend aspend.%s have privAm.%d\n",bits256_str(str,rswap.txids[BASILISK_ALICESPEND]),bits256_nonz(rswap.privAm)); } if ( bits256_nonz(rswap.privAm) != 0 && bits256_nonz(rswap.privBn) != 0 ) { @@ -1096,26 +1122,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("depositspent.(%s) alice.%d bob.%d %s %.8f\n",bits256_str(str,rswap.depositspent),rswap.sentflags[BASILISK_ALICECLAIM],rswap.sentflags[BASILISK_BOBREFUND],rswap.bobcoin,dstr(rswap.values[BASILISK_BOBDEPOSIT])); } LP_totals_update(rswap.iambob,rswap.alicecoin,rswap.bobcoin,KMDtotals,BTCtotals,rswap.sentflags,rswap.values); - int32_t numspent = 0; - if ( bits256_nonz(rswap.paymentspent) == 0 ) - { - if ( bits256_nonz(rswap.txids[BASILISK_ALICESPEND]) != 0 ) - rswap.paymentspent = rswap.txids[BASILISK_ALICESPEND]; - else rswap.paymentspent = rswap.txids[BASILISK_BOBRECLAIM]; - } else numspent++; - if ( bits256_nonz(rswap.depositspent) == 0 ) - { - if ( bits256_nonz(rswap.txids[BASILISK_BOBREFUND]) != 0 ) - rswap.depositspent = rswap.txids[BASILISK_BOBREFUND]; - else rswap.depositspent = rswap.txids[BASILISK_ALICECLAIM]; - } else numspent++; - if ( bits256_nonz(rswap.Apaymentspent) == 0 ) - { - if ( bits256_nonz(rswap.txids[BASILISK_BOBSPEND]) != 0 ) - rswap.Apaymentspent = rswap.txids[BASILISK_BOBSPEND]; - else rswap.Apaymentspent = rswap.txids[BASILISK_ALICERECLAIM]; - } else numspent++; - if ( numspent == 3 ) + if ( (numspent= LP_spends_set(&rswap)) == 3 ) rswap.finishedflag = 1; else rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); item = LP_swap_json(&rswap); From ea7976fd2d51d9467991945a57f608280adf5a7c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 00:36:32 +0300 Subject: [PATCH 200/346] Test --- iguana/exchanges/LP_remember.c | 89 ++++++++-------------------------- 1 file changed, 19 insertions(+), 70 deletions(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index bbfc387b6..7ffbb8980 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -287,13 +287,13 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); if ( aliceaddr != 0 ) { - sentflags[bobspent] = 0; + sentflags[bobspent] = 1; sentflags[alicespent] = 0; txids[bobspent] = spendtxid; } else if ( bobaddr != 0 ) { - sentflags[alicespent] = 0; + sentflags[alicespent] = 1; sentflags[bobspent] = 0; txids[alicespent] = spendtxid; } @@ -845,14 +845,15 @@ int32_t LP_spends_set(struct LP_swap_remember *rswap) cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requestid,uint32_t quoteid) { static void *ctx; - struct LP_swap_remember rswap; int32_t i,j,numspent,len,secretstart,redeemlen; char str[65],*Adest,*Bdest,*AAdest,*ABdest; cJSON *item; bits256 rev,signedtxid,zero; struct iguana_info *bob=0,*alice=0; uint8_t redeemscript[1024],userdata[1024]; + struct LP_swap_remember rswap; int32_t i,j,numspent,len,secretstart,redeemlen; char str[65],*srcAdest,*srcBdest,*destAdest,*destBdest,otheraddr[64]; cJSON *item; bits256 rev,signedtxid,zero; struct iguana_info *bob=0,*alice=0; uint8_t redeemscript[1024],userdata[1024]; if ( ctx == 0 ) ctx = bitcoin_ctx(); if ( (rswap.iambob= LP_rswap_init(&rswap,requestid,quoteid)) < 0 ) return(cJSON_Parse("{\"error\":\"couldnt initialize rswap, are all coins active?\"}")); LP_swap_load(&rswap); memset(zero.bytes,0,sizeof(zero)); - Adest = Bdest = AAdest = ABdest = 0; + otheraddr[0] = 0; + srcAdest = srcBdest = destAdest = destBdest = 0; if ( rswap.bobcoin[0] == 0 || rswap.alicecoin[0] == 0 || strcmp(rswap.bobcoin,rswap.src) != 0 || strcmp(rswap.alicecoin,rswap.dest) != 0 ) { printf("BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest); @@ -866,36 +867,38 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti { if ( alice != 0 ) { - //bitcoin_address(rswap.Adestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - Adest = rswap.Adestaddr; + bitcoin_address(otheraddr,alice->taddr,alice->pubtype,rswap.other33,33); + destBdest = otheraddr; + destAdest = rswap.Adestaddr; } if ( (bob= LP_coinfind(rswap.bobcoin)) != 0 ) { bitcoin_address(rswap.Sdestaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); - AAdest = rswap.Sdestaddr; + srcAdest = rswap.Sdestaddr; } - ABdest = Bdest = rswap.destaddr; + srcBdest = rswap.destaddr; } else { if ( bob != 0 ) { - //bitcoin_address(rswap.destaddr,bob->taddr,bob->pubtype,rswap.pubkey33,33); - Bdest = rswap.destaddr; + bitcoin_address(otheraddr,bob->taddr,bob->pubtype,rswap.other33,33); + srcAdest = otheraddr; + srcBdest = rswap.destaddr; } if ( (alice= LP_coinfind(rswap.alicecoin)) != 0 ) { bitcoin_address(rswap.Sdestaddr,alice->taddr,alice->pubtype,rswap.pubkey33,33); - ABdest = rswap.Sdestaddr; + destBdest = rswap.Sdestaddr; } - AAdest = Adest = rswap.Adestaddr; + destAdest = rswap.Adestaddr; } if ( bob == 0 || alice == 0 ) { printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } - + printf("src.(Adest %s, Bdest %s), dest.(Adest %s, Bdest %s)\n",srcAdest,srcBdest,destAdest,destBdest); //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); @@ -911,9 +914,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti LP_rswap_checktx(&rswap,rswap.alicecoin,BASILISK_ALICEPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBDEPOSIT); - rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); - rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,AAdest,ABdest,rswap.Adestaddr,rswap.destaddr); - rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); + rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); + rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,destAdest,destBdest,rswap.Adestaddr,rswap.destaddr); + rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); LP_spends_set(&rswap); if ( rswap.iambob == 0 ) @@ -949,15 +952,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } LP_txbytes_update("alicespend",rswap.bobcoin,rswap.txbytes[BASILISK_ALICESPEND],&rswap.txids[BASILISK_ALICESPEND],&rswap.paymentspent,&rswap.sentflags[BASILISK_ALICESPEND]); - /*if ( rswap.txbytes[BASILISK_ALICESPEND] != 0 ) - { - rswap.txids[BASILISK_ALICESPEND] = LP_broadcast("alicespend",rswap.bobcoin,rswap.txbytes[BASILISK_ALICESPEND],zero); - if ( bits256_nonz(rswap.txids[BASILISK_ALICESPEND]) != 0 ) // tested - { - rswap.sentflags[BASILISK_ALICESPEND] = 1; - rswap.paymentspent = rswap.txids[BASILISK_ALICESPEND]; - } - }*/ } } if ( rswap.sentflags[BASILISK_ALICECLAIM] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 ) @@ -982,15 +976,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } LP_txbytes_update("aliceclaim",rswap.bobcoin,rswap.txbytes[BASILISK_ALICECLAIM],&rswap.txids[BASILISK_ALICECLAIM],&rswap.depositspent,&rswap.sentflags[BASILISK_ALICECLAIM]); - /*if ( rswap.txbytes[BASILISK_ALICECLAIM] != 0 ) - { - rswap.txids[BASILISK_ALICECLAIM] = LP_broadcast("aliceclaim",rswap.bobcoin,rswap.txbytes[BASILISK_ALICECLAIM],zero); - if ( bits256_nonz(rswap.txids[BASILISK_ALICECLAIM]) != 0 ) // tested - { - rswap.sentflags[BASILISK_ALICECLAIM] = 1; - rswap.depositspent = rswap.txids[BASILISK_ALICECLAIM]; - } - }*/ } else printf("now %u before expiration %u\n",(uint32_t)time(NULL),rswap.expiration); } if ( rswap.sentflags[BASILISK_ALICEPAYMENT] != 0 && bits256_nonz(rswap.Apaymentspent) == 0 && rswap.sentflags[BASILISK_ALICECLAIM] == 0 ) @@ -1005,15 +990,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } LP_txbytes_update("alicereclaim",rswap.alicecoin,rswap.txbytes[BASILISK_ALICERECLAIM],&rswap.txids[BASILISK_ALICERECLAIM],&rswap.Apaymentspent,&rswap.sentflags[BASILISK_ALICERECLAIM]); - /*if ( rswap.txbytes[BASILISK_ALICERECLAIM] != 0 ) - { - rswap.txids[BASILISK_ALICERECLAIM] = LP_broadcast("alicereclaim",rswap.alicecoin,rswap.txbytes[BASILISK_ALICERECLAIM],zero); - if ( bits256_nonz(rswap.txids[BASILISK_ALICERECLAIM]) != 0 ) // tested - { - rswap.sentflags[BASILISK_ALICERECLAIM] = 1; - rswap.Apaymentspent = rswap.txids[BASILISK_ALICERECLAIM]; - } - }*/ } } else if ( rswap.iambob == 1 ) @@ -1037,15 +1013,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } LP_txbytes_update("bobspend",rswap.alicecoin,rswap.txbytes[BASILISK_BOBSPEND],&rswap.txids[BASILISK_BOBSPEND],&rswap.Apaymentspent,&rswap.sentflags[BASILISK_BOBSPEND]); - /*if ( rswap.txbytes[BASILISK_BOBSPEND] != 0 ) - { - rswap.txids[BASILISK_BOBSPEND] = LP_broadcast("bobspend",rswap.alicecoin,rswap.txbytes[BASILISK_BOBSPEND],zero); - if ( bits256_nonz(rswap.txids[BASILISK_BOBSPEND]) != 0 ) // tested - { - rswap.sentflags[BASILISK_BOBSPEND] = 1; - rswap.Apaymentspent = rswap.txids[BASILISK_BOBSPEND]; - } - }*/ } } if ( rswap.sentflags[BASILISK_BOBRECLAIM] == 0 && rswap.sentflags[BASILISK_BOBPAYMENT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBPAYMENT]) != 0 && time(NULL) > rswap.expiration && bits256_nonz(rswap.paymentspent) == 0 ) @@ -1067,15 +1034,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti } } LP_txbytes_update("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],&rswap.txids[BASILISK_BOBRECLAIM],&rswap.paymentspent,&rswap.sentflags[BASILISK_BOBRECLAIM]); - /*if ( rswap.txbytes[BASILISK_BOBRECLAIM] != 0 ) - { - rswap.txids[BASILISK_BOBRECLAIM] = LP_broadcast("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],zero); - if ( bits256_nonz(rswap.txids[BASILISK_BOBRECLAIM]) != 0 ) // tested - { - rswap.sentflags[BASILISK_BOBRECLAIM] = 1; - rswap.paymentspent = rswap.txids[BASILISK_BOBRECLAIM]; - } - }*/ } if ( rswap.sentflags[BASILISK_BOBREFUND] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 ) { @@ -1092,15 +1050,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("pubB1.(%s) bobrefund.(%s)\n",bits256_str(str,rswap.pubB1),rswap.txbytes[BASILISK_BOBREFUND]); } LP_txbytes_update("bobrefund",rswap.bobcoin,rswap.txbytes[BASILISK_BOBREFUND],&rswap.txids[BASILISK_BOBREFUND],&rswap.depositspent,&rswap.sentflags[BASILISK_BOBREFUND]); - /*if ( rswap.txbytes[BASILISK_BOBREFUND] != 0 ) - { - rswap.txids[BASILISK_BOBREFUND] = LP_broadcast("bobrefund",rswap.bobcoin,rswap.txbytes[BASILISK_BOBREFUND],zero); - if ( bits256_nonz(rswap.txids[BASILISK_BOBREFUND]) != 0 ) // tested - { - rswap.sentflags[BASILISK_BOBREFUND] = 1; - rswap.depositspent = rswap.txids[BASILISK_BOBREFUND]; - } - }*/ } else printf("bobrefund's time %u vs expiration %u\n",(uint32_t)time(NULL),rswap.expiration); } } From be68af67121ad11aa1a360b65e4f12b51d5d6a1e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 01:54:01 +0300 Subject: [PATCH 201/346] __WIN32 --- crypto777/iguana_OS.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto777/iguana_OS.c b/crypto777/iguana_OS.c index 9b218f130..1d31c269e 100755 --- a/crypto777/iguana_OS.c +++ b/crypto777/iguana_OS.c @@ -30,7 +30,7 @@ char *OS_mvstr() { -#ifdef __WIN32 +#ifdef _WIN32 return("rename"); #else return("mv"); From f9c262c757cf39a60250df6dd31ef787d3735dde Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 02:18:01 +0300 Subject: [PATCH 202/346] Print mark error --- crypto777/OS_portable.h | 2 +- crypto777/iguana_OS.c | 2 +- crypto777/jpeg/unix/jmemname.c | 2 +- iguana/exchanges/LP_coins.c | 6 +++--- iguana/exchanges/LP_nativeDEX.c | 4 +--- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_socket.c | 4 ++-- iguana/exchanges/LP_utxo.c | 6 ++++-- iguana/exchanges/stats.c | 6 +++--- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crypto777/OS_portable.h b/crypto777/OS_portable.h index 9ce9d368b..77e6ec5bc 100755 --- a/crypto777/OS_portable.h +++ b/crypto777/OS_portable.h @@ -40,7 +40,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #define sleep(x) Sleep(1000*(x)) #include "../OSlibs/win/mingw.h" #include "../OSlibs/win/mman.h" diff --git a/crypto777/iguana_OS.c b/crypto777/iguana_OS.c index 1d31c269e..c8a7c888f 100755 --- a/crypto777/iguana_OS.c +++ b/crypto777/iguana_OS.c @@ -659,7 +659,7 @@ int64_t OS_copyfile(char *src,char *dest,int32_t cmpflag) { if ( (destfp= fopen(OS_compatible_path(dest),"wb")) != 0 ) { -#ifdef WIN32 +#ifdef _WIN32 allocsize = 1024 * 1024 * 8L; #else allocsize = 1024 * 1024 * 128L; diff --git a/crypto777/jpeg/unix/jmemname.c b/crypto777/jpeg/unix/jmemname.c index 9db4408eb..fd09935aa 100755 --- a/crypto777/jpeg/unix/jmemname.c +++ b/crypto777/jpeg/unix/jmemname.c @@ -11,7 +11,7 @@ * Also, the problem of determining the amount of memory available * is shoved onto the user. */ -#ifndef WIN32 +#ifndef _WIN32 #include #endif diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 224e3a435..dc6f3634c 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -100,7 +100,7 @@ void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name return; } sprintf(fname,"%s",LP_getdatadir()); -#ifdef WIN32 +#ifdef _WIN32 strcat(fname,"\\"); #else strcat(fname,"/"); @@ -138,7 +138,7 @@ void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name #endif if ( strcmp(symbol,"KMD") != 0 ) { -#ifdef WIN32 +#ifdef _WIN32 strcat(fname,"\\"); #else strcat(fname,"/"); @@ -146,7 +146,7 @@ void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name strcat(fname,assetname); } } -#ifdef WIN32 +#ifdef _WIN32 strcat(fname,"\\"); #else strcat(fname,"/"); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7d97b203d..b696d3a53 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,14 +19,12 @@ // LP_nativeDEX.c // marketmaker // - -// -verify SPV checking is working // withdraw +// verify portfolio // stats, fix pricearray // sign packets // electrum peers // dPoW security and zeroconf -// verify portfolio // bittrex balancing diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 72df16330..5a716959c 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -460,7 +460,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u { if ( coin->electrum != 0 ) { - if (up->SPV == 0 ) + if (up->SPV <= 0 ) up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); if ( up->SPV < 0 ) { diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 1c49e20ac..99d707ad4 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -86,7 +86,7 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port) #endif saddr.sin_family = AF_INET; saddr.sin_port = htons(port); - //#ifdef WIN32 + //#ifdef _WIN32 // saddr.sin_addr.s_addr = (uint32_t)calc_ipbits("127.0.0.1"); //#else @@ -111,7 +111,7 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port) opt = 1; slen = sizeof(opt); //printf("set keepalive.%d\n",setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,(void *)&opt,slen)); -#ifndef WIN32 +#ifndef _WIN32 if ( 1 )//&& bindflag != 0 ) { opt = 0; diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 214bef80b..b5553ef00 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -332,8 +332,10 @@ int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 } else printf("ERROR MERK %s ht.%d -> %s root.(%s) vs %s\n",bits256_str(str,txid),height,jprint(merkobj,0),bits256_str(str2,roothash),bits256_str(str3,merkleroot)); free_json(hdrobj); - } + } else printf("couldnt get header for ht.%d\n",height); } + if ( SPV < 0 ) + printf("MERKLE DIDNT VERIFY.(%s)\n",jprint(merkobj,0)); free_json(merkobj); } return(SPV); @@ -366,7 +368,7 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum } if ( up->spendheight <= 0 ) { - if ( backupep != 0 && up->SPV == 0 ) + if ( backupep != 0 && up->SPV <= 0 ) up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); jaddi(array,LP_address_item(coin,up,electrumret)); n++; diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 8e5099814..6ac6d9a84 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -28,7 +28,7 @@ #include "DEXstats.h" char *stats_JSON(void *ctx,char *myipaddr,int32_t mypubsock,cJSON *argjson,char *remoteaddr,uint16_t port); -#ifndef WIN32 +#ifndef _WIN32 #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0x4000 // Do not generate SIGPIPE #endif @@ -115,7 +115,7 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) #endif saddr.sin_family = AF_INET; saddr.sin_port = htons(port); - //#ifdef WIN32 + //#ifdef _WIN32 // saddr.sin_addr.s_addr = (uint32_t)calc_ipbits("127.0.0.1"); //#else @@ -140,7 +140,7 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) opt = 1; slen = sizeof(opt); //printf("set keepalive.%d\n",setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,(void *)&opt,slen)); -#ifndef WIN32 +#ifndef _WIN32 if ( 1 )//&& bindflag != 0 ) { opt = 0; From 2f74c36783d6b4248354bd8ec083bb2a281bd8cd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 02:27:53 +0300 Subject: [PATCH 203/346] Test --- iguana/exchanges/LP_nativeDEX.c | 5 ++--- iguana/exchanges/LP_utxo.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index b696d3a53..fdac06dd6 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,13 +19,12 @@ // LP_nativeDEX.c // marketmaker // +// sign packets // withdraw // verify portfolio // stats, fix pricearray -// sign packets -// electrum peers // dPoW security and zeroconf -// bittrex balancing +// electrum peers #include diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b5553ef00..b1641292f 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -324,13 +324,16 @@ int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 roothash = validate_merkle(jint(merkobj,"pos"),txid,merkles,m); if ( (hdrobj= electrum_getheader(coin->symbol,ep,&hdrobj,height)) != 0 ) { - merkleroot = jbits256(hdrobj,"merkle_root"); - if ( bits256_cmp(merkleroot,roothash) == 0 ) + if ( jobj(hdrobj,"merkle_root") != 0 ) { - SPV = height; - //printf("validated MERK %s ht.%d -> %s root.(%s)\n",bits256_str(str,up->U.txid),up->U.height,jprint(merkobj,0),bits256_str(str2,roothash)); - } - else printf("ERROR MERK %s ht.%d -> %s root.(%s) vs %s\n",bits256_str(str,txid),height,jprint(merkobj,0),bits256_str(str2,roothash),bits256_str(str3,merkleroot)); + merkleroot = jbits256(hdrobj,"merkle_root"); + if ( bits256_cmp(merkleroot,roothash) == 0 ) + { + SPV = height; + //printf("validated MERK %s ht.%d -> %s root.(%s)\n",bits256_str(str,up->U.txid),up->U.height,jprint(merkobj,0),bits256_str(str2,roothash)); + } + else printf("ERROR MERK %s ht.%d -> %s root.(%s) vs %s (%s)\n",bits256_str(str,txid),height,jprint(merkobj,0),bits256_str(str2,roothash),bits256_str(str3,merkleroot),jprint(hdrobj,0)); + } else SPV = 0; free_json(hdrobj); } else printf("couldnt get header for ht.%d\n",height); } From 327481dc3705e41e713c79e62247cfbe2949a62f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 15:46:11 +0300 Subject: [PATCH 204/346] Test --- iguana/exchanges/LP_commands.c | 32 ---------------------- iguana/exchanges/LP_ordermatch.c | 47 ++++++++++++++++++-------------- iguana/exchanges/LP_remember.c | 2 +- iguana/exchanges/install | 2 +- iguana/exchanges/listunspent | 1 + iguana/exchanges/utxos | 3 -- 6 files changed, 30 insertions(+), 57 deletions(-) delete mode 100755 iguana/exchanges/utxos diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index bd7f000c9..30523ba69 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -428,38 +428,10 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"getcoins") == 0 ) return(jprint(LP_coinsjson(0),1)); - else if ( strcmp(method,"numutxos") == 0 ) - { - printf("deprecated numutxos received\n"); - retstr = clonestr("{\"result\":\"couldnt add utxo\"}"); - //return(LP_numutxos()); - } else if ( strcmp(method,"encrypted") == 0 ) retstr = clonestr("{\"result\":\"success\"}"); - else if ( strcmp(method,"registerall") == 0 ) - return(clonestr("{\"error\":\"you are running an obsolete version, update\"}")); - else if ( strcmp(method,"forward") == 0 ) - return(clonestr("{\"error\":\"you are running an obsolete version, update\"}")); - else if ( strcmp(method,"keepalive") == 0 ) - return(clonestr("{\"error\":\"you are running an obsolete version, update\"}")); else if ( strcmp(method,"getpeers") == 0 ) return(LP_peers()); - else if ( strcmp(method,"getutxos") == 0 ) - { - printf("deprecated getutxos received\n"); - retstr = clonestr("{\"result\":\"couldnt add utxo\"}"); - //return(LP_utxos(1,LP_mypeer,jstr(argjson,"coin"),jint(argjson,"lastn"))); - } - else if ( strcmp(method,"utxo") == 0 ) - { - static uint32_t counter; - if ( counter++ < 3 ) - printf("deprecated utxo received\n"); - //if ( LP_utxoaddjson(1,LP_mypubsock,argjson) != 0 ) - // retstr = clonestr("{\"result\":\"success\",\"utxo\":\"received\"}"); - //else - retstr = clonestr("{\"result\":\"couldnt add utxo\"}"); - } else { if ( base != 0 && rel != 0 && strcmp(method,"pricearray") == 0 ) @@ -490,10 +462,6 @@ dividends(coin, height, )\n\ } if ( IAMLP != 0 ) { - if ( strcmp(method,"register") == 0 ) - return(clonestr("{\"error\":\"you are running an obsolete version, update\"}")); - else if ( strcmp(method,"lookup") == 0 ) - return(clonestr("{\"error\":\"you are running an obsolete version, update\"}")); if ( strcmp(method,"broadcast") == 0 ) { bits256 zero; char *cipherstr; int32_t cipherlen; uint8_t cipher[LP_ENCRYPTED_MAXSIZE]; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 5a716959c..53fe24fdf 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -821,7 +821,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, free(retstr); LP_reserved(ctx,myipaddr,pubsock,&Q); } - return(1); + return(retval); } else if ( strcmp(method,"connected") == 0 ) { @@ -831,14 +831,14 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, if ( (retstr= LP_connectedalice(argjson)) != 0 ) free(retstr); } - return(1); + return(retval); } if ( bits256_cmp(G.LP_mypub25519,Q.srchash) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0 ) { if ( (coin= LP_coinfind(Q.srccoin)) == 0 || (price= LP_myprice(&bid,&ask,Q.srccoin,Q.destcoin)) <= SMALLVAL || ask <= SMALLVAL ) { printf("this node has no price for %s/%s\n",Q.srccoin,Q.destcoin); - return(-3); + return(retval); } price = ask; autxo = &A; @@ -884,17 +884,17 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, if ( butxo == 0 || bits256_nonz(butxo->payment.txid) == 0 || bits256_nonz(butxo->deposit.txid) == 0 || butxo->payment.vout < 0 || butxo->deposit.vout < 0 ) { char str[65],str2[65]; printf("couldnt find bob utxos for autxo %s/v%d %s/v%d %.8f -> %.8f\n",bits256_str(str,Q.txid),Q.vout,bits256_str(str2,Q.txid2),Q.vout2,dstr(Q.satoshis),dstr(Q.destsatoshis)); - return(1); + return(retval); } if ( (qprice= LP_quote_validate(autxo,butxo,&Q,1)) <= SMALLVAL ) { printf("quote validate error %.0f\n",qprice); - return(-4); + return(-3); } if ( qprice < (price - 0.00000001) * 0.9999 ) { printf("(%.8f %.8f) quote price %.8f too low vs %.8f for %s/%s\n",bid,ask,qprice,price,Q.srccoin,Q.destcoin); - return(-5); + return(-4); } if ( butxo->S.swap == 0 && time(NULL) > butxo->T.swappending ) butxo->T.swappending = 0; @@ -915,7 +915,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, butxo->T.lasttime = (uint32_t)time(NULL); printf("return after queued RESERVED: set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",butxo->T.swappending,qprice,price,msg); LP_reserved_msg(Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg); - return(2); + return(retval); } else printf("warning swappending.%u swap.%p\n",butxo->T.swappending,butxo->S.swap); } else if ( strcmp(method,"connect") == 0 ) // bob @@ -926,7 +926,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, // validate SPV alice LP_connectstartbob(ctx,pubsock,butxo,argjson,Q.srccoin,Q.destcoin,qprice,&Q); //LP_butxo_swapfields_set(butxo); - return(3); + return(retval); } else printf("pend.%u swap %p when connect came in (%s)\n",butxo->T.swappending,butxo->S.swap,jprint(argjson,0)); } @@ -1026,7 +1026,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel,double maxprice,double relvolume,int32_t timeout,int32_t duration,char *gui) { - uint64_t desttxfee,txfee; int32_t numpubs = 0; int64_t bestsatoshis=0,destsatoshis,bestdestsatoshis=0; struct LP_utxoinfo *autxo,*bestutxo = 0; double qprice,ordermatchprice=0.; struct LP_quoteinfo Q; bits256 pubkeys[100]; + uint64_t desttxfee,txfee; int32_t i,maxiters,numpubs = 0; int64_t bestsatoshis=0,destsatoshis,bestdestsatoshis=0; struct LP_utxoinfo *autxo,*bestutxo = 0; double qprice,ordermatchprice=0.; struct LP_quoteinfo Q; bits256 pubkeys[100]; printf("LP_autobuy %s/%s price %.8f vol %.8f\n",base,rel,maxprice,relvolume); if ( duration <= 0 ) duration = LP_ORDERBOOK_DURATION; @@ -1044,23 +1044,30 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel return(clonestr("{\"error\":\"cant find utxo that is big enough\"}")); if ( destsatoshis < autxo->S.satoshis ) autxo->S.satoshis = destsatoshis; - while ( 1 ) + if ( (bestutxo= LP_buyutxo(&ordermatchprice,&bestsatoshis,&bestdestsatoshis,autxo,base,maxprice,duration,txfee,desttxfee,gui,pubkeys,numpubs)) == 0 || ordermatchprice == 0. || bestdestsatoshis == 0 ) { - if ( (bestutxo= LP_buyutxo(&ordermatchprice,&bestsatoshis,&bestdestsatoshis,autxo,base,maxprice,duration,txfee,desttxfee,gui,pubkeys,numpubs)) == 0 || ordermatchprice == 0. || bestdestsatoshis == 0 ) + printf("bestutxo.%p ordermatchprice %.8f bestdestsatoshis %.8f\n",bestutxo,ordermatchprice,dstr(bestdestsatoshis)); + return(clonestr("{\"error\":\"cant find ordermatch utxo\"}")); + } + pubkeys[numpubs++] = bestutxo->pubkey; + if ( LP_quoteinfoinit(&Q,bestutxo,rel,ordermatchprice,bestsatoshis,bestdestsatoshis) < 0 ) + return(clonestr("{\"error\":\"cant set ordermatch quote\"}")); + if ( LP_quotedestinfo(&Q,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,G.LP_mypub25519,autxo->coinaddr) < 0 ) + return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); + maxiters = 25; + for (i=0; ipubkey; - if ( LP_quoteinfoinit(&Q,bestutxo,rel,ordermatchprice,bestsatoshis,bestdestsatoshis) < 0 ) - return(clonestr("{\"error\":\"cant set ordermatch quote\"}")); - if ( LP_quotedestinfo(&Q,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,G.LP_mypub25519,autxo->coinaddr) < 0 ) - return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); - if ( (qprice= LP_quote_validate(autxo,0,&Q,0)) <= SMALLVAL ) + if ( qprice/ordermatchprice < 1.+SMALLVAL ) { - printf("continue searching, quote validate error %.0f\n",qprice); + printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); continue; } + Q.satoshis *= 0.999; break; } //printf("do quote.(%s)\n",jprint(LP_quotejson(&Q),1)); diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 7ffbb8980..5953151ff 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -898,7 +898,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti printf("Bob.%p is null or Alice.%p is null\n",bob,alice); return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); } - printf("src.(Adest %s, Bdest %s), dest.(Adest %s, Bdest %s)\n",srcAdest,srcBdest,destAdest,destBdest); + //printf("src.(Adest %s, Bdest %s), dest.(Adest %s, Bdest %s)\n",srcAdest,srcBdest,destAdest,destBdest); //printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee)); //printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest); //printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest); diff --git a/iguana/exchanges/install b/iguana/exchanges/install index 4695b8e3a..db8330603 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,5 @@ #!/bin/bash -cp balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices getutxos help inv setprice status utxos ../dexscripts +cp balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status utxos ../dexscripts cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass . diff --git a/iguana/exchanges/listunspent b/iguana/exchanges/listunspent index 9b03640f3..127397d9c 100755 --- a/iguana/exchanges/listunspent +++ b/iguana/exchanges/listunspent @@ -1,2 +1,3 @@ +#!/bin/bash source userpass curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"listunspent\",\"coin\":\"CHIPS\",\"address\":\"RMfQwu5ey23eWJ4as2ckd8dqsQJwo836ny\"}" diff --git a/iguana/exchanges/utxos b/iguana/exchanges/utxos deleted file mode 100755 index 4782c9a0a..000000000 --- a/iguana/exchanges/utxos +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"getutxos\",\"coin\":\"REVS\"}" From a823190e35e47fb7fe41bd30bfce6ca4ff782084 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 15:53:03 +0300 Subject: [PATCH 205/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 53fe24fdf..9356a7b9d 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -287,7 +287,7 @@ int32_t LP_quote_checkmempool(struct LP_quoteinfo *qp,struct LP_utxoinfo *autxo, double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,struct LP_quoteinfo *qp,int32_t iambob) { double qprice=0.; uint64_t txfee,desttxfee,srcvalue=0,srcvalue2=0,destvalue=0,destvalue2=0; - printf("quote %s %.8f -> %s %.8f\n",qp->srccoin,dstr(qp->satoshis),qp->destcoin,dstr(qp->destsatoshis)); + printf(">>>>>>> quote satoshis.(%.8f %.8f) %s %.8f -> %s %.8f\n",dstr(qp->satoshis),dstr(qp->destsatoshis),qp->srccoin,dstr(qp->satoshis),qp->destcoin,dstr(qp->destsatoshis)); if ( butxo != 0 ) { if (LP_iseligible(&srcvalue,&srcvalue2,1,qp->srccoin,qp->txid,qp->vout,qp->satoshis,qp->txid2,qp->vout2) == 0 ) From 7503b94b79025f4303af118b39bff124ec621ef1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 15:59:25 +0300 Subject: [PATCH 206/346] Test --- iguana/exchanges/LP_ordermatch.c | 50 ++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 9356a7b9d..254cb4680 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1034,9 +1034,9 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel timeout = LP_AUTOTRADE_TIMEOUT; if ( maxprice <= 0. || relvolume <= 0. || LP_priceinfofind(base) == 0 || LP_priceinfofind(rel) == 0 ) return(clonestr("{\"error\":\"invalid parameter\"}")); - if ( strcmp("BTC",rel) == 0 ) - maxprice *= 1.01; - else maxprice *= 1.001; + //if ( strcmp("BTC",rel) == 0 ) + // maxprice *= 1.01; + //else maxprice *= 1.001; memset(pubkeys,0,sizeof(pubkeys)); LP_txfees(&txfee,&desttxfee,base,rel); destsatoshis = SATOSHIDEN * relvolume + 2*desttxfee; @@ -1044,30 +1044,38 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel return(clonestr("{\"error\":\"cant find utxo that is big enough\"}")); if ( destsatoshis < autxo->S.satoshis ) autxo->S.satoshis = destsatoshis; - if ( (bestutxo= LP_buyutxo(&ordermatchprice,&bestsatoshis,&bestdestsatoshis,autxo,base,maxprice,duration,txfee,desttxfee,gui,pubkeys,numpubs)) == 0 || ordermatchprice == 0. || bestdestsatoshis == 0 ) + while ( 1 ) { - printf("bestutxo.%p ordermatchprice %.8f bestdestsatoshis %.8f\n",bestutxo,ordermatchprice,dstr(bestdestsatoshis)); - return(clonestr("{\"error\":\"cant find ordermatch utxo\"}")); - } - pubkeys[numpubs++] = bestutxo->pubkey; - if ( LP_quoteinfoinit(&Q,bestutxo,rel,ordermatchprice,bestsatoshis,bestdestsatoshis) < 0 ) - return(clonestr("{\"error\":\"cant set ordermatch quote\"}")); - if ( LP_quotedestinfo(&Q,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,G.LP_mypub25519,autxo->coinaddr) < 0 ) - return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); - maxiters = 25; - for (i=0; ipubkey; + if ( LP_quoteinfoinit(&Q,bestutxo,rel,ordermatchprice,bestsatoshis,bestdestsatoshis) < 0 ) + return(clonestr("{\"error\":\"cant set ordermatch quote\"}")); + if ( LP_quotedestinfo(&Q,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,G.LP_mypub25519,autxo->coinaddr) < 0 ) + return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); + maxiters = 25; + qprice = 1. / SMALLVAL; + for (i=0; i maxprice ) { - printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); + printf("i.%d maxiters.%d qprice %.8f vs maxprice %.8f, no acceptable quote for this pubkey\n",i,maxiters,dstr(qprice),dstr(maxprice)); continue; } - Q.satoshis *= 0.999; break; } //printf("do quote.(%s)\n",jprint(LP_quotejson(&Q),1)); From b4cdc2b35886b20dbe80e78191c346aa9aeccb5f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 16:39:55 +0300 Subject: [PATCH 207/346] Tweak numconfirms --- iguana/exchanges/LP_include.h | 4 +-- iguana/exchanges/LP_ordermatch.c | 4 +-- iguana/exchanges/LP_swap.c | 48 +++++++++++++++++++++++--------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index f274f45e4..99f4551a0 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -71,7 +71,7 @@ #define LP_RESERVETIME 60 #define LP_AVETXSIZE 256 #define LP_CACHEDURATION 60 -#define BASILISK_DEFAULT_NUMCONFIRMS 1 +#define BASILISK_DEFAULT_NUMCONFIRMS 3 #define DEX_SLEEP 3 #define BASILISK_KEYSIZE ((int32_t)(2*sizeof(bits256)+sizeof(uint32_t)*2)) @@ -151,7 +151,7 @@ struct basilisk_swapinfo char bobstr[64],alicestr[64]; bits256 myhash,otherhash,orderhash; uint32_t statebits,otherstatebits,started,expiration,finished,dead,reftime,putduration,callduration; - int32_t bobconfirms,aliceconfirms,iambob,reclaimed,bobspent,alicespent,pad; + int32_t bobconfirms,aliceconfirms,iambob,reclaimed,bobspent,alicespent,pad,aliceistrusted,bobistrusted,otheristrusted,otherstrust; uint64_t alicesatoshis,bobsatoshis,bobinsurance,aliceinsurance,Atxfee,Btxfee; bits256 myprivs[2],mypubs[2],otherpubs[2],pubA0,pubA1,pubB0,pubB1,privAm,pubAm,privBn,pubBn; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 254cb4680..5ff3cf7e4 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1056,7 +1056,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel return(clonestr("{\"error\":\"cant set ordermatch quote\"}")); if ( LP_quotedestinfo(&Q,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,G.LP_mypub25519,autxo->coinaddr) < 0 ) return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); - maxiters = 25; + maxiters = 100; qprice = 1. / SMALLVAL; for (i=0; i maxprice ) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index fd2cd3ec7..6c3848772 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -177,6 +177,9 @@ uint32_t basilisk_requestid(struct basilisk_request *rp) int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) { int32_t i,datalen = 0; + data[datalen++] = swap->I.aliceconfirms; + data[datalen++] = swap->I.bobconfirms; + data[datalen++] = swap->I.otheristrusted; for (i=0; i<33; i++) data[datalen++] = swap->persistent_pubkey33[i]; for (i=0; ideck)/sizeof(swap->deck[0][0]); i++) @@ -186,9 +189,28 @@ int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { - int32_t i,nonz=0,len = 0; uint8_t other33[33]; - if ( datalen == sizeof(swap->otherdeck)+33 ) + int32_t i,nonz=0,aliceconfirms,bobconfirms,len = 0; uint8_t other33[33]; + if ( datalen == sizeof(swap->otherdeck)+34 ) { + aliceconfirms = data[len++]; + bobconfirms = data[len++]; + if ( aliceconfirms != swap->I.aliceconfirms || bobconfirms != swap->I.bobconfirms ) + { + printf("MISMATCHED required confirms me.(%d %d) vs (%d %d)\n",swap->I.aliceconfirms,swap->I.bobconfirms,aliceconfirms,bobconfirms); + if ( swap->I.aliceconfirms < aliceconfirms ) + swap->I.aliceconfirms = aliceconfirms; + if ( swap->I.bobconfirms < bobconfirms ) + swap->I.bobconfirms = bobconfirms; + } + if ( (swap->I.otherstrust= data[len++]) != 0 ) + { + if ( swap->I.otheristrusted != 0 ) + { + swap->I.aliceconfirms = swap->I.bobconfirms = 0; + printf("Otherside trusts us, adjust required confirms to: alice.%d bob.%d\n",swap->I.aliceconfirms,swap->I.bobconfirms); + } + } + printf("NUMCONFIRMS for SWAP alice.%d bob.%d, otheristrusted.%d othertrusts.%d\n",swap->I.aliceconfirms,swap->I.bobconfirms,swap->I.otheristrusted,swap->I.otherstrust); for (i=0; i<33; i++) if ( (other33[i]= data[len++]) != 0 ) nonz++; @@ -746,7 +768,7 @@ void LP_bobloop(void *_swap) { if ( strcmp(swap->alicecoin.symbol,"BTC") == 0 ) m = 0; - else m = 1; + else m = swap->I.aliceconfirms; while ( (n= LP_numconfirms(swap->alicecoin.symbol,swap->alicepayment.I.destaddr,swap->alicepayment.I.signedtxid,0,1)) < m ) // sync with alice { char str[65];printf("%d waiting for alicepayment %s to be confirmed.%d %s %s\n",n,swap->alicepayment.I.destaddr,1,swap->alicecoin.symbol,bits256_str(str,swap->alicepayment.I.signedtxid)); @@ -801,7 +823,7 @@ void LP_aliceloop(void *_swap) { if ( strcmp(swap->alicecoin.symbol,"BTC") == 0 ) m = 0; - else m = 1; + else m = swap->I.aliceconfirms; while ( (n= LP_numconfirms(swap->alicecoin.symbol,swap->alicepayment.I.destaddr,swap->alicepayment.I.signedtxid,0,1)) < m ) { char str[65];printf("%d waiting for alicepayment %s to be confirmed.%d %s %s\n",n,swap->alicepayment.I.destaddr,1,swap->alicecoin.symbol,bits256_str(str,swap->alicepayment.I.signedtxid)); @@ -957,7 +979,7 @@ void basilisk_rawtx_setparms(char *name,uint32_t quoteid,struct basilisk_rawtx * struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 pubkey25519,struct basilisk_swap *swap,int32_t optionduration,uint32_t statebits,struct LP_quoteinfo *qp) { //FILE *fp; char fname[512]; - uint8_t *alicepub33=0,*bobpub33=0; int32_t bobistrusted,aliceistrusted,jumblrflag=-2,x = -1; struct iguana_info *coin; + uint8_t *alicepub33=0,*bobpub33=0; int32_t jumblrflag=-2,x = -1; struct iguana_info *coin; swap->I.Atxfee = qp->desttxfee; swap->I.Btxfee = qp->txfee; swap->I.putduration = swap->I.callduration = INSTANTDEX_LOCKTIME; @@ -985,15 +1007,15 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 { swap->I.iambob = 0; swap->I.otherhash = swap->I.req.desthash; - aliceistrusted = 1; - bobistrusted = LP_pubkey_istrusted(swap->I.req.desthash); + swap->I.aliceistrusted = 1; + swap->I.otheristrusted = swap->I.bobistrusted = LP_pubkey_istrusted(swap->I.req.desthash); } else { swap->I.iambob = 1; swap->I.otherhash = swap->I.req.srchash; - bobistrusted = 1; - aliceistrusted = LP_pubkey_istrusted(swap->I.req.desthash); + swap->I.bobistrusted = 1; + swap->I.otheristrusted = swap->I.aliceistrusted = LP_pubkey_istrusted(swap->I.req.desthash); } if ( bits256_nonz(privkey) == 0 || (x= instantdex_pubkeyargs(swap,2 + INSTANTDEX_DECKSIZE,privkey,swap->I.orderhash,0x02+swap->I.iambob)) != 2 + INSTANTDEX_DECKSIZE ) { @@ -1019,20 +1041,20 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 if ( strcmp("BTC",swap->bobcoin.symbol) == 0 ) { swap->I.bobconfirms = (1 + sqrt(dstr(swap->I.bobsatoshis) * .1)); - swap->I.aliceconfirms = MIN(BASILISK_DEFAULT_NUMCONFIRMS,swap->I.bobconfirms); + swap->I.aliceconfirms = BASILISK_DEFAULT_NUMCONFIRMS; } else if ( strcmp("BTC",swap->alicecoin.symbol) == 0 ) { swap->I.aliceconfirms = (1 + sqrt(dstr(swap->I.alicesatoshis) * .1)); - swap->I.bobconfirms = MIN(BASILISK_DEFAULT_NUMCONFIRMS,swap->I.aliceconfirms); + swap->I.bobconfirms = BASILISK_DEFAULT_NUMCONFIRMS; } else { swap->I.bobconfirms = BASILISK_DEFAULT_NUMCONFIRMS; swap->I.aliceconfirms = BASILISK_DEFAULT_NUMCONFIRMS; } - swap->I.bobconfirms *= !bobistrusted; - swap->I.aliceconfirms *= !aliceistrusted; + swap->I.bobconfirms *= !swap->I.bobistrusted; + swap->I.aliceconfirms *= !swap->I.aliceistrusted; printf(">>>>>>>>>> jumblrflag.%d <<<<<<<<< use smart address, %.8f bobconfs.%d, %.8f aliceconfs.%d taddr.%d %d\n",jumblrflag,dstr(swap->I.bobsatoshis),swap->I.bobconfirms,dstr(swap->I.alicesatoshis),swap->I.aliceconfirms,swap->bobcoin.taddr,swap->alicecoin.taddr); if ( swap->I.iambob != 0 ) { From 54baa1abbb929d1ae4f6538283a7792f779b5ef4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 16:41:00 +0300 Subject: [PATCH 208/346] Test --- crypto777/bitcoind_RPC.c | 2 +- iguana/exchanges/LP_nativeDEX.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 6a465fd91..bc87b61f2 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -228,7 +228,7 @@ try_again: { count++; elapsedsum += (OS_milliseconds() - starttime); - if ( (count % 10000) == 0) + if ( (count % 100000) == 0) printf("%d: ave %9.6f | elapsed %.3f millis | bitcoind_RPC.(%s) url.(%s)\n",count,elapsedsum/count,(OS_milliseconds() - starttime),command,url); if ( retstrp != 0 ) { diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index fdac06dd6..78ba51f67 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -278,7 +278,7 @@ int32_t LP_nanomsg_recvs(void *ctx) if ( (origipaddr= LP_myipaddr) == 0 ) origipaddr = "127.0.0.1"; milli = OS_milliseconds(); - if ( lastmilli > 0. && milli > lastmilli+100 ) + if ( lastmilli > 0. && milli > lastmilli+1000 ) fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds\n",milli-lastmilli); lastmilli = milli; //portable_mutex_lock(&LP_nanorecvsmutex); From 75d04c43001d8f98c4a72709ce1dceef42c6deb2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 16:51:34 +0300 Subject: [PATCH 209/346] Test --- iguana/exchanges/LP_swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 6c3848772..c6a16119e 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -190,7 +190,7 @@ int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { int32_t i,nonz=0,aliceconfirms,bobconfirms,len = 0; uint8_t other33[33]; - if ( datalen == sizeof(swap->otherdeck)+34 ) + if ( datalen == sizeof(swap->otherdeck)+36 ) { aliceconfirms = data[len++]; bobconfirms = data[len++]; @@ -220,7 +220,7 @@ int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datal len += iguana_rwnum(0,&data[len],sizeof(swap->otherdeck[i>>1][i&1]),&swap->otherdeck[i>>1][i&1]); return(0); } - printf("pubkeys verify size mismatch %d != %d\n",datalen,(int32_t)sizeof(swap->otherdeck)); + printf("pubkeys verify size mismatch %d != %d\n",datalen,(int32_t)sizeof(swap->otherdeck)+36); return(-1); } From b25f229bba7d53028f683483f08c6dac1ff063c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 17:36:11 +0300 Subject: [PATCH 210/346] Test --- iguana/exchanges/LP_coins.c | 5 +++++ iguana/exchanges/LP_commands.c | 18 +++++++++++++++ iguana/exchanges/LP_include.h | 5 +++-- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_swap.c | 39 ++++++++++++++++++++++++++++----- iguana/exchanges/setconfirms | 3 +++ iguana/exchanges/trust | 4 ++++ 7 files changed, 68 insertions(+), 8 deletions(-) create mode 100755 iguana/exchanges/setconfirms create mode 100755 iguana/exchanges/trust diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index dc6f3634c..af0681662 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -299,6 +299,11 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse coin->inactive = (uint32_t)time(NULL); coin->bussock = LP_coinbus(busport); coin->ctx = bitcoin_ctx(); + if ( assetname != 0 && strcmp(name,assetname) == 0 ) + { + printf("%s is assetchain\n",symbol); + coin->isassetchain = 1; + } if ( strcmp(symbol,"KMD") == 0 || (assetname != 0 && assetname[0] != 0) ) name2 = 0; else name2 = name; diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 30523ba69..5a76fc503 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -114,6 +114,8 @@ portfolio()\n\ getpeers()\n\ passphrase(passphrase, gui)\n\ listunspent(coin, address)\n\ +setconfirms(coin, numconfirms, maxconfirms=6)\n\ +trust(pubkey, trust)\n\ balance(coin, address)\n\ orderbook(base, rel, duration=3600)\n\ getprices(base, rel)\n\ @@ -275,6 +277,22 @@ dividends(coin, height, )\n\ return(jprint(LP_electrumserver(ptr,jstr(argjson,"ipaddr"),juint(argjson,"port")),1)); } else return(clonestr("{\"error\":\"cant find coind\"}")); } + else if ( strcmp(method,"setconfirms") == 0 ) + { + int32_t n; + n = jint(argjson,"numconfirms"); + if ( n < 0 ) + return(clonestr("{\"error\":\"illegal numconfirms\"}")); + if ( (ptr= LP_coinsearch(coin)) != 0 ) + { + ptr->userconfirms = n; + if ( (n= jint(argjson,"maxconfirms")) > 0 ) + ptr->maxconfirms = n; + if ( ptr->maxconfirms > 0 && ptr->userconfirms > ptr->maxconfirms ) + ptr->userconfirms = ptr->maxconfirms; + return(clonestr("{\"result\":\"success\"}")); + } else return(clonestr("{\"error\":\"cant find coind\"}")); + } else if ( strcmp(method,"snapshot") == 0 ) { if ( (ptr= LP_coinsearch(coin)) != 0 ) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 99f4551a0..3eebf220a 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -72,6 +72,7 @@ #define LP_AVETXSIZE 256 #define LP_CACHEDURATION 60 #define BASILISK_DEFAULT_NUMCONFIRMS 3 +#define BASILISK_DEFAULT_MAXCONFIRMS 6 #define DEX_SLEEP 3 #define BASILISK_KEYSIZE ((int32_t)(2*sizeof(bits256)+sizeof(uint32_t)*2)) @@ -151,7 +152,7 @@ struct basilisk_swapinfo char bobstr[64],alicestr[64]; bits256 myhash,otherhash,orderhash; uint32_t statebits,otherstatebits,started,expiration,finished,dead,reftime,putduration,callduration; - int32_t bobconfirms,aliceconfirms,iambob,reclaimed,bobspent,alicespent,pad,aliceistrusted,bobistrusted,otheristrusted,otherstrust; + int32_t bobconfirms,aliceconfirms,iambob,reclaimed,bobspent,alicespent,pad,aliceistrusted,bobistrusted,otheristrusted,otherstrust,alicemaxconfirms,bobmaxconfirms; uint64_t alicesatoshis,bobsatoshis,bobinsurance,aliceinsurance,Atxfee,Btxfee; bits256 myprivs[2],mypubs[2],otherpubs[2],pubA0,pubA1,pubB0,pubB1,privAm,pubAm,privBn,pubBn; @@ -184,7 +185,7 @@ struct iguana_info uint64_t txfee; int32_t longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; uint32_t addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,unspenttime,obooktime; - uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag; + uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms; char symbol[16],smartaddr[64],userpass[1024],serverport[128],lastunspent[64]; // portfolio double price_kmd,force,perc,goal,goalperc,relvolume,rate; diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 78ba51f67..fabe55958 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -338,7 +338,7 @@ void LP_smartutxos_push(struct iguana_info *coin) memset(zero.bytes,0,sizeof(zero)); if ( (n= cJSON_GetArraySize(array)) > 0 ) { - printf("PUSH %s %s\n",coin->symbol,coin->smartaddr); + //printf("PUSH %s %s\n",coin->symbol,coin->smartaddr); for (i=0; iI.aliceconfirms; data[datalen++] = swap->I.bobconfirms; + data[datalen++] = swap->I.alicemaxconfirms; + data[datalen++] = swap->I.bobmaxconfirms; data[datalen++] = swap->I.otheristrusted; for (i=0; i<33; i++) data[datalen++] = swap->persistent_pubkey33[i]; @@ -189,18 +191,29 @@ int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { - int32_t i,nonz=0,aliceconfirms,bobconfirms,len = 0; uint8_t other33[33]; - if ( datalen == sizeof(swap->otherdeck)+36 ) + int32_t i,nonz=0,alicemaxconfirms,bobmaxconfirms,aliceconfirms,bobconfirms,len = 0; uint8_t other33[33]; + if ( datalen == sizeof(swap->otherdeck)+38 ) { aliceconfirms = data[len++]; bobconfirms = data[len++]; + alicemaxconfirms = data[len++]; + bobmaxconfirms = data[len++]; if ( aliceconfirms != swap->I.aliceconfirms || bobconfirms != swap->I.bobconfirms ) { - printf("MISMATCHED required confirms me.(%d %d) vs (%d %d)\n",swap->I.aliceconfirms,swap->I.bobconfirms,aliceconfirms,bobconfirms); + printf("MISMATCHED required confirms me.(%d %d) vs (%d %d) max.(%d %d) othermax.(%d %d)\n",swap->I.aliceconfirms,swap->I.bobconfirms,aliceconfirms,bobconfirms,swap->I.alicemaxconfirms,swap->I.bobmaxconfirms,alicemaxconfirms,bobmaxconfirms); + if ( alicemaxconfirms > swap->I.alicemaxconfirms ) + alicemaxconfirms = swap->I.alicemaxconfirms; + if ( bobmaxconfirms > swap->I.bobmaxconfirms ) + bobmaxconfirms = swap->I.bobmaxconfirms; if ( swap->I.aliceconfirms < aliceconfirms ) swap->I.aliceconfirms = aliceconfirms; if ( swap->I.bobconfirms < bobconfirms ) swap->I.bobconfirms = bobconfirms; + if ( swap->I.aliceconfirms > swap->I.alicemaxconfirms || swap->I.bobconfirms > swap->I.bobmaxconfirms ) + { + printf("numconfirms (%d %d) exceeds max (%d %d)\n",swap->I.aliceconfirms,swap->I.bobconfirms,swap->I.alicemaxconfirms,swap->I.bobmaxconfirms); + return(-1); + } } if ( (swap->I.otherstrust= data[len++]) != 0 ) { @@ -771,7 +784,7 @@ void LP_bobloop(void *_swap) else m = swap->I.aliceconfirms; while ( (n= LP_numconfirms(swap->alicecoin.symbol,swap->alicepayment.I.destaddr,swap->alicepayment.I.signedtxid,0,1)) < m ) // sync with alice { - char str[65];printf("%d waiting for alicepayment %s to be confirmed.%d %s %s\n",n,swap->alicepayment.I.destaddr,1,swap->alicecoin.symbol,bits256_str(str,swap->alicepayment.I.signedtxid)); + char str[65];printf("%d waiting for alicepayment %s to be confirmed.%d %s %s\n",n,swap->alicepayment.I.destaddr,m,swap->alicecoin.symbol,bits256_str(str,swap->alicepayment.I.signedtxid)); sleep(3); } if ( LP_swapdata_rawtxsend(swap->N.pair,swap,0x8000,data,maxlen,&swap->bobpayment,0x4000,0) == 0 ) @@ -826,7 +839,7 @@ void LP_aliceloop(void *_swap) else m = swap->I.aliceconfirms; while ( (n= LP_numconfirms(swap->alicecoin.symbol,swap->alicepayment.I.destaddr,swap->alicepayment.I.signedtxid,0,1)) < m ) { - char str[65];printf("%d waiting for alicepayment %s to be confirmed.%d %s %s\n",n,swap->alicepayment.I.destaddr,1,swap->alicecoin.symbol,bits256_str(str,swap->alicepayment.I.signedtxid)); + char str[65];printf("%d waiting for alicepayment %s to be confirmed.%d %s %s\n",n,swap->alicepayment.I.destaddr,m,swap->alicecoin.symbol,bits256_str(str,swap->alicepayment.I.signedtxid)); sleep(10); } swap->sentflag = 1; @@ -1053,6 +1066,22 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.bobconfirms = BASILISK_DEFAULT_NUMCONFIRMS; swap->I.aliceconfirms = BASILISK_DEFAULT_NUMCONFIRMS; } + if ( swap->bobcoin.isassetchain != 0 ) + swap->I.bobconfirms = 1; + if ( swap->alicecoin.isassetchain != 0 ) + swap->I.aliceconfirms = 1; + if ( swap->bobcoin.userconfirms > 0 ) + swap->I.bobconfirms = swap->bobcoin.userconfirms; + if ( swap->alicecoin.userconfirms > 0 ) + swap->I.aliceconfirms = swap->alicecoin.userconfirms; + if ( (swap->I.bobmaxconfirms= swap->bobcoin.maxconfirms) == 0 ) + swap->I.bobmaxconfirms = BASILISK_DEFAULT_MAXCONFIRMS; + if ( (swap->I.alicemaxconfirms= swap->alicecoin.maxconfirms) == 0 ) + swap->I.alicemaxconfirms = BASILISK_DEFAULT_MAXCONFIRMS; + if ( swap->I.bobconfirms > swap->I.bobmaxconfirms ) + swap->I.bobconfirms = swap->I.bobmaxconfirms; + if ( swap->I.aliceconfirms > swap->I.alicemaxconfirms ) + swap->I.aliceconfirms = swap->I.alicemaxconfirms; swap->I.bobconfirms *= !swap->I.bobistrusted; swap->I.aliceconfirms *= !swap->I.aliceistrusted; printf(">>>>>>>>>> jumblrflag.%d <<<<<<<<< use smart address, %.8f bobconfs.%d, %.8f aliceconfs.%d taddr.%d %d\n",jumblrflag,dstr(swap->I.bobsatoshis),swap->I.bobconfirms,dstr(swap->I.alicesatoshis),swap->I.aliceconfirms,swap->bobcoin.taddr,swap->alicecoin.taddr); diff --git a/iguana/exchanges/setconfirms b/iguana/exchanges/setconfirms new file mode 100755 index 000000000..78905f158 --- /dev/null +++ b/iguana/exchanges/setconfirms @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"setconfirms\",\"coin\":\"REVS\",\"numconfirms\":1}" diff --git a/iguana/exchanges/trust b/iguana/exchanges/trust new file mode 100755 index 000000000..6461f04c7 --- /dev/null +++ b/iguana/exchanges/trust @@ -0,0 +1,4 @@ +#!/bin/bash +echo "usage: ./trust " +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"pubkey\":\"$1\",\"method\":\"trust\",\"trust\":1}" From e24f80f45be10d1e4b4fd6012cd159bcfa866282 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 17:36:35 +0300 Subject: [PATCH 211/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index fabe55958..205b98f67 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -160,7 +160,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock, if ( duplicate != 0 ) dup++; else uniq++; - if ( (rand() % 1000) == 0 ) + if ( (rand() % 10000) == 0 ) printf("%s dup.%d (%u / %u) %.1f%% encrypted.%d recv.%u [%02x %02x] vs %02x %02x\n",typestr,duplicate,dup,dup+uniq,(double)100*dup/(dup+uniq),encrypted,crc32,ptr[0],ptr[1],crc32&0xff,(crc32>>8)&0xff); if ( duplicate == 0 ) { From 4fc0c3f18b78eec8a4b315a8165ed2346b19b0b8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 18:00:34 +0300 Subject: [PATCH 212/346] Test --- iguana/exchanges/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/install b/iguana/exchanges/install index db8330603..08c054a29 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,5 @@ #!/bin/bash -cp balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status utxos ../dexscripts +cp setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status utxos ../dexscripts cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass . From 46326bf42bf50047770098c076ff28e4cffacc08 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 18:18:19 +0300 Subject: [PATCH 213/346] Nonce --- iguana/exchanges/LP_commands.c | 7 ++++--- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_ordermatch.c | 12 +++++++++--- iguana/exchanges/LP_portfolio.c | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 5a76fc503..157294820 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -104,7 +104,8 @@ enable(coin)\n\ disable(coin)\n\ inventory(coin)\n\ bestfit(rel, relvolume)\n\ -buy(base, rel, price, relvolume, timeout=10, duration=3600)\n\ +buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\n\ +sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\n\ swapstatus()\n\ swapstatus(requestid, quoteid)\n\ public API:\n \ @@ -233,14 +234,14 @@ dividends(coin, height, )\n\ { if ( price > SMALLVAL ) { - return(LP_autobuy(ctx,myipaddr,pubsock,base,rel,price,jdouble(argjson,"relvolume"),jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"))); + return(LP_autobuy(ctx,myipaddr,pubsock,base,rel,price,jdouble(argjson,"relvolume"),jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"))); } else return(clonestr("{\"error\":\"no price set\"}")); } else if ( strcmp(method,"sell") == 0 ) { if ( price > SMALLVAL ) { - return(LP_autobuy(ctx,myipaddr,pubsock,rel,base,1./price,jdouble(argjson,"basevolume"),jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"))); + return(LP_autobuy(ctx,myipaddr,pubsock,rel,base,1./price,jdouble(argjson,"basevolume"),jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"))); } else return(clonestr("{\"error\":\"no price set\"}")); } } diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 205b98f67..75e020d50 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -47,6 +47,7 @@ char *default_LPnodes[] = { "5.9.253.195", "5.9.253.196", "5.9.253.197", "5.9.25 //uint32_t LP_deadman_switch; uint16_t LP_fixed_pairport,LP_publicport; +uint32_t LP_lastnonce; int32_t LP_mybussock = -1; int32_t LP_mypubsock = -1; int32_t LP_mypullsock = -1; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 5ff3cf7e4..20d927bff 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1024,10 +1024,16 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i return(bestutxo); } -char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel,double maxprice,double relvolume,int32_t timeout,int32_t duration,char *gui) +char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel,double maxprice,double relvolume,int32_t timeout,int32_t duration,char *gui,uint32_t nonce) { - uint64_t desttxfee,txfee; int32_t i,maxiters,numpubs = 0; int64_t bestsatoshis=0,destsatoshis,bestdestsatoshis=0; struct LP_utxoinfo *autxo,*bestutxo = 0; double qprice,ordermatchprice=0.; struct LP_quoteinfo Q; bits256 pubkeys[100]; - printf("LP_autobuy %s/%s price %.8f vol %.8f\n",base,rel,maxprice,relvolume); + uint64_t desttxfee,txfee; uint32_t lastnonce; int32_t i,maxiters,numpubs = 0; int64_t bestsatoshis=0,destsatoshis,bestdestsatoshis=0; struct LP_utxoinfo *autxo,*bestutxo = 0; double qprice,ordermatchprice=0.; struct LP_quoteinfo Q; bits256 pubkeys[100]; + printf("LP_autobuy %s/%s price %.8f vol %.8f nonce %u\n",base,rel,maxprice,relvolume,nonce); + if ( (lastnonce= LP_lastnonce) != 0 && nonce <= lastnonce ) + { + printf("nonce.%u not bigger than lastnonce.%u\n",nonce,lastnonce); + return(clonestr("{\"error\":\"invalid nonce\"}")); + } + LP_lastnonce = nonce; if ( duration <= 0 ) duration = LP_ORDERBOOK_DURATION; if ( timeout <= 0 ) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 80ce16c7b..75e8fd330 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -441,7 +441,7 @@ int32_t LP_portfolio_trade(void *ctx,uint32_t *requestidp,uint32_t *quoteidp,str break; if ( LP_utxo_bestfit(sell->symbol,SATOSHIDEN * relvolume) != 0 ) { - if ( (retstr2= LP_autobuy(ctx,"127.0.0.1",-1,buy->symbol,sell->symbol,maxprice,relvolume,60,24*3600,gui)) != 0 ) + if ( (retstr2= LP_autobuy(ctx,"127.0.0.1",-1,buy->symbol,sell->symbol,maxprice,relvolume,60,24*3600,gui,LP_lastnonce+1)) != 0 ) { if ( (retjson2= cJSON_Parse(retstr2)) != 0 ) { From df78d5e3f3aee04310c79222fd74887f1edb139b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 18:45:17 +0300 Subject: [PATCH 214/346] Test --- iguana/exchanges/LP_commands.c | 4 ++++ iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/install | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 157294820..fb7d6d0cb 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -277,6 +277,10 @@ dividends(coin, height, )\n\ ptr->inactive = 0; return(jprint(LP_electrumserver(ptr,jstr(argjson,"ipaddr"),juint(argjson,"port")),1)); } else return(clonestr("{\"error\":\"cant find coind\"}")); + } + else if ( strcmp(method,"withdraw") == 0 ) + { + } else if ( strcmp(method,"setconfirms") == 0 ) { diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 75e020d50..da2bed08e 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -23,7 +23,7 @@ // withdraw // verify portfolio // stats, fix pricearray -// dPoW security and zeroconf +// dPoW security -> 2: KMD notarized, 3: BTC notarized // electrum peers diff --git a/iguana/exchanges/install b/iguana/exchanges/install index 08c054a29..2aace6b1d 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,5 @@ #!/bin/bash -cp setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status utxos ../dexscripts +cp setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass . From 03375ac2f29c59ee896bbe11d548489126e5b1f2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 19:39:49 +0300 Subject: [PATCH 215/346] Test --- iguana/exchanges/LP_commands.c | 8 +++++++- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 7 +++---- iguana/exchanges/LP_ordermatch.c | 12 +++++++----- iguana/exchanges/LP_remember.c | 6 +++--- iguana/exchanges/LP_transaction.c | 30 +++++++++++++++++++++++++++--- iguana/exchanges/LP_utxo.c | 2 +- iguana/exchanges/LP_utxos.c | 4 ++-- 8 files changed, 51 insertions(+), 20 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index fb7d6d0cb..39199cc42 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -106,6 +106,7 @@ inventory(coin)\n\ bestfit(rel, relvolume)\n\ buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\n\ sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\n\ +withdraw(coin, outputs[])\n\ swapstatus()\n\ swapstatus(requestid, quoteid)\n\ public API:\n \ @@ -280,7 +281,12 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"withdraw") == 0 ) { - + if ( (ptr= LP_coinsearch(coin)) != 0 ) + { + if ( jobj(argjson,"outputs") == 0 ) + return(clonestr("{\"error\":\"withdraw needs to have outputs\"}")); + else return(LP_withdraw(ptr,argjson)); + } else return(clonestr("{\"error\":\"cant find coind\"}")); } else if ( strcmp(method,"setconfirms") == 0 ) { diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 3eebf220a..2cf2e8fc0 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -303,7 +303,7 @@ int32_t LP_reserved_msg(char *base,char *rel,bits256 pubkey,char *msg); struct iguana_info *LP_coinfind(char *symbol); int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32); char *LP_pricepings(void *ctx,char *myipaddr,int32_t pubsock,char *base,char *rel,double price); -uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee); +uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee,int32_t txlen); struct LP_address *_LP_address(struct iguana_info *coin,char *coinaddr); struct LP_address *_LP_addressfind(struct iguana_info *coin,char *coinaddr); struct LP_address *_LP_addressadd(struct iguana_info *coin,char *coinaddr); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index da2bed08e..fc8885984 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,12 +19,11 @@ // LP_nativeDEX.c // marketmaker // -// sign packets // withdraw -// verify portfolio -// stats, fix pricearray +// stats +// sign critical api calls // dPoW security -> 2: KMD notarized, 3: BTC notarized -// electrum peers +// verify portfolio and pricearray #include diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 20d927bff..c7cffdaa3 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -19,18 +19,20 @@ // marketmaker // -uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee) +uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee,int32_t txlen) { if ( coin != 0 ) { if ( strcmp(coin->symbol,"BTC") == 0 ) { + if ( txlen == 0 ) + txlen = LP_AVETXSIZE; coin->rate = LP_getestimatedrate(coin); - if ( (txfee= SATOSHIDEN * coin->rate * LP_AVETXSIZE) <= LP_MIN_TXFEE ) + if ( (txfee= SATOSHIDEN * coin->rate * txlen) <= LP_MIN_TXFEE ) { coin->rate = -1.; coin->rate = _LP_getestimatedrate(coin); - if ( (txfee= SATOSHIDEN * coin->rate * LP_AVETXSIZE) <= LP_MIN_TXFEE ) + if ( (txfee= SATOSHIDEN * coin->rate * txlen) <= LP_MIN_TXFEE ) txfee = LP_MIN_TXFEE; } } else txfee = coin->txfee; @@ -42,8 +44,8 @@ uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee) void LP_txfees(uint64_t *txfeep,uint64_t *desttxfeep,char *base,char *rel) { - *txfeep = LP_txfeecalc(LP_coinfind(base),0); - *desttxfeep = LP_txfeecalc(LP_coinfind(rel),0); + *txfeep = LP_txfeecalc(LP_coinfind(base),0,0); + *desttxfeep = LP_txfeecalc(LP_coinfind(rel),0,0); printf("LP_txfees(%.8f %.8f)\n",dstr(*txfeep),dstr(*desttxfeep)); } diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 5953151ff..01f7bb20a 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -856,13 +856,13 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti srcAdest = srcBdest = destAdest = destBdest = 0; if ( rswap.bobcoin[0] == 0 || rswap.alicecoin[0] == 0 || strcmp(rswap.bobcoin,rswap.src) != 0 || strcmp(rswap.alicecoin,rswap.dest) != 0 ) { - printf("BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest); + printf("legacy DB SWAPS files BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest); return(cJSON_Parse("{\"error\":\"mismatched bob/alice vs src/dest coins??\"}")); } alice = LP_coinfind(rswap.alicecoin); bob = LP_coinfind(rswap.bobcoin); - rswap.Atxfee = LP_txfeecalc(alice,rswap.Atxfee); - rswap.Btxfee = LP_txfeecalc(bob,rswap.Btxfee); + rswap.Atxfee = LP_txfeecalc(alice,rswap.Atxfee,0); + rswap.Btxfee = LP_txfeecalc(bob,rswap.Btxfee,0); if ( rswap.iambob == 0 ) { if ( alice != 0 ) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 95ce5fcb0..5213c3897 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -724,9 +724,34 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch return(signedtx); } +/*char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) +{ + int32_t iter,i,datalen; char changeaddr[64],*signedtx=0; cJSON *retjson; bits256 signedtxid; uint64_t txfee,newtxfee=10000; + txfee = coin->txfee; + if ( txfee > 0 && txfee < 10000 ) + txfee = 10000; + retjson = cJSON_CreateObject(); + safecopy(changeaddr,coin->smartaddr,sizeof(changeaddr)); + for (iter=0; iter<2; iter++) + { + if ( (signedtx= basilisk_swap_bobtxspend(&signedtxid,iter == 0 ? txfee : newtxfee,str,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->wiftype,ctx,privkey,0,0,0,0,0,rawtx->utxotxid,rawtx->utxovout,rawtx->I.destaddr,pubkey33,1,0,&destamount,rawtx->I.amount,changeaddr,vinaddr,rawtx->I.suppress_pubkeys)) != 0 ) + { + datalen = (int32_t)strlen(signedtx) / 2; + if ( strcmp(coin->symbol,"BTC") == 0 ) + { + newtxfee = LP_txfeecalc(coin,0,datalen); + printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee)); + } else break; + } else break; + if ( strcmp(str,"myfee") == 0 ) + break; + } + return(jprint(retjson,1)); +}*/ + int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pubkey33,int32_t iambob,int32_t lockinputs,struct basilisk_rawtx *rawtx,uint32_t locktime,uint8_t *script,int32_t scriptlen,int64_t txfee,int32_t minconf,int32_t delay,bits256 privkey,uint8_t *changermd160,char *vinaddr) { - int32_t retval=-1,len,iter; char *signedtx,*changeaddr = 0,_changeaddr[64]; struct iguana_info *coin; int64_t newtxfee=0,destamount; + int32_t retval=-1,iter; char *signedtx,*changeaddr = 0,_changeaddr[64]; struct iguana_info *coin; int64_t newtxfee=0,destamount; char str2[65]; printf("%s rawtxgen.(%s/v%d)\n",rawtx->name,bits256_str(str2,rawtx->utxotxid),rawtx->utxovout); if ( (coin= rawtx->coin) == 0 ) return(-1); @@ -753,8 +778,7 @@ int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pub free(signedtx); if ( strcmp(coin->symbol,"BTC") != 0 ) return(retval); - len = rawtx->I.datalen; - newtxfee = LP_txfeecalc(coin,0); + newtxfee = LP_txfeecalc(coin,0,rawtx->I.datalen); printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee)); } else break; if ( strcmp(str,"myfee") == 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b1641292f..cdbf09bec 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -828,7 +828,7 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol return(-2); if ( (up= LP_address_utxofind(coin,destaddr,txid2,vout2)) != 0 && up->spendheight > 0 ) return(-3); - txfee = LP_txfeecalc(LP_coinfind(symbol),0); + txfee = LP_txfeecalc(LP_coinfind(symbol),0,0); if ( val >= satoshis && val > (1+LP_MINSIZE_TXFEEMULT)*txfee ) { threshold = (iambob != 0) ? LP_DEPOSITSATOSHIS(satoshis) : (LP_DEXFEE(satoshis) + txfee); diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index e98e1f878..b0da0da76 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -312,7 +312,7 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,char *symbol,bits256 txid,int32_t //printf("LP_utxoadd reject inactive %s\n",symbol); return(0); } - txfee = LP_txfeecalc(coin,0); + txfee = LP_txfeecalc(coin,0,0); if ( iambob != 0 && value2 < 9 * (value >> 3) + 2*txfee ) // big txfee padding { if ( value2 > 2*txfee ) @@ -522,7 +522,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri LP_listunspent_issue(coin->symbol,coin->smartaddr,0); if ( coin->inactive == 0 && (array= LP_listunspent(coin->symbol,coin->smartaddr)) != 0 ) { - txfee = LP_txfeecalc(coin,0); + txfee = LP_txfeecalc(coin,0,0); if ( is_cJSON_Array(array) != 0 && (n= cJSON_GetArraySize(array)) > 0 ) { //printf("LP_privkey_init %s %s\n",coin->symbol,jprint(array,0)); From 6be7bbffc1f6afb860df09fdc39e521f3e639bbb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 19:40:40 +0300 Subject: [PATCH 216/346] Test --- iguana/exchanges/LP_commands.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 39199cc42..239ab6e6b 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -285,8 +285,9 @@ dividends(coin, height, )\n\ { if ( jobj(argjson,"outputs") == 0 ) return(clonestr("{\"error\":\"withdraw needs to have outputs\"}")); - else return(LP_withdraw(ptr,argjson)); - } else return(clonestr("{\"error\":\"cant find coind\"}")); + //else return(LP_withdraw(ptr,argjson)); + } + return(clonestr("{\"error\":\"cant find coind\"}")); } else if ( strcmp(method,"setconfirms") == 0 ) { From 009ea85c3f277e4e7cb9a055e7d359e999652081 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:05:47 +0300 Subject: [PATCH 217/346] Withdraw --- iguana/exchanges/LP_commands.c | 15 +- iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_network.c | 2 +- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_rpc.c | 22 ++- iguana/exchanges/LP_transaction.c | 247 +++++++++++++++++++++++++++++- iguana/exchanges/install | 2 +- iguana/exchanges/register | 3 - iguana/exchanges/registerall | 4 - iguana/exchanges/withdraw | 3 + 10 files changed, 281 insertions(+), 20 deletions(-) delete mode 100755 iguana/exchanges/register delete mode 100755 iguana/exchanges/registerall create mode 100755 iguana/exchanges/withdraw diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 239ab6e6b..3c8ae9cf8 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -104,9 +104,11 @@ enable(coin)\n\ disable(coin)\n\ inventory(coin)\n\ bestfit(rel, relvolume)\n\ +lastnonce()\n\ buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\n\ sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\n\ withdraw(coin, outputs[])\n\ +sendrawtransaction(coin, signedtx)\n\ swapstatus()\n\ swapstatus(requestid, quoteid)\n\ public API:\n \ @@ -279,13 +281,17 @@ dividends(coin, height, )\n\ return(jprint(LP_electrumserver(ptr,jstr(argjson,"ipaddr"),juint(argjson,"port")),1)); } else return(clonestr("{\"error\":\"cant find coind\"}")); } + else if ( strcmp(method,"sendrawtransaction") == 0 ) + { + return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx"))); + } else if ( strcmp(method,"withdraw") == 0 ) { if ( (ptr= LP_coinsearch(coin)) != 0 ) { if ( jobj(argjson,"outputs") == 0 ) return(clonestr("{\"error\":\"withdraw needs to have outputs\"}")); - //else return(LP_withdraw(ptr,argjson)); + else return(LP_withdraw(ptr,argjson)); } return(clonestr("{\"error\":\"cant find coind\"}")); } @@ -359,6 +365,13 @@ dividends(coin, height, )\n\ return(basilisk_swapentry(requestid,quoteid)); else return(basilisk_swaplist(0,0)); } + else if ( strcmp(method,"lastnonce") == 0 ) + { + cJSON *retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddnum(retjson,"lastnonce",LP_lastnonce); + return(jprint(retjson,1)); + } else if ( strcmp(method,"myprices") == 0 ) return(LP_myprices()); else if ( strcmp(method,"trust") == 0 ) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 2cf2e8fc0..b816be396 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -332,5 +332,6 @@ struct LP_utxoinfo *_LP_utxofind(int32_t iambob,bits256 txid,int32_t vout); struct LP_utxoinfo *_LP_utxo2find(int32_t iambob,bits256 txid,int32_t vout); void LP_listunspent_query(char *symbol,char *coinaddr); +int32_t bitcoin_priv2wif(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8_t addrtype); #endif diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 961f36ef3..080400f5d 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -171,7 +171,7 @@ void queue_loop(void *ignore) if ( duplicate > 0 ) { LP_Qfound++; - if ( (LP_Qfound % 10) == 0 ) + if ( (LP_Qfound % 100) == 0 ) printf("found.%u Q.%d err.%d match.%d\n",ptr->crc32,LP_Qenqueued,LP_Qerrors,LP_Qfound); flag = 1; } diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index c7cffdaa3..7c2bc6f69 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -904,7 +904,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, { if ( LP_isavailable(butxo) > 0 ) { - butxo->T.swappending = Q.timestamp + LP_RESERVETIME; + autxo->T.swappending = butxo->T.swappending = Q.timestamp + LP_RESERVETIME; retjson = LP_quotejson(&Q); butxo->S.otherpubkey = jbits256(argjson,"desthash"); LP_unavailableset(butxo,butxo->S.otherpubkey); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 1ebceefeb..ed1f832cd 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -419,6 +419,24 @@ int32_t LP_address_ismine(char *symbol,char *address) return(doneflag); } +int32_t LP_address_isvalid(char *symbol,char *address) +{ + int32_t isvalid = 0; cJSON *retjson; + if ( symbol == 0 || symbol[0] == 0 ) + return(0); + if ( (retjson= LP_validateaddress(symbol,address)) != 0 ) + { + if ( jobj(retjson,"isvalid") != 0 && is_cJSON_True(jobj(retjson,"isvalid")) != 0 ) + { + isvalid = 1; + //printf("%s ismine (%s)\n",address,jprint(retjson,0)); + } + //printf("%s\n",jprint(retjson,0)); + free_json(retjson); + } + return(isvalid); +} + cJSON *LP_listunspent(char *symbol,char *coinaddr) { char buf[128]; cJSON *retjson; struct iguana_info *coin; @@ -612,9 +630,9 @@ double LP_getestimatedrate(struct iguana_info *coin) char *LP_sendrawtransaction(char *symbol,char *signedtx) { cJSON *array,*errobj; char *paramstr,*tmpstr,*retstr=0; int32_t n,alreadyflag = 0; cJSON *retjson; struct iguana_info *coin; - if ( symbol == 0 || symbol[0] == 0 ) + if ( symbol == 0 || symbol[0] == 0 || signedtx == 0 || signedtx[0] == 0 ) { - printf("LP_sendrawtransaction null symbol\n"); + printf("LP_sendrawtransaction null symbol %p or signedtx.%p\n",symbol,signedtx); return(0); } coin = LP_coinfind(symbol); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 5213c3897..f7b7ead7f 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -724,18 +724,244 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch return(signedtx); } -/*char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) +int32_t LP_vin_select(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *belowp,struct LP_address_utxo **utxos,int32_t numunspents,uint64_t value,int32_t maxmode) { - int32_t iter,i,datalen; char changeaddr[64],*signedtx=0; cJSON *retjson; bits256 signedtxid; uint64_t txfee,newtxfee=10000; + int32_t i,abovei,belowi; int64_t above,below,gap,atx_value; + abovei = belowi = -1; + for (above=below=i=0; iU.value) <= 0 ) + { + //printf("illegal value.%d\n",i); + continue; + } + if ( atx_value == value ) + { + *aboveip = *belowip = i; + *abovep = *belowp = 0; + return(i); + } + else if ( atx_value > value ) + { + gap = (atx_value - value); + if ( above == 0 || gap < above ) + { + above = gap; + abovei = i; + } + } else gap = (value - atx_value); + if ( below == 0 || gap < below ) + { + below = gap; + belowi = i; + } + } + *aboveip = abovei; + *abovep = above; + *belowip = belowi; + *belowp = below; + //printf("above.%d below.%d\n",abovei,belowi); + return(abovei >= 0 && above < (below>>1) ? abovei : belowi); +} + +cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr) +{ + cJSON *sobj,*item = cJSON_CreateObject(); + jaddbits256(item,"txid",txid); + jaddnum(item,"vout",vout); + sobj = cJSON_CreateObject(); + jaddstr(sobj,"hex",spendscriptstr); + jadd(item,"scriptPubKey",sobj); + return(item); +} + +int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_t amount,struct vin_info *V,struct LP_address_utxo **utxos,int32_t numunspents,int32_t suppress_pubkeys,int32_t ignore_cltverr,bits256 privkey,cJSON *privkeys,cJSON *vins,uint8_t *script,int32_t scriptlen) +{ + char wifstr[128],spendscriptstr[128]; int32_t i,n,ind,abovei,belowi,maxmode=0; struct vin_info *vp; struct LP_address_utxo *up; int64_t above,below,remains = amount,total = 0; + *totalp = 0; + init_hexbytes_noT(spendscriptstr,script,scriptlen); + bitcoin_priv2wif(coin->wiftaddr,wifstr,privkey,coin->wiftype); + for (i=n=0; i= 0 ) + ind = abovei; + else ind = belowi; + if ( ind < 0 ) + { + printf("error finding unspent i.%d of %d, %.8f vs %.8f, abovei.%d belowi.%d ind.%d\n",i,numunspents,dstr(remains),dstr(amount),abovei,belowi,ind); + return(0); + } + up = utxos[ind]; + utxos[ind] = utxos[--numunspents]; + utxos[numunspents] = 0; + total += up->U.value; + remains -= up->U.value; + if ( remains <= 0 ) + break; + if ( numunspents == 0 ) + { + printf("total %.8f not enough for amount %.8f\n",dstr(total),dstr(amount)); + return(0); + } + vp = &V[n++]; + vp->N = vp->M = 1; + vp->signers[0].privkey = privkey; + jaddistr(privkeys,wifstr); + bitcoin_pubkey33(ctx,vp->signers[0].pubkey,privkey); + vp->suppress_pubkeys = suppress_pubkeys; + vp->ignore_cltverr = ignore_cltverr; + jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); + //printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains)); + } + *totalp = total; + return(n); +} + +char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys) +{ + static void *ctx; + cJSON *txobj,*item; uint8_t addrtype,rmd160[20],script[64],spendscript[64]; char *coinaddr,*rawtxbytes; bits256 txid; uint32_t timestamp,locktime; int64_t change=0,adjust=0,total,value,amount = 0; int32_t i,scriptlen,spendlen,suppress_pubkeys,ignore_cltverr,numvouts=0,numvins=0,numutxos=0; struct LP_address_utxo *utxos[256]; struct LP_address *ap; + if ( ctx == 0 ) + ctx = bitcoin_ctx(); + *numvinsp = 0; + if ( sizeof(utxos)/sizeof(*utxos) != max ) + { + printf("LP_createrawtransaction: internal error %ld != max.%d\n",sizeof(utxos)/sizeof(*utxos),max); + return(0); + } + if ( coin == 0 || outputs == 0 || (numvouts= cJSON_GetArraySize(outputs)) <= 0 ) + { + printf("LP_createrawtransaction: illegal coin.%p outputs.%p or arraysize.%d, error\n",coin,outputs,numvouts); + return(0); + } + for (i=0; isymbol,coinaddr) <= 0 ) + { + printf("LP_createrawtransaction %s i.%d of %d is invalid\n",coinaddr,i,numvouts); + return(0); + } + if ( (value= j64bits(item,coinaddr)) <= 0 ) + { + printf("cant get value %s i.%d of %d %s\n",coinaddr,i,numvouts,jprint(outputs,0)); + return(0); + } + amount += value; + } + else + { + printf("cant get fieldname.%d of %d %s\n",i,numvouts,jprint(outputs,0)); + return(0); + } + } + LP_listunspent_issue(coin->symbol,coin->smartaddr,1); + if ( (ap= LP_addressfind(coin,coin->smartaddr)) == 0 ) + { + printf("LP_createrawtransaction: cant find address data\n"); + return(0); + } + memset(utxos,0,sizeof(utxos)); + if ( (numutxos= LP_address_utxo_ptrs(0,utxos,max,ap)) <= 0 ) + { + printf("LP_createrawtransaction: address_utxo_ptrs %d, error\n",numutxos); + return(0); + } + ignore_cltverr = 0; + suppress_pubkeys = 1; + scriptlen = bitcoin_standardspend(script,0,G.LP_myrmd160); + numvins = LP_vins_select(ctx,coin,&total,amount,V,utxos,numutxos,suppress_pubkeys,ignore_cltverr,privkey,privkeys,vins,script,scriptlen); + change = (total - amount); + timestamp = (uint32_t)time(NULL); + if ( strcmp("KMD",coin->symbol) == 0 ) + locktime = timestamp - 777; + else locktime = 0; + txobj = bitcoin_txcreate(coin->symbol,coin->isPoS,locktime,1,timestamp); + jdelete(txobj,"vin"); + jadd(txobj,"vin",vins); + if ( change < 6000 ) + { + adjust = change / numvouts; + change = 0; + } + for (i=0; itaddr,&addrtype,rmd160,coinaddr); + spendlen = bitcoin_standardspend(spendscript,0,rmd160); + txobj = bitcoin_txoutput(txobj,spendscript,spendlen,value + adjust); + } + else + { + printf("cant get fieldname.%d of %d %s\n",i,numvouts,jprint(outputs,0)); + return(0); + } + } + if ( change != 0 ) + txobj = bitcoin_txoutput(txobj,script,scriptlen,change); + if ( (rawtxbytes= bitcoin_json2hex(coin->isPoS,&txid,txobj,V)) != 0 ) + { + } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); + free_json(privkeys); + free_json(txobj); + return(rawtxbytes); +} + +char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) +{ + static void *ctx; + int32_t iter,completed=0,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info V[256]; cJSON *retjson,*outputs,*vins,*privkeys; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; + if ( (outputs= jarray(&numvouts,argjson,"outputs")) == 0 ) + { + printf("no outputs in argjson (%s)\n",jprint(argjson,0)); + return(clonestr("{\"error\":\"no outputs specified\"}")); + } txfee = coin->txfee; + if ( ctx == 0 ) + ctx = bitcoin_ctx(); if ( txfee > 0 && txfee < 10000 ) txfee = 10000; - retjson = cJSON_CreateObject(); + suppress_pubkeys = 0; + memset(signedtxid.bytes,0,sizeof(signedtxid)); safecopy(changeaddr,coin->smartaddr,sizeof(changeaddr)); + safecopy(vinaddr,coin->smartaddr,sizeof(vinaddr)); + privkey = LP_privkey(vinaddr,coin->taddr); for (iter=0; iter<2; iter++) { - if ( (signedtx= basilisk_swap_bobtxspend(&signedtxid,iter == 0 ? txfee : newtxfee,str,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->wiftype,ctx,privkey,0,0,0,0,0,rawtx->utxotxid,rawtx->utxovout,rawtx->I.destaddr,pubkey33,1,0,&destamount,rawtx->I.amount,changeaddr,vinaddr,rawtx->I.suppress_pubkeys)) != 0 ) + privkeys = cJSON_CreateArray(); + vins = cJSON_CreateArray(); + memset(V,0,sizeof(V)); + if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,(int32_t)(sizeof(V)/sizeof(*V)),privkey,outputs,vins,privkeys)) != 0 ) { + completed = 0; + memset(&msgtx,0,sizeof(msgtx)); + memset(signedtxid.bytes,0,sizeof(signedtxid)); + if ( (completed= iguana_signrawtransaction(ctx,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->longestchain,&msgtx,&signedtx,&signedtxid,V,numvins,rawtx,vins,privkeys)) < 0 ) + printf("couldnt sign withdraw %s\n",bits256_str(str,signedtxid)); + else if ( completed == 0 ) + { + printf("incomplete signing withdraw (%s)\n",jprint(vins,0)); + if ( signedtx != 0 ) + free(signedtx), signedtx = 0; + } else printf("LP_withdraw %s -> %s\n",jprint(argjson,0),bits256_str(str,signedtxid)); datalen = (int32_t)strlen(signedtx) / 2; if ( strcmp(coin->symbol,"BTC") == 0 ) { @@ -743,11 +969,18 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee)); } else break; } else break; - if ( strcmp(str,"myfee") == 0 ) - break; + free(rawtx); + rawtx = 0; } + retjson = cJSON_CreateObject(); + if ( rawtx != 0 ) + jaddstr(retjson,"rawtx",rawtx); + if ( signedtx != 0 ) + jaddstr(retjson,"hex",signedtx); + jaddbits256(retjson,"txid",signedtxid); + jadd(retjson,"complete",completed!=0?jtrue():jfalse()); return(jprint(retjson,1)); -}*/ +} int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pubkey33,int32_t iambob,int32_t lockinputs,struct basilisk_rawtx *rawtx,uint32_t locktime,uint8_t *script,int32_t scriptlen,int64_t txfee,int32_t minconf,int32_t delay,bits256 privkey,uint8_t *changermd160,char *vinaddr) { diff --git a/iguana/exchanges/install b/iguana/exchanges/install index 2aace6b1d..c624028e4 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,5 @@ #!/bin/bash -cp setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts +cp setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass . diff --git a/iguana/exchanges/register b/iguana/exchanges/register deleted file mode 100755 index d00160beb..000000000 --- a/iguana/exchanges/register +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -source userpass -curl --url "http://5.9.253.195:7783" --data "{\"userpass\":\"9bb4846d24136fc7c33515e45bccbab5c8fb7b57b411aa20057b371da9358255\",\"agent\":\"stats\",\"method\":\"register\",\"client\":\"6d3332be4904feafd326609bd76b66528dc7b2e2d75a7bd110c6bf8d19c4cf58\",\"pushaddr\":\"5.9.253.195\",\"pushport\":\"10000\"}" diff --git a/iguana/exchanges/registerall b/iguana/exchanges/registerall deleted file mode 100755 index 927f0b2f9..000000000 --- a/iguana/exchanges/registerall +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"registerall\",\"numnodes\":10}" diff --git a/iguana/exchanges/withdraw b/iguana/exchanges/withdraw new file mode 100755 index 000000000..1de924634 --- /dev/null +++ b/iguana/exchanges/withdraw @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[\"iRUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001, \"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002]}" From 5fbff6abdd4ca4e5c28f8ec2abfaf3144b24e243 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:09:47 +0300 Subject: [PATCH 218/346] Test --- iguana/exchanges/LP_transaction.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index f7b7ead7f..33b8d167d 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -826,7 +826,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ return(n); } -char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys) +char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys,int64_t txfee) { static void *ctx; cJSON *txobj,*item; uint8_t addrtype,rmd160[20],script[64],spendscript[64]; char *coinaddr,*rawtxbytes; bits256 txid; uint32_t timestamp,locktime; int64_t change=0,adjust=0,total,value,amount = 0; int32_t i,scriptlen,spendlen,suppress_pubkeys,ignore_cltverr,numvouts=0,numvins=0,numutxos=0; struct LP_address_utxo *utxos[256]; struct LP_address *ap; @@ -843,6 +843,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct printf("LP_createrawtransaction: illegal coin.%p outputs.%p or arraysize.%d, error\n",coin,outputs,numvouts); return(0); } + amount = txfee; for (i=0; ismartaddr,sizeof(changeaddr)); safecopy(vinaddr,coin->smartaddr,sizeof(vinaddr)); privkey = LP_privkey(vinaddr,coin->taddr); + printf("LP_withdraw txfee %.8f\n",dstr(txfee)); for (iter=0; iter<2; iter++) { privkeys = cJSON_CreateArray(); vins = cJSON_CreateArray(); memset(V,0,sizeof(V)); - if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,(int32_t)(sizeof(V)/sizeof(*V)),privkey,outputs,vins,privkeys)) != 0 ) + if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,(int32_t)(sizeof(V)/sizeof(*V)),privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee)) != 0 ) { completed = 0; memset(&msgtx,0,sizeof(msgtx)); From f32efb44b909439efdf5d6583d704b1201e3ed77 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:33:49 +0300 Subject: [PATCH 219/346] Test --- iguana/exchanges/withdraw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/withdraw b/iguana/exchanges/withdraw index 1de924634..39d8dbfd7 100755 --- a/iguana/exchanges/withdraw +++ b/iguana/exchanges/withdraw @@ -1,3 +1,3 @@ #!/bin/bash source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[\"iRUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001, \"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002]}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[{\"iRUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001}, {\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002}]}" From 6127a49fd4743fe428f3445053403acf4f4a973c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:35:56 +0300 Subject: [PATCH 220/346] Test --- iguana/exchanges/LP_transaction.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 33b8d167d..3ca7b9bf2 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -847,6 +847,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct for (i=0; isymbol,coinaddr) <= 0 ) From a148d8d7750dd8eb94ff8e8071c691ab5440d43b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:40:18 +0300 Subject: [PATCH 221/346] Test --- iguana/exchanges/LP_transaction.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 3ca7b9bf2..cd1bbd31c 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -930,7 +930,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) { static void *ctx; - int32_t iter,completed=0,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info V[256]; cJSON *retjson,*outputs,*vins,*privkeys; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; + int32_t iter,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info *V; cJSON *retjson,*outputs,*vins,*privkeys; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; if ( (outputs= jarray(&numvouts,argjson,"outputs")) == 0 ) { printf("no outputs in argjson (%s)\n",jprint(argjson,0)); @@ -946,13 +946,15 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) safecopy(changeaddr,coin->smartaddr,sizeof(changeaddr)); safecopy(vinaddr,coin->smartaddr,sizeof(vinaddr)); privkey = LP_privkey(vinaddr,coin->taddr); - printf("LP_withdraw txfee %.8f\n",dstr(txfee)); + maxV = 256; + V = malloc(maxV * sizeof(*V)); + printf("LP_withdraw txfee %.8f sizeof V %ld\n",dstr(txfee),sizeof(*V)*maxV); for (iter=0; iter<2; iter++) { privkeys = cJSON_CreateArray(); vins = cJSON_CreateArray(); - memset(V,0,sizeof(V)); - if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,(int32_t)(sizeof(V)/sizeof(*V)),privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee)) != 0 ) + memset(V,0,sizeof(*V)*maxV); + if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,maxV,privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee)) != 0 ) { completed = 0; memset(&msgtx,0,sizeof(msgtx)); @@ -975,6 +977,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) free(rawtx); rawtx = 0; } + free(V); retjson = cJSON_CreateObject(); if ( rawtx != 0 ) jaddstr(retjson,"rawtx",rawtx); From efb8cf377486f863dc2521f640ab94dc8e3f06b1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:43:15 +0300 Subject: [PATCH 222/346] Test --- iguana/exchanges/LP_transaction.c | 4 ++-- iguana/exchanges/withdraw | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index cd1bbd31c..9f3e7319f 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -855,7 +855,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct printf("LP_createrawtransaction %s i.%d of %d is invalid\n",coinaddr,i,numvouts); return(0); } - if ( (value= j64bits(item,coinaddr)) <= 0 ) + if ( (value= SATOSHIDEN * jdouble(item,coinaddr)) <= 0 ) { printf("cant get value %s i.%d of %d %s\n",coinaddr,i,numvouts,jprint(outputs,0)); return(0); @@ -902,7 +902,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct item = jitem(outputs,i); if ( (coinaddr= jfieldname(item)) != 0 ) { - if ( (value= j64bits(item,coinaddr)) <= 0 ) + if ( (value= SATOSHIDEN * jdouble(item,coinaddr)) <= 0 ) { printf("cant get value i.%d of %d %s\n",i,numvouts,jprint(outputs,0)); return(0); diff --git a/iguana/exchanges/withdraw b/iguana/exchanges/withdraw index 39d8dbfd7..8a78fa5a1 100755 --- a/iguana/exchanges/withdraw +++ b/iguana/exchanges/withdraw @@ -1,3 +1,3 @@ #!/bin/bash source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[{\"iRUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001}, {\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002}]}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[{\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001}, {\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002}]}" From 1a2af79b0c79f53e5f23e4589a6bf3c172013d79 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:47:29 +0300 Subject: [PATCH 223/346] Test --- iguana/exchanges/LP_transaction.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 9f3e7319f..1051de01c 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -897,6 +897,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct adjust = change / numvouts; change = 0; } + printf("vins.(%s) privkeys.(%s)\n",jprint(vins,0),jprint(privkeys,0)); for (i=0; iisPoS,&txid,txobj,V)) != 0 ) { } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); @@ -967,6 +969,8 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) if ( signedtx != 0 ) free(signedtx), signedtx = 0; } else printf("LP_withdraw %s -> %s\n",jprint(argjson,0),bits256_str(str,signedtxid)); + if ( signedtx == 0 ) + break; datalen = (int32_t)strlen(signedtx) / 2; if ( strcmp(coin->symbol,"BTC") == 0 ) { From 0803f39e7cca545c7c273984de9e2c967bbf6fe1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Oct 2017 23:50:29 +0300 Subject: [PATCH 224/346] Test --- iguana/exchanges/LP_transaction.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 1051de01c..4fc3489b3 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -785,6 +785,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ bitcoin_priv2wif(coin->wiftaddr,wifstr,privkey,coin->wiftype); for (i=n=0; isuppress_pubkeys = suppress_pubkeys; vp->ignore_cltverr = ignore_cltverr; jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); + printf("i.%d privkeys.%s vins.%s\n",i,jprint(privkeys,0),jprint(vins,0)); //printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains)); } *totalp = total; @@ -897,7 +899,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct adjust = change / numvouts; change = 0; } - printf("vins.(%s) privkeys.(%s)\n",jprint(vins,0),jprint(privkeys,0)); + printf("numvins.%d vins.(%s) privkeys.(%s)\n",numvins,jprint(vins,0),jprint(privkeys,0)); for (i=0; i Date: Sun, 15 Oct 2017 23:53:24 +0300 Subject: [PATCH 225/346] Test --- iguana/exchanges/LP_transaction.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 4fc3489b3..3bc5e317d 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -774,6 +774,7 @@ cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr) sobj = cJSON_CreateObject(); jaddstr(sobj,"hex",spendscriptstr); jadd(item,"scriptPubKey",sobj); + printf("vin.%s\n",jprint(item,0)); return(item); } @@ -821,7 +822,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ vp->suppress_pubkeys = suppress_pubkeys; vp->ignore_cltverr = ignore_cltverr; jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); - printf("i.%d privkeys.%s vins.%s\n",i,jprint(privkeys,0),jprint(vins,0)); + printf("wif.%s i.%d privkeys.%s vins.%s %p %p\n",wifstr,i,jprint(privkeys,0),jprint(vins,0),privkeys,vins); //printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains)); } *totalp = total; @@ -899,7 +900,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct adjust = change / numvouts; change = 0; } - printf("numvins.%d vins.(%s) privkeys.(%s)\n",numvins,jprint(vins,0),jprint(privkeys,0)); + printf("numvins.%d vins.(%s) privkeys.(%s) %p %p\n",numvins,jprint(vins,0),jprint(privkeys,0),vins,privkeys); for (i=0; i Date: Sun, 15 Oct 2017 23:57:39 +0300 Subject: [PATCH 226/346] Test --- iguana/exchanges/LP_transaction.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 3bc5e317d..3c1ef3472 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -807,13 +807,6 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ utxos[numunspents] = 0; total += up->U.value; remains -= up->U.value; - if ( remains <= 0 ) - break; - if ( numunspents == 0 ) - { - printf("total %.8f not enough for amount %.8f\n",dstr(total),dstr(amount)); - return(0); - } vp = &V[n++]; vp->N = vp->M = 1; vp->signers[0].privkey = privkey; @@ -824,6 +817,13 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); printf("wif.%s i.%d privkeys.%s vins.%s %p %p\n",wifstr,i,jprint(privkeys,0),jprint(vins,0),privkeys,vins); //printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains)); + if ( remains <= 0 ) + break; + if ( numunspents == 0 ) + { + printf("total %.8f not enough for amount %.8f\n",dstr(total),dstr(amount)); + return(0); + } } *totalp = total; return(n); From e150f5d81125a3582cb6f5609312146e69979529 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:04:59 +0300 Subject: [PATCH 227/346] Test --- iguana/exchanges/LP_transaction.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 3c1ef3472..6ec336111 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -774,7 +774,7 @@ cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr) sobj = cJSON_CreateObject(); jaddstr(sobj,"hex",spendscriptstr); jadd(item,"scriptPubKey",sobj); - printf("vin.%s\n",jprint(item,0)); + //printf("vin.%s\n",jprint(item,0)); return(item); } @@ -786,7 +786,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ bitcoin_priv2wif(coin->wiftaddr,wifstr,privkey,coin->wiftype); for (i=n=0; isuppress_pubkeys = suppress_pubkeys; vp->ignore_cltverr = ignore_cltverr; jaddi(vins,LP_inputjson(up->U.txid,up->U.vout,spendscriptstr)); - printf("wif.%s i.%d privkeys.%s vins.%s %p %p\n",wifstr,i,jprint(privkeys,0),jprint(vins,0),privkeys,vins); + //printf("wif.%s i.%d privkeys.%s vins.%s %p %p\n",wifstr,i,jprint(privkeys,0),jprint(vins,0),privkeys,vins); //printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains)); if ( remains <= 0 ) break; @@ -850,7 +850,6 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct for (i=0; isymbol,coinaddr) <= 0 ) @@ -900,7 +899,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct adjust = change / numvouts; change = 0; } - printf("numvins.%d vins.(%s) privkeys.(%s) %p %p\n",numvins,jprint(vins,0),jprint(privkeys,0),vins,privkeys); + printf("numvins.%d vins.(%s) privkeys.(%s)\n",numvins,jprint(vins,0),jprint(privkeys,0)); for (i=0; iisPoS,&txid,txobj,V)) != 0 ) { } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); - free_json(privkeys); free_json(txobj); return(rawtxbytes); } @@ -953,12 +951,11 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) privkey = LP_privkey(vinaddr,coin->taddr); maxV = 256; V = malloc(maxV * sizeof(*V)); - printf("LP_withdraw txfee %.8f sizeof V %ld\n",dstr(txfee),sizeof(*V)*maxV); for (iter=0; iter<2; iter++) { privkeys = cJSON_CreateArray(); vins = cJSON_CreateArray(); - memset(V,0,sizeof(*V)*maxV); + memset(V,0,sizeof(*V) * maxV); if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,maxV,privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee)) != 0 ) { completed = 0; @@ -981,10 +978,13 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee)); } else break; } else break; - free(rawtx); - rawtx = 0; + free_json(privkeys), privkeys = 0; + if ( rawtx != 0 ) + free(rawtx), rawtx = 0; } free(V); + if ( privkeys != 0 ) + free_json(privkeys); retjson = cJSON_CreateObject(); if ( rawtx != 0 ) jaddstr(retjson,"rawtx",rawtx); From e35ac080847aff51d798f16eda4e83300e6956b9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:13:12 +0300 Subject: [PATCH 228/346] Test --- iguana/exchanges/LP_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 6ec336111..947e9e5dc 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -451,7 +451,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ } else fprintf(stderr,"no txobj from bitcoin_hex2json\n"); if ( (numinputs= cJSON_GetArraySize(vins)) > 0 ) { - //printf("numinputs.%d msgtx.%d\n",numinputs,msgtx->tx_in); + printf("numinputs.%d msgtx.%d\n",numinputs,msgtx->tx_in); memset(msgtx,0,sizeof(*msgtx)); if ( iguana_rwmsgtx(taddr,pubtype,p2shtype,isPoS,height,0,0,serialized,maxsize,msgtx,&txid,"",extraspace,extralen,vins,V->suppress_pubkeys) > 0 && numinputs == msgtx->tx_in ) { From dd7eff3175cd529920ead2382fec428438c03878 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:20:40 +0300 Subject: [PATCH 229/346] Test --- iguana/exchanges/LP_bitcoin.c | 18 +++++++++--------- iguana/exchanges/LP_transaction.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 20cc5858f..4f983ae67 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -3345,11 +3345,11 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is sigser = calloc(1,maxsize*2); //printf("json.%p array.%p sigser.%p\n",json,vinarray,sigser); } - //printf("version.%d\n",msg->version); +printf("version.%d\n",msg->version); if ( isPoS != 0 ) { len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->timestamp),&msg->timestamp); - //char str[65]; printf("version.%d timestamp.%08x %u %s\n",msg->version,msg->timestamp,msg->timestamp,utc_str(str,msg->timestamp)); +char str[65]; printf("version.%d timestamp.%08x %u %s\n",msg->version,msg->timestamp,msg->timestamp,utc_str(str,msg->timestamp)); if ( json != 0 ) jaddnum(json,"timestamp",msg->timestamp); } @@ -3370,7 +3370,7 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is } for (i=0; itx_in; i++) { - //printf("vin.%d starts offset.%d\n",i,len); +printf("vin.%d starts offset.%d\n",i,len); if ( vins != 0 && jitem(vins,i) != 0 ) iguana_vinobjset(&msg->vins[i],jitem(vins,i),spendscript,sizeof(spendscript)); if ( (n= iguana_vinparse(rwflag,&serialized[len],&msg->vins[i])) < 0 ) @@ -3378,7 +3378,7 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is //printf("serialized vin.[%02x %02x %02x]\n",serialized[len],serialized[len+1],serialized[len+2]); if ( msg->vins[i].spendscript == spendscript ) msg->vins[i].spendscript = 0; - //printf("vin.%d n.%d len.%d\n",i,n,len); +printf("vin.%d n.%d len.%d\n",i,n,len); len += n; if ( len > maxsize ) { @@ -3386,9 +3386,9 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is return(-1); } } - //for (i=-3; i<7; i++) - // printf("%02x",serialized[len+i]); - //printf(" prev 3 bytes before tx_out rw.%d\n",rwflag); + for (i=-3; i<7; i++) + printf("%02x",serialized[len+i]); + printf(" prev 3 bytes before tx_out rw.%d\n",rwflag); len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out); if ( rwflag == 0 ) { @@ -3408,7 +3408,7 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is } for (i=0; itx_out; i++) { - //printf("rwflag.%d vout.%d starts %d\n",rwflag,i,len); +printf("rwflag.%d vout.%d starts %d\n",rwflag,i,len); if ( (n= iguana_voutparse(rwflag,&serialized[len],&msg->vouts[i])) < 0 ) return(-1); len += n; @@ -3421,7 +3421,7 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is jaddi(voutarray,iguana_voutjson(taddr,pubtype,p2shtype,&msg->vouts[i],i,*txidp)); } len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->lock_time),&msg->lock_time); - //printf("lock_time.%08x len.%d\n",msg->lock_time,len); +printf("lock_time.%08x len.%d\n",msg->lock_time,len); /*if ( strcmp(coin->symbol,"VPN") == 0 ) { uint16_t ddosflag = 0; diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 947e9e5dc..5861b2d33 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -451,7 +451,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ } else fprintf(stderr,"no txobj from bitcoin_hex2json\n"); if ( (numinputs= cJSON_GetArraySize(vins)) > 0 ) { - printf("numinputs.%d msgtx.%d\n",numinputs,msgtx->tx_in); + printf("numinputs.%d (%s) msgtx.%d\n",numinputs,jprint(vins,0),msgtx->tx_in); memset(msgtx,0,sizeof(*msgtx)); if ( iguana_rwmsgtx(taddr,pubtype,p2shtype,isPoS,height,0,0,serialized,maxsize,msgtx,&txid,"",extraspace,extralen,vins,V->suppress_pubkeys) > 0 && numinputs == msgtx->tx_in ) { @@ -933,7 +933,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) { static void *ctx; - int32_t iter,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info *V; cJSON *retjson,*outputs,*vins,*privkeys; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; + int32_t iter,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info *V; cJSON *retjson,*outputs,*vins=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; if ( (outputs= jarray(&numvouts,argjson,"outputs")) == 0 ) { printf("no outputs in argjson (%s)\n",jprint(argjson,0)); From 90e09db8794f91273804aa51e735dbe1a6a4a209 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:28:06 +0300 Subject: [PATCH 230/346] Trusted --- iguana/exchanges/LP_commands.c | 2 ++ iguana/exchanges/LP_prices.c | 11 +++++++++++ iguana/exchanges/trusted | 3 +++ 3 files changed, 16 insertions(+) create mode 100755 iguana/exchanges/trusted diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 3c8ae9cf8..9d9a5febd 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -376,6 +376,8 @@ dividends(coin, height, )\n\ return(LP_myprices()); else if ( strcmp(method,"trust") == 0 ) return(LP_pubkey_trustset(jbits256(argjson,"pubkey"),jint(argjson,"trust"))); + else if ( strcmp(method,"trusted") == 0 ) + return(LP_pubkey_trusted()); } if ( IAMLP == 0 ) { diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 1fc8c64b6..c742decd2 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -221,6 +221,17 @@ char *LP_pubkey_trustset(bits256 pubkey,uint32_t trustval) return(clonestr("{\"error\":\"pubkey not found\"}")); } +char *LP_pubkey_trusted() +{ + struct LP_pubkeyinfo *pubp,*tmp; cJSON *array = cJSON_CreateArray(); + HASH_ITER(hh,LP_pubkeyinfos,pubp,tmp) + { + if ( pubp->istrusted != 0 ) + jaddibits256(array,pubp->pubkey); + } + return(jprint(array,1)); +} + uint64_t LP_unspents_metric(struct iguana_info *coin,char *coinaddr) { cJSON *array,*item; int32_t i,n; uint64_t metric=0,total; diff --git a/iguana/exchanges/trusted b/iguana/exchanges/trusted new file mode 100755 index 000000000..fe96516e2 --- /dev/null +++ b/iguana/exchanges/trusted @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"trusted\"}" From 453821bb8a99d15a0ed9c639d62bd81d8a8bcba1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:34:30 +0300 Subject: [PATCH 231/346] Test --- iguana/exchanges/LP_transaction.c | 3 ++- iguana/exchanges/install | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 5861b2d33..013b5d377 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -444,11 +444,12 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ extraspace = malloc(extralen); memset(msgtx,0,sizeof(*msgtx)); decode_hex(serialized,len,rawtx); - // printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); + printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); if ( (txobj= bitcoin_hex2json(taddr,pubtype,p2shtype,isPoS,height,&txid,msgtx,rawtx,extraspace,extralen,serialized4,vins,V->suppress_pubkeys)) != 0 ) { //printf("back from bitcoin_hex2json (%s)\n",jprint(vins,0)); } else fprintf(stderr,"no txobj from bitcoin_hex2json\n"); + printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); if ( (numinputs= cJSON_GetArraySize(vins)) > 0 ) { printf("numinputs.%d (%s) msgtx.%d\n",numinputs,jprint(vins,0),msgtx->tx_in); diff --git a/iguana/exchanges/install b/iguana/exchanges/install index c624028e4..561a3063e 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,5 @@ #!/bin/bash -cp setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts +cp trust trusted setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass . From d1dbe8001859a24836c35edffe8c7b6b580664b5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:36:28 +0300 Subject: [PATCH 232/346] Test --- iguana/exchanges/LP_transaction.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 013b5d377..a06e0517c 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -444,6 +444,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ extraspace = malloc(extralen); memset(msgtx,0,sizeof(*msgtx)); decode_hex(serialized,len,rawtx); + printf("vins.%p privkeys.%p\n",vins,privkeysjson); printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); if ( (txobj= bitcoin_hex2json(taddr,pubtype,p2shtype,isPoS,height,&txid,msgtx,rawtx,extraspace,extralen,serialized4,vins,V->suppress_pubkeys)) != 0 ) { From b02a0d14101ac1295339025b5b1d041d66bcdaa1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:42:08 +0300 Subject: [PATCH 233/346] Test --- iguana/exchanges/LP_transaction.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index a06e0517c..19e37b547 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -433,6 +433,8 @@ int64_t iguana_lockval(int32_t finalized,int64_t locktime) int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,struct iguana_msgtx *msgtx,char **signedtxp,bits256 *signedtxidp,struct vin_info *V,int32_t numinputs,char *rawtx,cJSON *vins,cJSON *privkeysjson) { uint8_t *serialized,*serialized2,*serialized3,*serialized4,*extraspace,pubkeys[64][33]; int32_t finalized,i,len,n,z,plen,maxsize,complete = 0,extralen = 100000; char *privkeystr,*signedtx = 0; bits256 privkeys[64],privkey,txid; cJSON *item; cJSON *txobj = 0; + printf("vins.%p privkeys.%p\n",vins,privkeysjson); + printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); maxsize = 1000000; memset(privkey.bytes,0,sizeof(privkey)); if ( rawtx != 0 && rawtx[0] != 0 && (len= (int32_t)strlen(rawtx)>>1) < maxsize ) @@ -444,8 +446,6 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ extraspace = malloc(extralen); memset(msgtx,0,sizeof(*msgtx)); decode_hex(serialized,len,rawtx); - printf("vins.%p privkeys.%p\n",vins,privkeysjson); - printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); if ( (txobj= bitcoin_hex2json(taddr,pubtype,p2shtype,isPoS,height,&txid,msgtx,rawtx,extraspace,extralen,serialized4,vins,V->suppress_pubkeys)) != 0 ) { //printf("back from bitcoin_hex2json (%s)\n",jprint(vins,0)); @@ -895,7 +895,7 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct else locktime = 0; txobj = bitcoin_txcreate(coin->symbol,coin->isPoS,locktime,1,timestamp); jdelete(txobj,"vin"); - jadd(txobj,"vin",vins); + jadd(txobj,"vin",jduplicate(vins)); if ( change < 6000 ) { adjust = change / numvouts; @@ -963,6 +963,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) completed = 0; memset(&msgtx,0,sizeof(msgtx)); memset(signedtxid.bytes,0,sizeof(signedtxid)); + printf("%p %p vins.(%s) privkeys.(%s)\n",vins,privkeys,jprint(vins,0),jprint(privkeys,0)); if ( (completed= iguana_signrawtransaction(ctx,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->longestchain,&msgtx,&signedtx,&signedtxid,V,numvins,rawtx,vins,privkeys)) < 0 ) printf("couldnt sign withdraw %s\n",bits256_str(str,signedtxid)); else if ( completed == 0 ) From 21ef9c284e7bd47f6d856e611ea524ea736296df Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:44:59 +0300 Subject: [PATCH 234/346] Test --- iguana/exchanges/LP_bitcoin.c | 18 +++++++++--------- iguana/exchanges/LP_transaction.c | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 4f983ae67..20cc5858f 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -3345,11 +3345,11 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is sigser = calloc(1,maxsize*2); //printf("json.%p array.%p sigser.%p\n",json,vinarray,sigser); } -printf("version.%d\n",msg->version); + //printf("version.%d\n",msg->version); if ( isPoS != 0 ) { len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->timestamp),&msg->timestamp); -char str[65]; printf("version.%d timestamp.%08x %u %s\n",msg->version,msg->timestamp,msg->timestamp,utc_str(str,msg->timestamp)); + //char str[65]; printf("version.%d timestamp.%08x %u %s\n",msg->version,msg->timestamp,msg->timestamp,utc_str(str,msg->timestamp)); if ( json != 0 ) jaddnum(json,"timestamp",msg->timestamp); } @@ -3370,7 +3370,7 @@ char str[65]; printf("version.%d timestamp.%08x %u %s\n",msg->version,msg->times } for (i=0; itx_in; i++) { -printf("vin.%d starts offset.%d\n",i,len); + //printf("vin.%d starts offset.%d\n",i,len); if ( vins != 0 && jitem(vins,i) != 0 ) iguana_vinobjset(&msg->vins[i],jitem(vins,i),spendscript,sizeof(spendscript)); if ( (n= iguana_vinparse(rwflag,&serialized[len],&msg->vins[i])) < 0 ) @@ -3378,7 +3378,7 @@ printf("vin.%d starts offset.%d\n",i,len); //printf("serialized vin.[%02x %02x %02x]\n",serialized[len],serialized[len+1],serialized[len+2]); if ( msg->vins[i].spendscript == spendscript ) msg->vins[i].spendscript = 0; -printf("vin.%d n.%d len.%d\n",i,n,len); + //printf("vin.%d n.%d len.%d\n",i,n,len); len += n; if ( len > maxsize ) { @@ -3386,9 +3386,9 @@ printf("vin.%d n.%d len.%d\n",i,n,len); return(-1); } } - for (i=-3; i<7; i++) - printf("%02x",serialized[len+i]); - printf(" prev 3 bytes before tx_out rw.%d\n",rwflag); + //for (i=-3; i<7; i++) + // printf("%02x",serialized[len+i]); + //printf(" prev 3 bytes before tx_out rw.%d\n",rwflag); len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out); if ( rwflag == 0 ) { @@ -3408,7 +3408,7 @@ printf("vin.%d n.%d len.%d\n",i,n,len); } for (i=0; itx_out; i++) { -printf("rwflag.%d vout.%d starts %d\n",rwflag,i,len); + //printf("rwflag.%d vout.%d starts %d\n",rwflag,i,len); if ( (n= iguana_voutparse(rwflag,&serialized[len],&msg->vouts[i])) < 0 ) return(-1); len += n; @@ -3421,7 +3421,7 @@ printf("rwflag.%d vout.%d starts %d\n",rwflag,i,len); jaddi(voutarray,iguana_voutjson(taddr,pubtype,p2shtype,&msg->vouts[i],i,*txidp)); } len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->lock_time),&msg->lock_time); -printf("lock_time.%08x len.%d\n",msg->lock_time,len); + //printf("lock_time.%08x len.%d\n",msg->lock_time,len); /*if ( strcmp(coin->symbol,"VPN") == 0 ) { uint16_t ddosflag = 0; diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 19e37b547..e51209add 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -901,7 +901,6 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct adjust = change / numvouts; change = 0; } - printf("numvins.%d vins.(%s) privkeys.(%s)\n",numvins,jprint(vins,0),jprint(privkeys,0)); for (i=0; iisPoS,&txid,txobj,V)) != 0 ) { } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); @@ -963,7 +961,6 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) completed = 0; memset(&msgtx,0,sizeof(msgtx)); memset(signedtxid.bytes,0,sizeof(signedtxid)); - printf("%p %p vins.(%s) privkeys.(%s)\n",vins,privkeys,jprint(vins,0),jprint(privkeys,0)); if ( (completed= iguana_signrawtransaction(ctx,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->longestchain,&msgtx,&signedtx,&signedtxid,V,numvins,rawtx,vins,privkeys)) < 0 ) printf("couldnt sign withdraw %s\n",bits256_str(str,signedtxid)); else if ( completed == 0 ) @@ -981,11 +978,14 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee)); } else break; } else break; + free_json(vins), vins = 0; free_json(privkeys), privkeys = 0; if ( rawtx != 0 ) free(rawtx), rawtx = 0; } free(V); + if ( vins != 0 ) + free_json(vins); if ( privkeys != 0 ) free_json(privkeys); retjson = cJSON_CreateObject(); From 36d3284a961c813117a9927db486a80731675d3a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:46:14 +0300 Subject: [PATCH 235/346] Test --- iguana/exchanges/sendrawtransaction | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 iguana/exchanges/sendrawtransaction diff --git a/iguana/exchanges/sendrawtransaction b/iguana/exchanges/sendrawtransaction new file mode 100755 index 000000000..c3c2b09a0 --- /dev/null +++ b/iguana/exchanges/sendrawtransaction @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"sendrawtransaction\",\"coin\":\"KMD\",\"signedtx\":\"$1\"}" From 496d4887ac2f8088344e1fd93360cdcef9a8a550 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:47:02 +0300 Subject: [PATCH 236/346] Test --- iguana/exchanges/LP_transaction.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index e51209add..b9e9a9ee1 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -433,8 +433,6 @@ int64_t iguana_lockval(int32_t finalized,int64_t locktime) int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,struct iguana_msgtx *msgtx,char **signedtxp,bits256 *signedtxidp,struct vin_info *V,int32_t numinputs,char *rawtx,cJSON *vins,cJSON *privkeysjson) { uint8_t *serialized,*serialized2,*serialized3,*serialized4,*extraspace,pubkeys[64][33]; int32_t finalized,i,len,n,z,plen,maxsize,complete = 0,extralen = 100000; char *privkeystr,*signedtx = 0; bits256 privkeys[64],privkey,txid; cJSON *item; cJSON *txobj = 0; - printf("vins.%p privkeys.%p\n",vins,privkeysjson); - printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); maxsize = 1000000; memset(privkey.bytes,0,sizeof(privkey)); if ( rawtx != 0 && rawtx[0] != 0 && (len= (int32_t)strlen(rawtx)>>1) < maxsize ) @@ -450,10 +448,10 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ { //printf("back from bitcoin_hex2json (%s)\n",jprint(vins,0)); } else fprintf(stderr,"no txobj from bitcoin_hex2json\n"); - printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); + //printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); if ( (numinputs= cJSON_GetArraySize(vins)) > 0 ) { - printf("numinputs.%d (%s) msgtx.%d\n",numinputs,jprint(vins,0),msgtx->tx_in); + //printf("numinputs.%d (%s) msgtx.%d\n",numinputs,jprint(vins,0),msgtx->tx_in); memset(msgtx,0,sizeof(*msgtx)); if ( iguana_rwmsgtx(taddr,pubtype,p2shtype,isPoS,height,0,0,serialized,maxsize,msgtx,&txid,"",extraspace,extralen,vins,V->suppress_pubkeys) > 0 && numinputs == msgtx->tx_in ) { From f071beca9e65d7f63433236a76d5b58f00bb66d8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 00:52:40 +0300 Subject: [PATCH 237/346] Test --- iguana/exchanges/LP_nativeDEX.c | 1 - iguana/exchanges/LP_transaction.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index fc8885984..be8c462a3 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,7 +19,6 @@ // LP_nativeDEX.c // marketmaker // -// withdraw // stats // sign critical api calls // dPoW security -> 2: KMD notarized, 3: BTC notarized diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index b9e9a9ee1..9e94a1b88 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -829,13 +829,14 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ return(n); } -char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys,int64_t txfee) +char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys,int64_t txfee) { static void *ctx; cJSON *txobj,*item; uint8_t addrtype,rmd160[20],script[64],spendscript[64]; char *coinaddr,*rawtxbytes; bits256 txid; uint32_t timestamp,locktime; int64_t change=0,adjust=0,total,value,amount = 0; int32_t i,scriptlen,spendlen,suppress_pubkeys,ignore_cltverr,numvouts=0,numvins=0,numutxos=0; struct LP_address_utxo *utxos[256]; struct LP_address *ap; if ( ctx == 0 ) ctx = bitcoin_ctx(); *numvinsp = 0; + *txobjp = 0; if ( sizeof(utxos)/sizeof(*utxos) != max ) { printf("LP_createrawtransaction: internal error %ld != max.%d\n",sizeof(utxos)/sizeof(*utxos),max); @@ -924,14 +925,14 @@ char *LP_createrawtransaction(int32_t *numvinsp,struct iguana_info *coin,struct if ( (rawtxbytes= bitcoin_json2hex(coin->isPoS,&txid,txobj,V)) != 0 ) { } else printf("error making rawtx suppress.%d\n",suppress_pubkeys); - free_json(txobj); + *txobjp = txobj; return(rawtxbytes); } char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) { static void *ctx; - int32_t iter,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info *V; cJSON *retjson,*outputs,*vins=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; + int32_t iter,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; char changeaddr[64],vinaddr[64],str[65],*signedtx=0,*rawtx=0; struct vin_info *V; cJSON *retjson,*outputs,*vins=0,*txobj=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 signedtxid; uint64_t txfee,newtxfee=10000; if ( (outputs= jarray(&numvouts,argjson,"outputs")) == 0 ) { printf("no outputs in argjson (%s)\n",jprint(argjson,0)); @@ -954,7 +955,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) privkeys = cJSON_CreateArray(); vins = cJSON_CreateArray(); memset(V,0,sizeof(*V) * maxV); - if ( (rawtx= LP_createrawtransaction(&numvins,coin,V,maxV,privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee)) != 0 ) + if ( (rawtx= LP_createrawtransaction(&txobj,&numvins,coin,V,maxV,privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee)) != 0 ) { completed = 0; memset(&msgtx,0,sizeof(msgtx)); @@ -977,6 +978,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) } else break; } else break; free_json(vins), vins = 0; + free_json(txobj), txobj = 0; free_json(privkeys), privkeys = 0; if ( rawtx != 0 ) free(rawtx), rawtx = 0; @@ -991,6 +993,8 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) jaddstr(retjson,"rawtx",rawtx); if ( signedtx != 0 ) jaddstr(retjson,"hex",signedtx); + if ( txobj != 0 ) + jadd(retjson,"tx",txobj); jaddbits256(retjson,"txid",signedtxid); jadd(retjson,"complete",completed!=0?jtrue():jfalse()); return(jprint(retjson,1)); From 318c5fc075e13684da2a246d100205ab56892fa9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 10:42:37 +0300 Subject: [PATCH 238/346] Add MNZ --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- iguana/exchanges/coins | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index be8c462a3..002260f2c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -13,7 +13,6 @@ * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ -//alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN // // LP_nativeDEX.c @@ -22,7 +21,8 @@ // stats // sign critical api calls // dPoW security -> 2: KMD notarized, 3: BTC notarized -// verify portfolio and pricearray +// verify portfolio, pricearray, withdraw +//alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN #include diff --git a/iguana/exchanges/coins b/iguana/exchanges/coins index 356346d6a..f5c3a21d4 100644 --- a/iguana/exchanges/coins +++ b/iguana/exchanges/coins @@ -1,3 +1,3 @@ -export coins="[{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}]" +export coins="[{\"coin\":\"MNZ\",\"asset\":\"MNZ\",\"rpcport\":14337},{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"ZEN\",\"name\":\"zen\",\"rpcport\":8231,\"pubtype\":137,\"taddr\":32,\"p2shtype\":150,\"wiftype\":128,\"txfee\":10000},{\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"Mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":50000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":1000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"SHARK\",\"asset\":\"SHARK\",\"rpcport\":10114}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}]" #, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}]" From 3046871492604965f14a4fd1149275a5572111ad Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 15:15:49 +0300 Subject: [PATCH 239/346] Test --- iguana/exchanges/LP_commands.c | 56 +++++++++++++++++++++++---------- iguana/exchanges/LP_nativeDEX.c | 5 +-- iguana/exchanges/LP_swap.c | 2 +- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 9d9a5febd..19871c0c4 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -94,23 +94,23 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *r // return(clonestr("{\"result\":\"success\"}")); else if ( strcmp(method,"help") == 0 ) return(clonestr("{\"result\":\" \ -available localhost RPC commands:\n \ +available localhost RPC commands: * means it needs to be a signed request\n \ pricearray(base, rel, firsttime=0, lasttime=-1, timescale=60) -> [timestamp, avebid, aveask, highbid, lowask]\n\ -setprice(base, rel, price)\n\ -autoprice(base, rel, price, margin, type)\n\ -goal(coin=*, val=)\n\ +setprice(base, rel, price)*\n\ +autoprice(base, rel, price, margin, type)*\n\ +goal(coin=*, val=)*\n\ myprice(base, rel)\n\ -enable(coin)\n\ -disable(coin)\n\ +enable(coin)*\n\ +disable(coin)*\n\ inventory(coin)\n\ bestfit(rel, relvolume)\n\ lastnonce()\n\ -buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\n\ -sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\n\ -withdraw(coin, outputs[])\n\ +buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)*\n\ +sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)*\n\ +withdraw(coin, outputs[])*\n\ sendrawtransaction(coin, signedtx)\n\ -swapstatus()\n\ -swapstatus(requestid, quoteid)\n\ +swapstatus()*\n\ +swapstatus(requestid, quoteid)*\n\ public API:\n \ getcoins()\n\ getcoin(coin)\n\ @@ -118,16 +118,16 @@ portfolio()\n\ getpeers()\n\ passphrase(passphrase, gui)\n\ listunspent(coin, address)\n\ -setconfirms(coin, numconfirms, maxconfirms=6)\n\ -trust(pubkey, trust)\n\ +setconfirms(coin, numconfirms, maxconfirms=6)*\n\ +trust(pubkey, trust)*\n\ balance(coin, address)\n\ orderbook(base, rel, duration=3600)\n\ getprices(base, rel)\n\ -sendmessage(base=coin, rel="", pubkey=zero, )\n\ -getmessages(firsti=0, num=100)\n\ -clearmessages(firsti=0, num=100)\n\ +sendmessage(base=coin, rel="", pubkey=zero, )*\n\ +getmessages(firsti=0, num=100)*\n\ +deletemessages(firsti=0, num=100)*\n\ secretaddresses(prefix='secretaddress', passphrase, num=10, pubtype=60, taddr=0)\n\ -electrum(coin, ipaddr, port)\n\ +electrum(coin, ipaddr, port)*\n\ snapshot(coin, height)\n\ snapshot_balance(coin, height, addresses[])\n\ dividends(coin, height, )\n\ @@ -153,6 +153,7 @@ dividends(coin, height, )\n\ jdelete(argjson,"userpass"); if ( strcmp(method,"sendmessage") == 0 ) { + //* if ( jobj(argjson,"method2") == 0 ) { printf("broadcast message\n"); @@ -162,12 +163,14 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"getmessages") == 0 ) { + //* if ( (retjson= LP_getmessages(jint(argjson,"firsti"),jint(argjson,"num"))) != 0 ) return(jprint(retjson,1)); else return(clonestr("{\"error\":\"null messages\"}")); } else if ( strcmp(method,"deletemessages") == 0 ) { + //* LP_deletemessages(jint(argjson,"firsti"),jint(argjson,"num")); return(clonestr("{\"result\":\"success\"}")); } @@ -202,6 +205,7 @@ dividends(coin, height, )\n\ price = jdouble(argjson,"price"); if ( strcmp(method,"setprice") == 0 ) { + //* if ( price > SMALLVAL ) { if ( LP_mypriceset(&changed,base,rel,price) < 0 ) @@ -213,6 +217,7 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"autoprice") == 0 ) { + //* if ( LP_autoprice(base,rel,price,jdouble(argjson,"margin"),jstr(argjson,"type")) < 0 ) return(clonestr("{\"error\":\"couldnt set autoprice\"}")); else return(clonestr("{\"result\":\"success\"}")); @@ -235,6 +240,7 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"buy") == 0 ) { + //* if ( price > SMALLVAL ) { return(LP_autobuy(ctx,myipaddr,pubsock,base,rel,price,jdouble(argjson,"relvolume"),jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"))); @@ -242,6 +248,7 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"sell") == 0 ) { + //* if ( price > SMALLVAL ) { return(LP_autobuy(ctx,myipaddr,pubsock,rel,base,1./price,jdouble(argjson,"basevolume"),jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"))); @@ -259,6 +266,7 @@ dividends(coin, height, )\n\ { if ( strcmp(method,"enable") == 0 ) { + //* if ( (ptr= LP_coinsearch(coin)) != 0 ) { if ( LP_conflicts_find(ptr) == 0 ) @@ -269,12 +277,14 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"disable") == 0 ) { + //* if ( (ptr= LP_coinsearch(coin)) != 0 ) ptr->inactive = (uint32_t)time(NULL); return(jprint(LP_coinsjson(0),1)); } else if ( strcmp(method,"electrum") == 0 ) { + //* if ( (ptr= LP_coinsearch(coin)) != 0 ) { ptr->inactive = 0; @@ -287,6 +297,7 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"withdraw") == 0 ) { + ///* if ( (ptr= LP_coinsearch(coin)) != 0 ) { if ( jobj(argjson,"outputs") == 0 ) @@ -298,6 +309,7 @@ dividends(coin, height, )\n\ else if ( strcmp(method,"setconfirms") == 0 ) { int32_t n; + //* n = jint(argjson,"numconfirms"); if ( n < 0 ) return(clonestr("{\"error\":\"illegal numconfirms\"}")); @@ -352,15 +364,22 @@ dividends(coin, height, )\n\ } } else if ( strcmp(method,"goal") == 0 ) + { + //* return(LP_portfolio_goal(coin,jdouble(argjson,"val"))); + } else if ( strcmp(method,"getcoin") == 0 ) return(LP_getcoin(coin)); } else if ( strcmp(method,"goal") == 0 ) + { + //* return(LP_portfolio_goal("*",100.)); + } else if ( strcmp(method,"swapstatus") == 0 ) { uint32_t requestid,quoteid; + //* if ( (requestid= juint(argjson,"requestid")) != 0 && (quoteid= juint(argjson,"quoteid")) != 0 ) return(basilisk_swapentry(requestid,quoteid)); else return(basilisk_swaplist(0,0)); @@ -375,7 +394,10 @@ dividends(coin, height, )\n\ else if ( strcmp(method,"myprices") == 0 ) return(LP_myprices()); else if ( strcmp(method,"trust") == 0 ) + { + //* return(LP_pubkey_trustset(jbits256(argjson,"pubkey"),jint(argjson,"trust"))); + } else if ( strcmp(method,"trusted") == 0 ) return(LP_pubkey_trusted()); } diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 002260f2c..1c266716e 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -18,11 +18,12 @@ // LP_nativeDEX.c // marketmaker // -// stats // sign critical api calls +// stats // dPoW security -> 2: KMD notarized, 3: BTC notarized +// add interest to KMD withdraw // verify portfolio, pricearray, withdraw -//alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN +// alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN #include diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index a6a9e0bf2..c7f4cd457 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -1021,7 +1021,7 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.iambob = 0; swap->I.otherhash = swap->I.req.desthash; swap->I.aliceistrusted = 1; - swap->I.otheristrusted = swap->I.bobistrusted = LP_pubkey_istrusted(swap->I.req.desthash); + swap->I.otheristrusted = swap->I.bobistrusted = LP_pubkey_istrusted(swap->I.req.srchash); } else { From 31628da270b8c71b1711bb52f74335b0f59a0a98 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 15:58:42 +0300 Subject: [PATCH 240/346] Remove GETTXOUT print --- iguana/exchanges/LP_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index ed1f832cd..5da878bbd 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -283,7 +283,7 @@ cJSON *LP_gettxout_json(bits256 txid,int32_t vout,int32_t height,char *coinaddr, jaddstr(sobj,"type","pubkey"); jadd(sobj,"addresses",addresses); jadd(retjson,"scriptPubKey",sobj); - printf("GETTXOUT.(%s)\n",jprint(retjson,0)); + //printf("GETTXOUT.(%s)\n",jprint(retjson,0)); return(retjson); } From b5b0b7e8d8c5ff60a21629acf10a4d090373c18a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 16:37:44 +0300 Subject: [PATCH 241/346] Test --- iguana/exchanges/LP_commands.c | 3 +-- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_rpc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 19871c0c4..d74b34501 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -153,10 +153,9 @@ dividends(coin, height, )\n\ jdelete(argjson,"userpass"); if ( strcmp(method,"sendmessage") == 0 ) { - //* if ( jobj(argjson,"method2") == 0 ) { - printf("broadcast message\n"); + //LP_signature_add(argjson,jstr(argjson,"message"),jbits256(argjson,"pubkey")); LP_broadcast_message(LP_mypubsock,base!=0?base:jstr(argjson,"coin"),rel,jbits256(argjson,"pubkey"),jprint(argjson,0)); } return(clonestr("{\"result\":\"success\"}")); diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index b816be396..a292f1be1 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -35,7 +35,7 @@ #define MIN_PSOCK_PORT 10000 #define LP_MEMPOOL_TIMEINCR 10 #define LP_GETINFO_INCR 30 -#define LP_ORDERBOOK_DURATION 3600 +#define LP_ORDERBOOK_DURATION 120 #define LP_HTTP_TIMEOUT 2 // 1 is too small due to edge cases of time(NULL) #define LP_MAXPEER_ERRORS 3 diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 1c266716e..b59cf9123 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,6 +19,7 @@ // marketmaker // // sign critical api calls +// SPV height errors, autodetect and fix // stats // dPoW security -> 2: KMD notarized, 3: BTC notarized // add interest to KMD withdraw diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 5da878bbd..083159723 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -486,7 +486,7 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr,int32_t fullflag) if ( (destport= LP_randpeer(destip)) > 0 ) { retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr); - printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); + //printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr); retjson = cJSON_Parse(retstr); } else printf("LP_listunspent_issue couldnt get a random peer?\n"); } From 10723a3c198282d1f296e3373ff51e8937eefbed Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 16:41:18 +0300 Subject: [PATCH 242/346] Test --- iguana/exchanges/LP_prices.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index c742decd2..f91916e73 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -719,6 +719,8 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char * //printf("skip pubp since no rmd160\n"); continue; } + if ( pubp->timestamp < oldest ) + continue; bitcoin_address(coinaddr,basecoin->taddr,basecoin->pubtype,pubp->rmd160,sizeof(pubp->rmd160)); minsatoshis = maxsatoshis = n = 0; ap = 0; From e8aa77d7356df4e39009e12d4905f77a744a1eea Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 17:24:39 +0300 Subject: [PATCH 243/346] Test --- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_ordermatch.c | 23 ++++++++++++++++------- iguana/exchanges/LP_socket.c | 15 ++++++++++++++- iguana/exchanges/LP_utxo.c | 27 +++++++++++++++++++++------ 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index b59cf9123..890d65174 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -21,6 +21,7 @@ // sign critical api calls // SPV height errors, autodetect and fix // stats +// deal with offline pubkeys, reputations, etc. // dPoW security -> 2: KMD notarized, 3: BTC notarized // add interest to KMD withdraw // verify portfolio, pricearray, withdraw diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 7c2bc6f69..414e7cf51 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -443,9 +443,9 @@ int32_t LP_nanobind(void *ctx,char *pairstr) return(pairsock); } -int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **utxos,int32_t n,uint64_t targetval) +int32_t LP_nearest_utxovalue(struct iguana_info *coin,char *coinaddr,struct LP_address_utxo **utxos,int32_t n,uint64_t targetval) { - int32_t i,mini = -1; struct LP_address_utxo *up; struct electrum_info *backupep=0,*ep; char str[65]; int64_t dist; uint64_t mindist = (1LL << 60); + int32_t i,oldht,mini = -1; struct LP_address_utxo *up; struct electrum_info *backupep=0,*ep; char str[65]; int64_t dist; uint64_t mindist = (1LL << 60); if ( (ep= coin->electrum) != 0 ) { if ( (backupep= ep->prev) == 0 ) @@ -462,15 +462,24 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u { if ( coin->electrum != 0 ) { - if (up->SPV <= 0 ) + if ( up->SPV == 0 || up->SPV == -1 ) up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - if ( up->SPV < 0 ) + if ( up->SPV == 0 || up->SPV == -1 ) { printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); + if ( up->SPV == -1 ) + { + oldht = up->U.height; + LP_txheight_check(coin,coinaddr,up); + if ( oldht != up->U.height ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); + if ( up->SPV == -1 ) + up->SPV = -2; + } continue; } else printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); } - if ( dist >= 0 && dist < mindist ) + if ( up->SPV > 0 && dist >= 0 && dist < mindist ) { //printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); mini = i; @@ -507,7 +516,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr); } mini = -1; - if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,utxos,m,targetval)) >= 0 ) + if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,coinaddr,utxos,m,targetval)) >= 0 ) { up = utxos[mini]; utxos[mini] = 0; @@ -516,7 +525,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { - if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) + if ( (mini= LP_nearest_utxovalue(coin,coinaddr,utxos,m,targetval2 * 1.01)) >= 0 ) { if ( up != 0 && (up2= utxos[mini]) != 0 ) { diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 99d707ad4..afca7e887 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -457,7 +457,7 @@ cJSON *electrum_address_subscribe(char *symbol,struct electrum_info *ep,cJSON ** cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr) { - struct LP_transaction *tx; cJSON *retjson,*txobj,*item; int32_t i,n,height; bits256 txid; struct iguana_info *coin = LP_coinfind(symbol); + char str[65]; struct LP_transaction *tx; cJSON *retjson,*txobj,*item; int32_t i,n,height; bits256 txid; struct iguana_info *coin = LP_coinfind(symbol); retjson = electrum_strarg(symbol,ep,retjsonp,"blockchain.address.get_history",addr,ELECTRUM_TIMEOUT); //printf("history.(%s)\n",jprint(retjson,0)); if ( retjson != 0 && (n= cJSON_GetArraySize(retjson)) > 0 ) @@ -478,6 +478,8 @@ cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON * { if ( (tx= LP_transactionfind(coin,txid)) != 0 ) { + if ( tx->height > 0 && tx->height != height ) + printf("update %s height.%d <- %d\n",bits256_str(str,txid),tx->height,height); tx->height = height; LP_address_utxoadd(coin,addr,txid,0,0,height,-1); } @@ -488,6 +490,17 @@ cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON * return(retjson); } +int32_t LP_txheight_check(struct iguana_info *coin,char *coinaddr,struct LP_address_utxo *up) +{ + cJSON *retjson; + if ( coin->electrum != 0 ) + { + if ( (retjson= electrum_address_gethistory(coin->symbol,coin->electrum,&retjson,coinaddr)) != 0 ) + free_json(retjson); + } + return(0); +} + cJSON *electrum_address_getmempool(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr) { cJSON *retjson; struct iguana_info *coin = LP_coinfind(symbol); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index cdbf09bec..0a0727038 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -204,8 +204,12 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, if ( vout == up->U.vout && bits256_cmp(up->U.txid,txid) == 0 ) { flag = 1; - if ( up->U.height <= 0 && height > 0 && up->U.height != height ) + if ( height > 0 && up->U.height != height ) + { + if ( up->U.height > 0 ) + printf("update %s/v%d up->U.height %d <- %d\n",bits256_str(str,up->U.txid),up->U.vout,up->U.height,height); up->U.height = height, flag |= 2; + } if ( spendheight > 0 && up->spendheight != spendheight ) up->spendheight = spendheight, flag |= 4; if ( up->U.value == 0 && up->U.value != value ) @@ -346,7 +350,7 @@ int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret) { - cJSON *array,*item; int32_t n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; cJSON *txobj; struct electrum_info *ep,*backupep=0; + cJSON *array,*item; int32_t oldht,n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; cJSON *txobj; struct electrum_info *ep,*backupep=0; array = cJSON_CreateArray(); if ( coinaddr != 0 && coinaddr[0] != 0 ) { @@ -371,11 +375,22 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum } if ( up->spendheight <= 0 ) { - if ( backupep != 0 && up->SPV <= 0 ) + if ( backupep != 0 && (up->SPV == 0 || up->SPV == -1) ) + { up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - jaddi(array,LP_address_item(coin,up,electrumret)); - n++; - total += up->U.value; + oldht = up->U.height; + LP_txheight_check(coin,coinaddr,up); + if ( oldht != up->U.height ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); + if ( up->SPV == -1 ) + up->SPV = -2; + } + if ( up->SPV > 0 ) + { + jaddi(array,LP_address_item(coin,up,electrumret)); + n++; + total += up->U.value; + } } //printf("new array %s\n",jprint(array,0)); } From 820e8429c9e724ed88ae5fd126e5d1094c15492a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 17:47:29 +0300 Subject: [PATCH 244/346] Test --- iguana/exchanges/LP_commands.c | 13 +++++-------- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_utxo.c | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index d74b34501..1c4d76600 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -123,9 +123,9 @@ trust(pubkey, trust)*\n\ balance(coin, address)\n\ orderbook(base, rel, duration=3600)\n\ getprices(base, rel)\n\ -sendmessage(base=coin, rel="", pubkey=zero, )*\n\ -getmessages(firsti=0, num=100)*\n\ -deletemessages(firsti=0, num=100)*\n\ +sendmessage(base=coin, rel="", pubkey=zero, )\n\ +getmessages(firsti=0, num=100)\n\ +deletemessages(firsti=0, num=100)\n\ secretaddresses(prefix='secretaddress', passphrase, num=10, pubtype=60, taddr=0)\n\ electrum(coin, ipaddr, port)*\n\ snapshot(coin, height)\n\ @@ -155,21 +155,18 @@ dividends(coin, height, )\n\ { if ( jobj(argjson,"method2") == 0 ) { - //LP_signature_add(argjson,jstr(argjson,"message"),jbits256(argjson,"pubkey")); LP_broadcast_message(LP_mypubsock,base!=0?base:jstr(argjson,"coin"),rel,jbits256(argjson,"pubkey"),jprint(argjson,0)); } return(clonestr("{\"result\":\"success\"}")); } else if ( strcmp(method,"getmessages") == 0 ) { - //* if ( (retjson= LP_getmessages(jint(argjson,"firsti"),jint(argjson,"num"))) != 0 ) return(jprint(retjson,1)); else return(clonestr("{\"error\":\"null messages\"}")); } else if ( strcmp(method,"deletemessages") == 0 ) { - //* LP_deletemessages(jint(argjson,"firsti"),jint(argjson,"num")); return(clonestr("{\"result\":\"success\"}")); } @@ -204,9 +201,9 @@ dividends(coin, height, )\n\ price = jdouble(argjson,"price"); if ( strcmp(method,"setprice") == 0 ) { - //* if ( price > SMALLVAL ) { + //LP_signature_add(argjson,base,rel,(uint64_t)price * SATOSHIDEN); if ( LP_mypriceset(&changed,base,rel,price) < 0 ) return(clonestr("{\"error\":\"couldnt set price\"}")); //else if ( LP_mypriceset(&changed,rel,base,1./price) < 0 ) @@ -216,7 +213,7 @@ dividends(coin, height, )\n\ } else if ( strcmp(method,"autoprice") == 0 ) { - //* + //LP_signature_add(argjson,base,rel,(uint64_t)price * SATOSHIDEN); if ( LP_autoprice(base,rel,price,jdouble(argjson,"margin"),jstr(argjson,"type")) < 0 ) return(clonestr("{\"error\":\"couldnt set autoprice\"}")); else return(clonestr("{\"result\":\"success\"}")); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 890d65174..87431732a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,7 +19,7 @@ // marketmaker // // sign critical api calls -// SPV height errors, autodetect and fix +// -SPV height errors, autodetect and fix // stats // deal with offline pubkeys, reputations, etc. // dPoW security -> 2: KMD notarized, 3: BTC notarized diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 414e7cf51..ed9e8e8e2 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -473,7 +473,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,char *coinaddr,struct LP_a LP_txheight_check(coin,coinaddr,up); if ( oldht != up->U.height ) up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - if ( up->SPV == -1 ) + if ( up->SPV < 0 ) up->SPV = -2; } continue; diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 0a0727038..e6085fc75 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -382,7 +382,7 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum LP_txheight_check(coin,coinaddr,up); if ( oldht != up->U.height ) up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - if ( up->SPV == -1 ) + if ( up->SPV < 0 ) up->SPV = -2; } if ( up->SPV > 0 ) From 0e70c76fedb35fca3bdad2e3a2a4d614de247036 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 17:57:39 +0300 Subject: [PATCH 245/346] Test --- iguana/exchanges/LP_utxo.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index e6085fc75..65dc31791 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -350,7 +350,7 @@ int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret) { - cJSON *array,*item; int32_t oldht,n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; cJSON *txobj; struct electrum_info *ep,*backupep=0; + cJSON *array,*item; int32_t n; uint64_t total; struct LP_address *ap=0,*atmp; struct LP_address_utxo *up,*tmp; cJSON *txobj; struct electrum_info *ep,*backupep=0; array = cJSON_CreateArray(); if ( coinaddr != 0 && coinaddr[0] != 0 ) { @@ -375,17 +375,7 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum } if ( up->spendheight <= 0 ) { - if ( backupep != 0 && (up->SPV == 0 || up->SPV == -1) ) - { - up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - oldht = up->U.height; - LP_txheight_check(coin,coinaddr,up); - if ( oldht != up->U.height ) - up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - if ( up->SPV < 0 ) - up->SPV = -2; - } - if ( up->SPV > 0 ) + if ( up->SPV >= 0 ) { jaddi(array,LP_address_item(coin,up,electrumret)); n++; From d36241af909936e959df52dab721e29396f1de48 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 17:59:49 +0300 Subject: [PATCH 246/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index ed9e8e8e2..b151fec64 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -477,7 +477,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,char *coinaddr,struct LP_a up->SPV = -2; } continue; - } else printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); + } //else printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); } if ( up->SPV > 0 && dist >= 0 && dist < mindist ) { From 02f03df62f252244c83f098d1e51f59b84bde624 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 18:01:20 +0300 Subject: [PATCH 247/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 65dc31791..239170f56 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -207,7 +207,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, if ( height > 0 && up->U.height != height ) { if ( up->U.height > 0 ) - printf("update %s/v%d up->U.height %d <- %d\n",bits256_str(str,up->U.txid),up->U.vout,up->U.height,height); + printf("SPV.%d update %s/v%d up->U.height %d <- %d\n",up->SPV,bits256_str(str,up->U.txid),up->U.vout,up->U.height,height); up->U.height = height, flag |= 2; } if ( spendheight > 0 && up->spendheight != spendheight ) From 75e0bff25a1fd751ac166933c0b54810229674c2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 18:12:18 +0300 Subject: [PATCH 248/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 239170f56..b37b9f01e 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -207,7 +207,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, if ( height > 0 && up->U.height != height ) { if ( up->U.height > 0 ) - printf("SPV.%d update %s/v%d up->U.height %d <- %d\n",up->SPV,bits256_str(str,up->U.txid),up->U.vout,up->U.height,height); + printf("%s SPV.%d update %s/v%d up->U.height %d <- %d\n",coin->symbol,up->SPV,bits256_str(str,up->U.txid),up->U.vout,up->U.height,height); up->U.height = height, flag |= 2; } if ( spendheight > 0 && up->spendheight != spendheight ) From 0fb43b5b7d56129a29ca5c4e29c31b172f32742b Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 18:14:36 +0300 Subject: [PATCH 249/346] Test --- iguana/exchanges/LP_utxo.c | 4 ++-- iguana/exchanges/LP_utxos.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b37b9f01e..bede356f6 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -253,7 +253,7 @@ cJSON *LP_address_item(struct iguana_info *coin,struct LP_address_utxo *up,int32 { jaddbits256(item,"txid",up->U.txid); jaddnum(item,"vout",up->U.vout); - jaddnum(item,"confirmations",LP_getheight(coin) - up->U.height); + jaddnum(item,"confirmations",LP_getheight(coin) - up->U.height + 1); jaddnum(item,"amount",dstr(up->U.value)); jaddstr(item,"scriptPubKey",""); } @@ -469,7 +469,7 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array) errs++; } if ( coin->height != 0 ) - ht = LP_getheight(coin) - jint(txobj,"confirmations"); + ht = LP_getheight(coin) - jint(txobj,"confirmations") + 1; else ht = 0; /*if ( ht != 0 && ht < height-2 ) { diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index b0da0da76..206e4e66a 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -540,7 +540,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri txid = jbits256(item,"txid"); vout = juint(item,"vout"); value = LP_value_extract(item,0); - height = LP_getheight(coin) - jint(item,"confirmations"); + height = LP_getheight(coin) - jint(item,"confirmations") + 1; } else { From e96fec7b71b2ce849a63221570cb6260540593af Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 18:32:19 +0300 Subject: [PATCH 250/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index b151fec64..aecd24f16 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1085,7 +1085,9 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel if ( qprice/ordermatchprice < 1.+SMALLVAL ) { printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); - Q.satoshis *= 0.9999; + if ( strcmp("BTC",Q.destcoin) == 0 ) + Q.satoshis *= 0.999; + else Q.satoshis *= 0.9999; } else break; } if ( i == maxiters || qprice > maxprice ) From 16996bb7bf38e198953ebb0cfbbb931fb83a08b5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 18:50:51 +0300 Subject: [PATCH 251/346] Test --- iguana/exchanges/LP_utxo.c | 7 ++++--- iguana/exchanges/LP_utxos.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index bede356f6..2ce7c4c16 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -468,9 +468,10 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array) char str[65]; printf("REJECT %s %s/v%d value.%llu vs %llu (%s)\n",coin->symbol,bits256_str(str,txid),v,(long long)value,(long long)val,jprint(txobj,0)); errs++; } - if ( coin->height != 0 ) - ht = LP_getheight(coin) - jint(txobj,"confirmations") + 1; - else ht = 0; + ht = LP_txheight(coin,txid); + //if ( coin->height != 0 ) + // ht = LP_getheight(coin) - jint(txobj,"confirmations") + 1; + //else ht = 0; /*if ( ht != 0 && ht < height-2 ) { printf("REJECT %s %s/v%d ht.%d vs %d confs.%d (%s)\n",symbol,bits256_str(str,txid),v,ht,height,jint(txobj,"confirmations"),jprint(item,0)); diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 206e4e66a..de147122b 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -540,7 +540,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri txid = jbits256(item,"txid"); vout = juint(item,"vout"); value = LP_value_extract(item,0); - height = LP_getheight(coin) - jint(item,"confirmations") + 1; + height = LP_txheight(coin,txid);//LP_getheight(coin) - jint(item,"confirmations") + 1; } else { From 7cba004841c174cd3529fc52f8e180e1ab73d266 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 19:09:25 +0300 Subject: [PATCH 252/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index aecd24f16..a35f504fc 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1086,7 +1086,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel { printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); if ( strcmp("BTC",Q.destcoin) == 0 ) - Q.satoshis *= 0.999; + Q.satoshis *= 0.995; else Q.satoshis *= 0.9999; } else break; } From d2f998692ee86d62466def2028ad32fa6d34d078 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 19:11:34 +0300 Subject: [PATCH 253/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a35f504fc..be9815aa6 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1086,7 +1086,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel { printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); if ( strcmp("BTC",Q.destcoin) == 0 ) - Q.satoshis *= 0.995; + Q.satoshis *= 0.99; else Q.satoshis *= 0.9999; } else break; } From c2385dfcbc7e9a13f1bf0135920c2f00e88569c8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 19:15:00 +0300 Subject: [PATCH 254/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index be9815aa6..9e583a33e 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1086,7 +1086,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel { printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); if ( strcmp("BTC",Q.destcoin) == 0 ) - Q.satoshis *= 0.99; + Q.satoshis *= 0.98; else Q.satoshis *= 0.9999; } else break; } From 6ebb90669cff6f95d0f5106932e800ad2a3946cb Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Oct 2017 19:18:03 +0300 Subject: [PATCH 255/346] Test --- iguana/exchanges/LP_ordermatch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 9e583a33e..d32e089e0 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1073,7 +1073,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel return(clonestr("{\"error\":\"cant set ordermatch quote\"}")); if ( LP_quotedestinfo(&Q,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,G.LP_mypub25519,autxo->coinaddr) < 0 ) return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); - maxiters = 100; + maxiters = 200; qprice = 1. / SMALLVAL; for (i=0; i Date: Mon, 16 Oct 2017 19:28:07 +0300 Subject: [PATCH 256/346] Test --- iguana/exchanges/LP_ordermatch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index d32e089e0..b0f06dcb3 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -348,10 +348,9 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str return(-14); if ( butxo != 0 ) { - //qprice 2259.01692494 <- 10.34279604/0.00457845 txfees.(0.00042631 0.00010000) vs (0.00042791 0.00010000) if ( qp->satoshis < (srcvalue / LP_MINVOL) || srcvalue < qp->txfee*LP_MINSIZE_TXFEEMULT ) { - printf("utxo payment %.8f is less than %f covered by Q %.8f or <10x txfee %.8f\n",dstr(srcvalue),1./LP_MINVOL,dstr(qp->satoshis),dstr(qp->txfee)); + printf("utxo payment %.8f is less than %f covered by Q %.8f or <10x txfee %.8f [%d %d]\n",dstr(srcvalue),1./LP_MINVOL,dstr(qp->satoshis),dstr(qp->txfee),qp->satoshis < (srcvalue / LP_MINVOL),srcvalue < qp->txfee*LP_MINSIZE_TXFEEMULT); return(-12); } } @@ -1086,7 +1085,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel { printf("i.%d/%d qprice %.8f < ordermatchprice %.8f\n",i,maxiters,qprice,ordermatchprice); if ( strcmp("BTC",Q.destcoin) == 0 || strcmp("BTC",Q.srccoin) == 0 ) - Q.satoshis *= 0.99; + Q.satoshis *= 0.999; else Q.satoshis *= 0.9999; } else break; } From 73325c713f66bed28d350e2a6173a89dd3d9fe57 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 13:45:36 +0300 Subject: [PATCH 257/346] Test --- iguana/exchanges/LP_nativeDEX.c | 7 ++++--- iguana/exchanges/LP_ordermatch.c | 1 + iguana/exchanges/LP_remember.c | 5 ++++- iguana/exchanges/LP_utxo.c | 12 +++++++++--- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 87431732a..0cba5ea50 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -18,13 +18,14 @@ // LP_nativeDEX.c // marketmaker // -// sign critical api calls -// -SPV height errors, autodetect and fix -// stats +// autoprice based on formula +// sign critical api calls (pubkey reg, listunspent, orders?) +// stats using KV opreturn // deal with offline pubkeys, reputations, etc. // dPoW security -> 2: KMD notarized, 3: BTC notarized // add interest to KMD withdraw // verify portfolio, pricearray, withdraw +// dICO allocation // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index b0f06dcb3..32bc86b1b 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -820,6 +820,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, { LP_quoteparse(&Q,argjson); LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-2*Q.txfee,Q.destcoin,Q.destsatoshis-2*Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); + LP_tradecommand_log(argjson); printf("LP_tradecommand: check received method %s\n",method); retval = 1; if ( strcmp(method,"reserved") == 0 ) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 01f7bb20a..119b35f94 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1201,5 +1201,8 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) return(retstr); } - +void LP_tradecommand_log(cJSON *argjson) +{ + +} diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 2ce7c4c16..df8f11d27 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -204,7 +204,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, if ( vout == up->U.vout && bits256_cmp(up->U.txid,txid) == 0 ) { flag = 1; - if ( height > 0 && up->U.height != height ) + if ( height > 0 && up->U.height != height && up->SPV <= 0 ) { if ( up->U.height > 0 ) printf("%s SPV.%d update %s/v%d up->U.height %d <- %d\n",coin->symbol,up->SPV,bits256_str(str,up->U.txid),up->U.vout,up->U.height,height); @@ -818,7 +818,7 @@ uint64_t LP_txvalue(char *coinaddr,char *symbol,bits256 txid,int32_t vout) int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol,bits256 txid,int32_t vout,uint64_t satoshis,bits256 txid2,int32_t vout2) { //struct LP_utxoinfo *utxo; - struct LP_address_utxo *up; uint64_t val,val2=0,txfee,threshold=0; int32_t bypass = 0; char destaddr[64],destaddr2[64]; struct iguana_info *coin = LP_coinfind(symbol); + struct LP_address_utxo *up; uint64_t val,val2=0,txfee,threshold=0; int32_t bypass = 0; char destaddr[64],destaddr2[64],str[65]; struct iguana_info *coin = LP_coinfind(symbol); if ( bits256_nonz(txid) == 0 || bits256_nonz(txid2) == 0 ) { printf("null txid not eligible\n"); @@ -831,9 +831,15 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol val = satoshis; else val = LP_txvalue(destaddr,symbol,txid,vout); if ( (up= LP_address_utxofind(coin,destaddr,txid,vout)) != 0 && up->spendheight > 0 ) + { + printf("%s/v%d spent %d\n",bits256_str(str,txid),vout,up->spendheight); return(-2); + } if ( (up= LP_address_utxofind(coin,destaddr,txid2,vout2)) != 0 && up->spendheight > 0 ) + { + printf("%s/v%d spent %d\n",bits256_str(str,txid2),vout2,up->spendheight); return(-3); + } txfee = LP_txfeecalc(LP_coinfind(symbol),0,0); if ( val >= satoshis && val > (1+LP_MINSIZE_TXFEEMULT)*txfee ) { @@ -855,7 +861,7 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol } } // else printf("no val2\n"); } - char str[65],str2[65]; + char str2[65]; if ( val != 0 && val2 != 0 ) printf("spent.%d %s txid or value %.8f < %.8f or val2 %.8f < %.8f, %s/v%d %s/v%d or < 10x txfee %.8f\n",iambob,symbol,dstr(val),dstr(satoshis),dstr(val2),dstr(threshold),bits256_str(str,txid),vout,bits256_str(str2,txid2),vout2,dstr(txfee)); if ( val == 0 ) From cafd5fac40e26d4383376d76cb68da32894ab246 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 14:31:41 +0300 Subject: [PATCH 258/346] Test --- iguana/exchanges/LP_commands.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 1c4d76600..b13d720b7 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -265,6 +265,8 @@ dividends(coin, height, )\n\ //* if ( (ptr= LP_coinsearch(coin)) != 0 ) { + if ( ptr->userpass[0] == 0 ) + return(clonestr("{\"error\":\"no rpc credentials to enable\"}")); if ( LP_conflicts_find(ptr) == 0 ) ptr->inactive = 0; else return(clonestr("{\"error\":\"coin port conflicts with existing coin\"}")); From 68ba6242a1b0c0f83c05f02dabb10ec555dd9629 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 14:36:06 +0300 Subject: [PATCH 259/346] Test --- iguana/exchanges/LP_commands.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index b13d720b7..af9387558 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -268,17 +268,24 @@ dividends(coin, height, )\n\ if ( ptr->userpass[0] == 0 ) return(clonestr("{\"error\":\"no rpc credentials to enable\"}")); if ( LP_conflicts_find(ptr) == 0 ) + { ptr->inactive = 0; - else return(clonestr("{\"error\":\"coin port conflicts with existing coin\"}")); - } - return(jprint(LP_coinsjson(0),1)); + cJSON *array = cJSON_CreateArray(); + jaddi(array,LP_coinjson(ptr,0)); + return(jprint(array,1)); + } else return(clonestr("{\"error\":\"coin port conflicts with existing coin\"}")); + } else return(clonestr("{\"error\":\"couldnt find coin\"}")); } else if ( strcmp(method,"disable") == 0 ) { //* if ( (ptr= LP_coinsearch(coin)) != 0 ) + { ptr->inactive = (uint32_t)time(NULL); - return(jprint(LP_coinsjson(0),1)); + cJSON *array = cJSON_CreateArray(); + jaddi(array,LP_coinjson(ptr,0)); + return(jprint(array,1)); + } else return(clonestr("{\"error\":\"couldnt find coin\"}")); } else if ( strcmp(method,"electrum") == 0 ) { From ca8852a7677492053dfe6e144bd87ae17eb97d4d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:07:32 +0300 Subject: [PATCH 260/346] Test --- iguana/exchanges/LP_ordermatch.c | 15 +++++++++++---- iguana/exchanges/LP_utxo.c | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 32bc86b1b..df830ca12 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -776,7 +776,7 @@ char *LP_bestfit(char *rel,double relvolume) } struct LP_quoteinfo LP_Alicequery; -double LP_Alicemaxprice; +double LP_Alicemaxprice; int32_t Alice_timeout; char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp,double maxprice,int32_t timeout,int32_t duration) { struct LP_utxoinfo *aliceutxo; double price; //cJSON *bestitem=0; int32_t DEXselector=0; uint32_t expiration; double price; struct LP_pubkeyinfo *pubp; struct basilisk_swap *swap; @@ -787,7 +787,7 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q } price = 0.; LP_query(ctx,myipaddr,mypubsock,"request",qp); - LP_Alicequery = *qp, LP_Alicemaxprice = maxprice; + LP_Alicequery = *qp, LP_Alicemaxprice = maxprice, Alice_timeout = timeout; return(clonestr("{\"result\":\"success\"}")); } @@ -801,7 +801,14 @@ int32_t LP_quotecmp(struct LP_quoteinfo *qp,struct LP_quoteinfo *qp2) void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp) { double price,maxprice = LP_Alicemaxprice; - if ( LP_quotecmp(qp,&LP_Alicequery) == 0 ) + if ( time(NULL) > qp->timestamp+Alice_timeout ) + { + printf("time expired for Alice_request\n"); + memset(&LP_Alicequery,0,sizeof(LP_Alicequery)); + LP_Alicemaxprice = 0.; + Alice_timeout = 0; + } + else if ( LP_quotecmp(qp,&LP_Alicequery) == 0 ) { price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout); if ( LP_pricevalid(price) > 0 && maxprice > SMALLVAL && price <= maxprice ) @@ -1058,7 +1065,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel LP_txfees(&txfee,&desttxfee,base,rel); destsatoshis = SATOSHIDEN * relvolume + 2*desttxfee; if ( (autxo= LP_utxo_bestfit(rel,destsatoshis)) == 0 ) - return(clonestr("{\"error\":\"cant find utxo that is big enough\"}")); + return(clonestr("{\"error\":\"cant find alice utxo that is big enough\"}")); if ( destsatoshis < autxo->S.satoshis ) autxo->S.satoshis = destsatoshis; while ( 1 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index df8f11d27..ba5fdad3b 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -157,7 +157,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout); + char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) @@ -832,12 +832,12 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol else val = LP_txvalue(destaddr,symbol,txid,vout); if ( (up= LP_address_utxofind(coin,destaddr,txid,vout)) != 0 && up->spendheight > 0 ) { - printf("%s/v%d spent %d\n",bits256_str(str,txid),vout,up->spendheight); + //printf("%s/v%d spent %d\n",bits256_str(str,txid),vout,up->spendheight); return(-2); } if ( (up= LP_address_utxofind(coin,destaddr,txid2,vout2)) != 0 && up->spendheight > 0 ) { - printf("%s/v%d spent %d\n",bits256_str(str,txid2),vout2,up->spendheight); + //printf("%s/v%d spent %d\n",bits256_str(str,txid2),vout2,up->spendheight); return(-3); } txfee = LP_txfeecalc(LP_coinfind(symbol),0,0); From ffa5b37a26f6b8eff32d8ae329c34249a1154fc5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:07:50 +0300 Subject: [PATCH 261/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index ba5fdad3b..1886e6ada 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -238,7 +238,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 0 && height > 0 ) + if ( 1 && height > 0 ) printf("ADDRESS_UTXO >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); From 2957c83e3f7df09a2047fec5a31f4d083051ae1f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:37:35 +0300 Subject: [PATCH 262/346] Test --- iguana/exchanges/LP_commands.c | 8 ++++---- iguana/exchanges/LP_utxo.c | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index af9387558..04289473d 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -472,10 +472,6 @@ dividends(coin, height, )\n\ return(jprint(LP_address_balance(ptr,jstr(argjson,"address"),1),1)); else return(clonestr("{\"error\":\"cant find coind\"}")); } - else if ( IAMLP == 0 && LP_isdisabled(base,rel) != 0 ) - return(clonestr("{\"result\":\"at least one of coins disabled\"}")); - else if ( IAMLP == 0 && LP_isdisabled(jstr(argjson,"coin"),0) != 0 ) - retstr = clonestr("{\"result\":\"coin is disabled\"}"); else if ( strcmp(method,"checktxid") == 0 ) retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) @@ -498,6 +494,10 @@ dividends(coin, height, )\n\ } retstr = clonestr("{\"result\":\"success\"}"); } + //else if ( IAMLP == 0 && LP_isdisabled(base,rel) != 0 ) + // return(clonestr("{\"result\":\"at least one of coins disabled\"}")); + //else if ( IAMLP == 0 && LP_isdisabled(jstr(argjson,"coin"),0) != 0 ) + // retstr = clonestr("{\"result\":\"coin is disabled\"}"); else if ( strcmp(method,"getcoins") == 0 ) return(jprint(LP_coinsjson(0),1)); else if ( strcmp(method,"encrypted") == 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 1886e6ada..f9ff13b2b 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -154,6 +154,7 @@ struct LP_utxoinfo *LP_allocated(bits256 txid,int32_t vout) int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap) { struct LP_address_utxo *up,*tmp; int32_t n = 0; + printf("LP_address_utxo_ptrs for (%s)\n",ap->coinaddr); portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { From 25ea4fe4906b6d2c6e2f0a15812f9cd48cd67d43 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:40:05 +0300 Subject: [PATCH 263/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index f9ff13b2b..b74c79fa6 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -239,7 +239,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 1 && height > 0 ) + if ( 1 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) printf("ADDRESS_UTXO >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); From 83fc3846dcea613534ebb8dc1776fd7dc56799e3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:42:24 +0300 Subject: [PATCH 264/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- iguana/exchanges/LP_transaction.c | 2 +- iguana/exchanges/LP_utxo.c | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index df830ca12..120ee3899 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -504,7 +504,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** struct LP_address *ap; uint64_t targetval,targetval2; int32_t m,mini; struct LP_address_utxo *up,*up2; struct LP_utxoinfo *utxo = 0; if ( coin != 0 && (ap= LP_addressfind(coin,coinaddr)) != 0 ) { - if ( (m= LP_address_utxo_ptrs(iambob,utxos,max,ap)) > 1 ) + if ( (m= LP_address_utxo_ptrs(iambob,utxos,max,ap,coinaddr)) > 1 ) { targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee); if ( 0 ) @@ -539,7 +539,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** } else printf("failed ratio test %.8f\n",(double)up->U.value/targetval); } else if ( targetval != 0 && mini >= 0 ) printf("targetval %.8f mini.%d\n",dstr(targetval),mini); - } else printf("no utxos pass LP_address_utxo_ptrs filter\n"); + } else printf("no %s utxos pass LP_address_utxo_ptrs filter\n",coinaddr); } else printf("couldnt find %s %s\n",coin->symbol,coinaddr); return(0); } diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 9e94a1b88..48c03efa1 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -878,7 +878,7 @@ char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_inf return(0); } memset(utxos,0,sizeof(utxos)); - if ( (numutxos= LP_address_utxo_ptrs(0,utxos,max,ap)) <= 0 ) + if ( (numutxos= LP_address_utxo_ptrs(0,utxos,max,ap,coin->smartaddr)) <= 0 ) { printf("LP_createrawtransaction: address_utxo_ptrs %d, error\n",numutxos); return(0); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b74c79fa6..c9d10c4ad 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -151,10 +151,12 @@ struct LP_utxoinfo *LP_allocated(bits256 txid,int32_t vout) return(0); } -int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap) +int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap,char *coinaddr) { struct LP_address_utxo *up,*tmp; int32_t n = 0; - printf("LP_address_utxo_ptrs for (%s)\n",ap->coinaddr); + printf("LP_address_utxo_ptrs for (%s).(%s)\n",ap->coinaddr,coinaddr); + if ( strcmp(ap->coinaddr,coinaddr) != 0 ) + printf("UNEXPECTED coinaddr mismatch (%s) != (%s)\n",ap->coinaddr,coinaddr); portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { From 14e77c725dffdb7b7a7d75a5f20ae0860c4bb622 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:49:30 +0300 Subject: [PATCH 265/346] Test --- iguana/exchanges/LP_commands.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 04289473d..d8dea68ee 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -265,8 +265,6 @@ dividends(coin, height, )\n\ //* if ( (ptr= LP_coinsearch(coin)) != 0 ) { - if ( ptr->userpass[0] == 0 ) - return(clonestr("{\"error\":\"no rpc credentials to enable\"}")); if ( LP_conflicts_find(ptr) == 0 ) { ptr->inactive = 0; From 6f0461ae8a3da3df2143d79213c15d8925b16145 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 15:58:07 +0300 Subject: [PATCH 266/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_rpc.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0cba5ea50..7b8c5a05f 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -708,7 +708,7 @@ int32_t LP_reserved_msgs() while ( num_Reserved_msgs > 0 ) { num_Reserved_msgs--; - //printf("BROADCASTING RESERVED.(%s)\n",Reserved_msgs[num_Reserved_msgs]); + printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); Reserved_msgs[num_Reserved_msgs] = 0; n++; diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 083159723..26f23986f 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -476,10 +476,11 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr,int32_t fullflag) if ( strcmp(coin->smartaddr,coinaddr) == 0 ) { retjson = LP_listunspent(symbol,coinaddr); - //printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); + printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); } else if ( IAMLP == 0 ) { + printf("LP_listunspent_query.(%s %s)\n",symbol,coinaddr); LP_listunspent_query(coin->symbol,coin->smartaddr); if ( fullflag != 0 ) { From 9c49451d878e4bf6b554a2210166b39685241010 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:03:18 +0300 Subject: [PATCH 267/346] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_nativeDEX.c | 37 +++++++++++++++------------------ 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index d8dea68ee..9c3419f72 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -484,7 +484,7 @@ dividends(coin, height, )\n\ { if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { - //printf("%s %s is my address being asked for!\n",ptr->symbol,coinaddr); + printf("ADDR_UNSPENTS %s %s is my address being asked for!\n",ptr->symbol,coinaddr); ptr->addr_listunspent_requested = (uint32_t)time(NULL); } } diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7b8c5a05f..30500c2d0 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -349,27 +349,24 @@ void LP_smartutxos_push(struct iguana_info *coin) vout = jint(item,"tx_pos"); value = j64bits(item,"value"); height = jint(item,"height"); - if ( 0 ) + if ( IAMLP == 0 ) { - HASH_ITER(hh,LP_peerinfos,peer,tmp) - { - if ( (retstr= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,vout,height,value)) != 0 ) - free(retstr); - } - } - else - { - req = cJSON_CreateObject(); - jaddstr(req,"method","uitem"); - jaddstr(req,"coin",coin->symbol); - jaddstr(req,"coinaddr",coin->smartaddr); - jaddbits256(req,"txid",txid); - jaddnum(req,"vout",vout); - jaddnum(req,"ht",height); - jadd64bits(req,"value",value); - //printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); - LP_reserved_msg("","",zero,jprint(req,1)); + HASH_ITER(hh,LP_peerinfos,peer,tmp) + { + if ( (retstr= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,vout,height,value)) != 0 ) + free(retstr); + } } + req = cJSON_CreateObject(); + jaddstr(req,"method","uitem"); + jaddstr(req,"coin",coin->symbol); + jaddstr(req,"coinaddr",coin->smartaddr); + jaddbits256(req,"txid",txid); + jaddnum(req,"vout",vout); + jaddnum(req,"ht",height); + jadd64bits(req,"value",value); + printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); + LP_reserved_msg("","",zero,jprint(req,1)); } } free_json(array); @@ -564,7 +561,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int memset(&zero,0,sizeof(zero)); if ( coin->addr_listunspent_requested != 0 ) { - //printf("addr_listunspent_requested %u\n",coin->addr_listunspent_requested); + printf("PUSH addr_listunspent_requested %u\n",coin->addr_listunspent_requested); LP_smartutxos_push(coin); coin->addr_listunspent_requested = 0; } From 50020d581e633f5be9f6d6c25eec72b4145cf923 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:09:29 +0300 Subject: [PATCH 268/346] Test --- iguana/exchanges/LP_nativeDEX.c | 7 ++++++- iguana/exchanges/LP_rpc.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 30500c2d0..2874b4679 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -699,11 +699,16 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint int32_t LP_reserved_msgs() { - bits256 zero; int32_t n = 0; + bits256 zero; struct nn_pollfd pfd; int32_t n = 0; memset(zero.bytes,0,sizeof(zero)); portable_mutex_lock(&LP_reservedmutex); while ( num_Reserved_msgs > 0 ) { + memset(&pfd,0,sizeof(pfd)); + pfd.fd = LP_mypubsock; + pfd.events = NN_POLLOUT; + if ( nn_poll(&pfd,1,1) != 1 ) + break; num_Reserved_msgs--; printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 26f23986f..c6cc3e298 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -476,7 +476,7 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr,int32_t fullflag) if ( strcmp(coin->smartaddr,coinaddr) == 0 ) { retjson = LP_listunspent(symbol,coinaddr); - printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); + //printf("SELF_LISTUNSPENT.(%s %s)\n",symbol,coinaddr); } else if ( IAMLP == 0 ) { From 75239f966792c7a1cd4bc3d166926d267c952b09 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:18:35 +0300 Subject: [PATCH 269/346] Test --- iguana/exchanges/LP_nativeDEX.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 2874b4679..0be040be1 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -699,21 +699,24 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint int32_t LP_reserved_msgs() { - bits256 zero; struct nn_pollfd pfd; int32_t n = 0; + bits256 zero; int32_t n = 0; //struct nn_pollfd pfd; memset(zero.bytes,0,sizeof(zero)); portable_mutex_lock(&LP_reservedmutex); - while ( num_Reserved_msgs > 0 ) + if ( num_Reserved_msgs > 0 ) { - memset(&pfd,0,sizeof(pfd)); + /*memset(&pfd,0,sizeof(pfd)); pfd.fd = LP_mypubsock; pfd.events = NN_POLLOUT; if ( nn_poll(&pfd,1,1) != 1 ) - break; + break;*/ num_Reserved_msgs--; printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); Reserved_msgs[num_Reserved_msgs] = 0; n++; +#ifdef __APPLE__ + usleep(5000); +#endif } portable_mutex_unlock(&LP_reservedmutex); return(n); From 4bc2805917f09fac3e6a4077863346a0d615bde5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:27:22 +0300 Subject: [PATCH 270/346] Test --- iguana/exchanges/LP_network.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 080400f5d..b85f044f4 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -158,7 +158,7 @@ void queue_loop(void *ignore) { if ( (sentbytes= nn_send(ptr->sock,ptr->msg,ptr->msglen,0)) != ptr->msglen ) printf("%d LP_send sent %d instead of %d\n",n,sentbytes,ptr->msglen); - //else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->msglen,ptr->peerind,ptr->msg); +else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->msglen,ptr->peerind,ptr->msg); ptr->sock = -1; if ( ptr->peerind > 0 ) ptr->starttime = (uint32_t)time(NULL); @@ -206,16 +206,16 @@ void queue_loop(void *ignore) void _LP_queuesend(uint32_t crc32,int32_t sock0,int32_t sock1,uint8_t *msg,int32_t msglen,int32_t needack) { - int32_t sentbytes,peerind = 0; + int32_t peerind = 0; //sentbytes, if ( sock0 >= 0 || sock1 >= 0 ) { - if ( sock0 >= 0 && LP_sockcheck(sock0) > 0 ) +/* if ( sock0 >= 0 && LP_sockcheck(sock0) > 0 ) { if ( (sentbytes= nn_send(sock0,msg,msglen,0)) != msglen ) printf("_LP_queuesend0 sent %d instead of %d\n",sentbytes,msglen); else { - //printf("Q sent %u msglen.%d (%s)\n",crc32,msglen,msg); +printf("Q sent %u msglen.%d (%s)\n",crc32,msglen,msg); sock0 = -1; } } @@ -223,10 +223,14 @@ void _LP_queuesend(uint32_t crc32,int32_t sock0,int32_t sock1,uint8_t *msg,int32 { if ( (sentbytes= nn_send(sock1,msg,msglen,0)) != msglen ) printf("_LP_queuesend1 sent %d instead of %d\n",sentbytes,msglen); - else sock1 = -1; + else + { +printf("Q sent1 %u msglen.%d (%s)\n",crc32,msglen,msg); + sock1 = -1; + } } if ( sock0 < 0 && sock1 < 0 ) - return; + return;*/ } else { From e64a537d8d590407f36ceb4602f991b9cc8bfbfc Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:32:54 +0300 Subject: [PATCH 271/346] Test --- iguana/exchanges/LP_commands.c | 4 ++-- iguana/exchanges/LP_nativeDEX.c | 2 ++ iguana/exchanges/LP_network.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 9c3419f72..08f5c888e 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -474,7 +474,7 @@ dividends(coin, height, )\n\ retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) { - //printf("GOT ADDR_UNSPENTS\n"); + printf("GOT ADDR_UNSPENTS %s %s\n",jstr(argjson,"coin"),jstr(argjson,"address")); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { char *coinaddr; //cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; @@ -550,7 +550,7 @@ dividends(coin, height, )\n\ else { memset(zero.bytes,0,sizeof(zero)); - //printf("broadcast.(%s)\n",msg); +printf("broadcast.(%s)\n",Broadcaststr); LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); } retstr = clonestr("{\"result\":\"success\"}"); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0be040be1..28381fcb9 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -710,7 +710,9 @@ int32_t LP_reserved_msgs() if ( nn_poll(&pfd,1,1) != 1 ) break;*/ num_Reserved_msgs--; +#ifdef __APPLE__ printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); +#endif LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); Reserved_msgs[num_Reserved_msgs] = 0; n++; diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index b85f044f4..1806052b4 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -158,7 +158,9 @@ void queue_loop(void *ignore) { if ( (sentbytes= nn_send(ptr->sock,ptr->msg,ptr->msglen,0)) != ptr->msglen ) printf("%d LP_send sent %d instead of %d\n",n,sentbytes,ptr->msglen); +#ifdef __APPLE__ else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->msglen,ptr->peerind,ptr->msg); +#endif ptr->sock = -1; if ( ptr->peerind > 0 ) ptr->starttime = (uint32_t)time(NULL); From 4be753cae6ee28d4f6906d9434eabfbbc9e08039 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:33:41 +0300 Subject: [PATCH 272/346] Test --- iguana/exchanges/LP_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 08f5c888e..b2e3aca50 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -551,7 +551,7 @@ dividends(coin, height, )\n\ { memset(zero.bytes,0,sizeof(zero)); printf("broadcast.(%s)\n",Broadcaststr); - LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); + //LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); } retstr = clonestr("{\"result\":\"success\"}"); } else retstr = clonestr("{\"error\":\"couldnt dereference sendmessage\"}"); From e30cb837003987f790a701e29aeaf9370ecc9914 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:34:58 +0300 Subject: [PATCH 273/346] Test --- iguana/exchanges/LP_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index b2e3aca50..08f5c888e 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -551,7 +551,7 @@ dividends(coin, height, )\n\ { memset(zero.bytes,0,sizeof(zero)); printf("broadcast.(%s)\n",Broadcaststr); - //LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); + LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); } retstr = clonestr("{\"result\":\"success\"}"); } else retstr = clonestr("{\"error\":\"couldnt dereference sendmessage\"}"); From b40718b3f2a0256488163c9ac8a9e314908adce5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:42:07 +0300 Subject: [PATCH 274/346] Test --- iguana/exchanges/LP_network.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 1806052b4..34ed24c0f 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -208,7 +208,7 @@ else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->m void _LP_queuesend(uint32_t crc32,int32_t sock0,int32_t sock1,uint8_t *msg,int32_t msglen,int32_t needack) { - int32_t peerind = 0; //sentbytes, + int32_t maxind,peerind = 0; //sentbytes, if ( sock0 >= 0 || sock1 >= 0 ) { /* if ( sock0 >= 0 && LP_sockcheck(sock0) > 0 ) @@ -236,7 +236,9 @@ printf("Q sent1 %u msglen.%d (%s)\n",crc32,msglen,msg); } else { - peerind = 1; + if ( (maxind= LP_numpeers()) > 0 ) + peerind = (rand() % maxind); + else peerind = 0; sock0 = LP_peerindsock(&peerind); } if ( sock0 >= 0 ) From 93f815c15cb14df11f1f34ceeaab7df110eb3041 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:43:02 +0300 Subject: [PATCH 275/346] Test --- iguana/exchanges/LP_include.h | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index a292f1be1..c18048077 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -316,6 +316,7 @@ struct LP_transaction *LP_transactionfind(struct iguana_info *coin,bits256 txid) cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJSON *txobj); int32_t LP_mempoolscan(char *symbol,bits256 searchtxid); int32_t LP_txheight(struct iguana_info *coin,bits256 txid); +int32_t LP_numpeers(); int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight); void LP_smartutxos_push(struct iguana_info *coin); cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret); From 1e78dc5b062287ff1a1c20f86469cc76e0216da6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:50:29 +0300 Subject: [PATCH 276/346] Test --- iguana/exchanges/LP_nativeDEX.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 28381fcb9..31e006822 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -244,7 +244,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int break; if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 ) { -//printf("RECV.(%s)\n",(char *)ptr); +printf("%s RECV.(%s)\n",typestr,(char *)ptr); nonz++; if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 ) free(retstr); @@ -349,7 +349,7 @@ void LP_smartutxos_push(struct iguana_info *coin) vout = jint(item,"tx_pos"); value = j64bits(item,"value"); height = jint(item,"height"); - if ( IAMLP == 0 ) + if ( 0 && IAMLP == 0 ) { HASH_ITER(hh,LP_peerinfos,peer,tmp) { @@ -711,7 +711,7 @@ int32_t LP_reserved_msgs() break;*/ num_Reserved_msgs--; #ifdef __APPLE__ - printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); +// printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); #endif LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); Reserved_msgs[num_Reserved_msgs] = 0; From edb5b4648bef9c06e9be500022d4e0827053358f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:55:02 +0300 Subject: [PATCH 277/346] Test --- iguana/exchanges/LP_nativeDEX.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 31e006822..01f7fe5ce 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -244,7 +244,18 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int break; if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 ) { -printf("%s RECV.(%s)\n",typestr,(char *)ptr); + { + cJSON *recvjson; char *mstr,*cstr; + if ( (recvjson= cJSON_Parse((char *)ptr)) != 0 ) + { + if ( (mstr= jstr(recvjson,"method")) != 0 && strcmp(mstr,"uitem") == 0 && + (mstr= jstr(recvjson,"coin")) != 0 && strcmp(cstr,"REVS") == 0 ) + { + printf("%s RECV.(%s)\n",typestr,(char *)ptr); + } + free_json(recvjson); + } + } nonz++; if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 ) free(retstr); From 0c27e303c9b560ed7b012c946143add821159e20 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 16:58:55 +0300 Subject: [PATCH 278/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 01f7fe5ce..a0cdf8e84 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -249,7 +249,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int if ( (recvjson= cJSON_Parse((char *)ptr)) != 0 ) { if ( (mstr= jstr(recvjson,"method")) != 0 && strcmp(mstr,"uitem") == 0 && - (mstr= jstr(recvjson,"coin")) != 0 && strcmp(cstr,"REVS") == 0 ) + (cstr= jstr(recvjson,"coin")) != 0 && strcmp(cstr,"REVS") == 0 ) { printf("%s RECV.(%s)\n",typestr,(char *)ptr); } From 9907d83c5d5d5754ee6ae9af18a54288eb894a3e Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:01:18 +0300 Subject: [PATCH 279/346] Test --- iguana/exchanges/LP_network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 34ed24c0f..a85336b6b 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -87,7 +87,7 @@ void _LP_sendqueueadd(uint32_t crc32,int32_t sock,uint8_t *msg,int32_t msglen,in int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32) { - static uint32_t crcs[8192]; static unsigned long dup,total; + static uint32_t crcs[8]; static unsigned long dup,total; int32_t i; *duplicatep = 0; if ( ind < 0 ) From febb54665275ad6eba7210a6bd8faa3e8f7c2335 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:05:18 +0300 Subject: [PATCH 280/346] Test --- iguana/exchanges/LP_network.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index a85336b6b..83feb7d32 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -280,6 +280,9 @@ void LP_broadcast_finish(int32_t pubsock,char *base,char *rel,uint8_t *msg,cJSON free(msg); jdelete(argjson,"method"); jaddstr(argjson,"method","broadcast"); + if ( jobj(argjson,"timestamp") == 0 ) + jaddnum(argjson,"timestamp",(uint32_t)time(NULL)); + // add signature here msg = (void *)jprint(argjson,0); msglen = (int32_t)strlen((char *)msg) + 1; LP_queuesend(crc32,-1,base,rel,msg,msglen); From 936dde1436627498a3358bc683fc72cacc1ed81b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:07:47 +0300 Subject: [PATCH 281/346] Test --- iguana/exchanges/LP_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 08f5c888e..742bc954e 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -433,7 +433,7 @@ dividends(coin, height, )\n\ coinaddr = jstr(argjson,"coinaddr"); if ( coin != 0 && coinaddr != 0 ) { - //char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); + char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1); } return(clonestr("{\"result\":\"success\"}")); From c4d021584c9ee4dfef317a855624d8b2f399726d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:14:43 +0300 Subject: [PATCH 282/346] Test --- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_network.c | 2 +- iguana/exchanges/LP_utxo.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index a0cdf8e84..2a4dfd88c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -244,6 +244,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int break; if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 ) { + if ( 0 ) { cJSON *recvjson; char *mstr,*cstr; if ( (recvjson= cJSON_Parse((char *)ptr)) != 0 ) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 83feb7d32..d5ef33335 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -87,7 +87,7 @@ void _LP_sendqueueadd(uint32_t crc32,int32_t sock,uint8_t *msg,int32_t msglen,in int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32) { - static uint32_t crcs[8]; static unsigned long dup,total; + static uint32_t crcs[8192]; static unsigned long dup,total; int32_t i; *duplicatep = 0; if ( ind < 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index c9d10c4ad..5b3d39678 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -193,7 +193,7 @@ struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coina int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight) { struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; - //printf("%s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); +printf("%s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); if ( coin == 0 ) return(0); if ( spendheight > 0 ) // dont autocreate entries for spends we dont care about @@ -217,7 +217,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, up->spendheight = spendheight, flag |= 4; if ( up->U.value == 0 && up->U.value != value ) up->U.value = value, flag |= 8; - //printf("found >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); +printf("found >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); break; } } @@ -227,7 +227,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, { if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) == 0 ) { - //printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,txid),vout); + printf("prevent utxoadd since gettxout %s %s %s/v%d missing\n",coin->symbol,coinaddr,bits256_str(str,txid),vout); return(0); } else free_json(txobj); } From 55ce2b639456547db01ab046e2a6d75d55583b28 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:19:35 +0300 Subject: [PATCH 283/346] Test --- iguana/exchanges/LP_commands.c | 2 ++ iguana/exchanges/LP_network.c | 2 +- iguana/exchanges/LP_utxo.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 742bc954e..024b22b71 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -265,6 +265,8 @@ dividends(coin, height, )\n\ //* if ( (ptr= LP_coinsearch(coin)) != 0 ) { + if ( ptr->userpass[0] == 0 ) + return(clonestr("{\"error\":\"couldnt find coin locally installed\"}")); if ( LP_conflicts_find(ptr) == 0 ) { ptr->inactive = 0; diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index d5ef33335..f997427d2 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -177,7 +177,7 @@ else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->m printf("found.%u Q.%d err.%d match.%d\n",ptr->crc32,LP_Qenqueued,LP_Qerrors,LP_Qfound); flag = 1; } - else + else if ( 0 ) // too much beyond duplicate filter when network is busy { printf("couldnt find.%u peerind.%d Q.%d err.%d match.%d\n",ptr->crc32,ptr->peerind,LP_Qenqueued,LP_Qerrors,LP_Qfound); ptr->peerind++; diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 5b3d39678..e83007e48 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -193,12 +193,12 @@ struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coina int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight) { struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; -printf("%s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); if ( coin == 0 ) return(0); if ( spendheight > 0 ) // dont autocreate entries for spends we dont care about ap = LP_addressfind(coin,coinaddr); else ap = LP_address(coin,coinaddr); + printf("%s add addr.%s ht.%d ap.%p\n",coin->symbol,coinaddr,height,ap); if ( ap != 0 ) { flag = 0; From d6123ab68a2d1f1cdb4a59f0151942ee2cf77702 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:23:22 +0300 Subject: [PATCH 284/346] Test --- iguana/exchanges/LP_commands.c | 8 ++++---- iguana/exchanges/LP_utxo.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 024b22b71..93bb74152 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -435,7 +435,7 @@ dividends(coin, height, )\n\ coinaddr = jstr(argjson,"coinaddr"); if ( coin != 0 && coinaddr != 0 ) { - char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); + //char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1); } return(clonestr("{\"result\":\"success\"}")); @@ -476,7 +476,7 @@ dividends(coin, height, )\n\ retstr = LP_spentcheck(argjson); else if ( strcmp(method,"addr_unspents") == 0 ) { - printf("GOT ADDR_UNSPENTS %s %s\n",jstr(argjson,"coin"),jstr(argjson,"address")); + //printf("GOT ADDR_UNSPENTS %s %s\n",jstr(argjson,"coin"),jstr(argjson,"address")); if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 ) { char *coinaddr; //cJSON *array,*item,*req; int32_t i,n,vout,height; bits256 zero,txid; uint64_t value; @@ -486,7 +486,7 @@ dividends(coin, height, )\n\ { if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { - printf("ADDR_UNSPENTS %s %s is my address being asked for!\n",ptr->symbol,coinaddr); + //printf("ADDR_UNSPENTS %s %s is my address being asked for!\n",ptr->symbol,coinaddr); ptr->addr_listunspent_requested = (uint32_t)time(NULL); } } @@ -552,7 +552,7 @@ dividends(coin, height, )\n\ else { memset(zero.bytes,0,sizeof(zero)); -printf("broadcast.(%s)\n",Broadcaststr); +//printf("broadcast.(%s)\n",Broadcaststr); LP_reserved_msg(base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); } retstr = clonestr("{\"result\":\"success\"}"); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index e83007e48..a846975c6 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -198,7 +198,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, if ( spendheight > 0 ) // dont autocreate entries for spends we dont care about ap = LP_addressfind(coin,coinaddr); else ap = LP_address(coin,coinaddr); - printf("%s add addr.%s ht.%d ap.%p\n",coin->symbol,coinaddr,height,ap); + //printf("%s add addr.%s ht.%d ap.%p\n",coin->symbol,coinaddr,height,ap); if ( ap != 0 ) { flag = 0; @@ -217,7 +217,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, up->spendheight = spendheight, flag |= 4; if ( up->U.value == 0 && up->U.value != value ) up->U.value = value, flag |= 8; -printf("found >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); +//printf("found >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); break; } } From ce49af85d639a2d6a4f6577f480e0fe8d3db2c41 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:25:16 +0300 Subject: [PATCH 285/346] Test --- iguana/exchanges/LP_network.c | 2 +- iguana/exchanges/LP_utxo.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index f997427d2..0036a4e86 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -159,7 +159,7 @@ void queue_loop(void *ignore) if ( (sentbytes= nn_send(ptr->sock,ptr->msg,ptr->msglen,0)) != ptr->msglen ) printf("%d LP_send sent %d instead of %d\n",n,sentbytes,ptr->msglen); #ifdef __APPLE__ -else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->msglen,ptr->peerind,ptr->msg); +//else printf("%d %p qsent %u msglen.%d peerind.%d (%s)\n",n,ptr,ptr->crc32,ptr->msglen,ptr->peerind,ptr->msg); #endif ptr->sock = -1; if ( ptr->peerind > 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index a846975c6..1a88b000c 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -154,13 +154,13 @@ struct LP_utxoinfo *LP_allocated(bits256 txid,int32_t vout) int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap,char *coinaddr) { struct LP_address_utxo *up,*tmp; int32_t n = 0; - printf("LP_address_utxo_ptrs for (%s).(%s)\n",ap->coinaddr,coinaddr); + //printf("LP_address_utxo_ptrs for (%s).(%s)\n",ap->coinaddr,coinaddr); if ( strcmp(ap->coinaddr,coinaddr) != 0 ) printf("UNEXPECTED coinaddr mismatch (%s) != (%s)\n",ap->coinaddr,coinaddr); portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight); + //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) From e7e3d5df43a2793586f5070be98a9a6cdbe172b4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:26:53 +0300 Subject: [PATCH 286/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/assetchains.old | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100755 iguana/exchanges/assetchains.old diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 2a4dfd88c..670f77bdb 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -573,7 +573,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int memset(&zero,0,sizeof(zero)); if ( coin->addr_listunspent_requested != 0 ) { - printf("PUSH addr_listunspent_requested %u\n",coin->addr_listunspent_requested); + //printf("PUSH addr_listunspent_requested %u\n",coin->addr_listunspent_requested); LP_smartutxos_push(coin); coin->addr_listunspent_requested = 0; } diff --git a/iguana/exchanges/assetchains.old b/iguana/exchanges/assetchains.old new file mode 100755 index 000000000..e7584afcd --- /dev/null +++ b/iguana/exchanges/assetchains.old @@ -0,0 +1,89 @@ +#!/bin/bash +set -x +delay=60 +source pubkey.txt +echo $pubkey + +./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 & +#./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=COQUI -ac_supply=72000000 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=148.251.190.89 $1 & +./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=MNZ -ac_supply=257142858 -addnode=51.15.138.138 $1 & +sleep $delay + +./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=EUR -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=JPY -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=GBP -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=AUD -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=CAD -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=CHF -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=NZD -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=CNY -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=RUB -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=MXN -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=BRL -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=INR -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=HKD -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=TRY -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=ZAR -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=PLN -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=NOK -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=SEK -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=DKK -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=CZK -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=HUF -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=ILS -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=KRW -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=MYR -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=PHP -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=RON -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=SGD -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=THB -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=BGN -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 & +sleep $delay +./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 & From 350c25538d8d7c31a6cce680de4d1e2ca897bf89 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:27:54 +0300 Subject: [PATCH 287/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 1a88b000c..b144a95c4 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -242,7 +242,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, portable_mutex_unlock(&coin->addrmutex); retval = 1; if ( 1 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) - printf("ADDRESS_UTXO >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); + printf("ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); //printf("done %s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); From bfb02173da98d96063021758644635f180291e9f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:38:26 +0300 Subject: [PATCH 288/346] Test --- iguana/exchanges/LP_prices.c | 2 +- iguana/exchanges/LP_socket.c | 4 ++++ iguana/exchanges/LP_utxo.c | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index f91916e73..b49cbcd17 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -167,7 +167,7 @@ struct LP_address *_LP_addressadd(struct iguana_info *coin,char *coinaddr) ap->pubkey = pubp->pubkey; memcpy(ap->pubsecp,pubp->pubsecp,sizeof(ap->pubsecp)); } - //printf("LP_ADDRESS %s ADD.(%s)\n",coin->symbol,coinaddr); + printf("LP_ADDRESS %s ADD.(%s)\n",coin->symbol,coinaddr); HASH_ADD_KEYPTR(hh,coin->addresses,ap->coinaddr,strlen(ap->coinaddr),ap); return(ap); } diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index afca7e887..2c3eb1e6e 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -350,7 +350,10 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep } } if ( value != 0 || tx->height > 0 ) + { + printf("from electrum_process_array\n"); flag += LP_address_utxoadd(coin,coinaddr,txid,v,value,tx->height,-1); + } //printf("v.%d numvouts.%d %.8f (%s)\n",v,tx->numvouts,dstr(tx->outpoints[jint(item,"tx_pos")].value),jprint(item,0)); } //else printf("cant find tx\n"); } @@ -481,6 +484,7 @@ cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON * if ( tx->height > 0 && tx->height != height ) printf("update %s height.%d <- %d\n",bits256_str(str,txid),tx->height,height); tx->height = height; + printf("from history\n"); LP_address_utxoadd(coin,addr,txid,0,0,height,-1); } } diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b144a95c4..4eb2a4f65 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -178,7 +178,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout) { struct LP_address *ap; struct LP_address_utxo *up,*tmp; - //printf("%s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); + printf("LP_address_utxofind %s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); if ( (ap= _LP_address(coin,coinaddr)) != 0 ) { DL_FOREACH_SAFE(ap->utxos,up,tmp) @@ -227,7 +227,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, { if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) == 0 ) { - printf("prevent utxoadd since gettxout %s %s %s/v%d missing\n",coin->symbol,coinaddr,bits256_str(str,txid),vout); + //printf("prevent utxoadd since gettxout %s %s %s/v%d missing\n",coin->symbol,coinaddr,bits256_str(str,txid),vout); return(0); } else free_json(txobj); } @@ -484,6 +484,7 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array) } if ( errs == 0 ) { + printf("from LP_unspents_array\n"); LP_address_utxoadd(coin,coinaddr,txid,v,val,height,-1); count++; } @@ -631,6 +632,8 @@ uint64_t LP_txinterestvalue(uint64_t *interestp,char *destaddr,struct iguana_inf cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJSON *txobj) { struct LP_transaction *tx; int32_t i,height,numvouts,numvins,spentvout; cJSON *vins,*vouts,*vout,*vin; bits256 spenttxid; char str[65]; + if ( coin->inactive != 0 ) + return(0); if ( txobj != 0 || (txobj= LP_gettx(coin->symbol,txid)) != 0 ) { if ( coin->electrum == 0 ) From 38ed48ded8e5de429c6e10a4e9dafd9ea27aff74 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:40:59 +0300 Subject: [PATCH 289/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_utxo.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 670f77bdb..7f6055f7a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -377,7 +377,7 @@ void LP_smartutxos_push(struct iguana_info *coin) jaddnum(req,"vout",vout); jaddnum(req,"ht",height); jadd64bits(req,"value",value); - printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); + //printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0)); LP_reserved_msg("","",zero,jprint(req,1)); } } diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 4eb2a4f65..9c624010c 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -178,7 +178,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout) { struct LP_address *ap; struct LP_address_utxo *up,*tmp; - printf("LP_address_utxofind %s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); + printf("LP_address_utxofind %s add addr.%s\n",coin->symbol,coinaddr); if ( (ap= _LP_address(coin,coinaddr)) != 0 ) { DL_FOREACH_SAFE(ap->utxos,up,tmp) @@ -651,6 +651,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS tx->outpoints[i].value = LP_value_extract(vout,0); tx->outpoints[i].interest = SATOSHIDEN * jdouble(vout,"interest"); LP_destaddr(tx->outpoints[i].coinaddr,vout); + printf("from transaction init\n"); LP_address_utxoadd(coin,tx->outpoints[i].coinaddr,txid,i,tx->outpoints[i].value,height,-1); } //printf("numvouts.%d\n",numvouts); From 2e6fba307f94e6b25a6ea44691bbff38c71dad4f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:50:19 +0300 Subject: [PATCH 290/346] Test --- iguana/exchanges/LP_commands.c | 2 ++ iguana/exchanges/LP_socket.c | 4 ++-- iguana/exchanges/LP_utxo.c | 4 ++-- iguana/exchanges/LP_utxos.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 93bb74152..519546882 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -451,6 +451,7 @@ dividends(coin, height, )\n\ { if ( coinaddr[0] != 0 ) { + LP_address(ptr,coinaddr); LP_listunspent_issue(coin,coinaddr,1); if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { @@ -484,6 +485,7 @@ dividends(coin, height, )\n\ { if ( coinaddr[0] != 0 ) { + LP_address(ptr,coinaddr); if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) { //printf("ADDR_UNSPENTS %s %s is my address being asked for!\n",ptr->symbol,coinaddr); diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 2c3eb1e6e..cb697972a 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -351,7 +351,7 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep } if ( value != 0 || tx->height > 0 ) { - printf("from electrum_process_array\n"); + //printf("from electrum_process_array\n"); flag += LP_address_utxoadd(coin,coinaddr,txid,v,value,tx->height,-1); } //printf("v.%d numvouts.%d %.8f (%s)\n",v,tx->numvouts,dstr(tx->outpoints[jint(item,"tx_pos")].value),jprint(item,0)); @@ -484,7 +484,7 @@ cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON * if ( tx->height > 0 && tx->height != height ) printf("update %s height.%d <- %d\n",bits256_str(str,txid),tx->height,height); tx->height = height; - printf("from history\n"); + //printf("from history\n"); LP_address_utxoadd(coin,addr,txid,0,0,height,-1); } } diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 9c624010c..fe2ccfcad 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -241,7 +241,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 1 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) + if ( 0 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) printf("ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); @@ -484,7 +484,7 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array) } if ( errs == 0 ) { - printf("from LP_unspents_array\n"); + //printf("from LP_unspents_array\n"); LP_address_utxoadd(coin,coinaddr,txid,v,val,height,-1); count++; } diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index de147122b..b467bf294 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -520,6 +520,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri //printf("privkey init.(%s) %s\n",coin->symbol,coin->smartaddr); if ( coin->inactive == 0 ) LP_listunspent_issue(coin->symbol,coin->smartaddr,0); + LP_address(coin,coin->smartaddr); if ( coin->inactive == 0 && (array= LP_listunspent(coin->symbol,coin->smartaddr)) != 0 ) { txfee = LP_txfeecalc(coin,0,0); From 5f9a8c3f20eb0b99d2096b719a54d48ad88dfb05 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:51:00 +0300 Subject: [PATCH 291/346] Test --- iguana/exchanges/LP_utxo.c | 4 ++-- iguana/exchanges/LP_utxos.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index fe2ccfcad..62fae25ae 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -651,8 +651,8 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS tx->outpoints[i].value = LP_value_extract(vout,0); tx->outpoints[i].interest = SATOSHIDEN * jdouble(vout,"interest"); LP_destaddr(tx->outpoints[i].coinaddr,vout); - printf("from transaction init\n"); - LP_address_utxoadd(coin,tx->outpoints[i].coinaddr,txid,i,tx->outpoints[i].value,height,-1); + //printf("from transaction init\n"); + //LP_address_utxoadd(coin,tx->outpoints[i].coinaddr,txid,i,tx->outpoints[i].value,height,-1); } //printf("numvouts.%d\n",numvouts); } diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index b467bf294..5e258fbd0 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -520,7 +520,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri //printf("privkey init.(%s) %s\n",coin->symbol,coin->smartaddr); if ( coin->inactive == 0 ) LP_listunspent_issue(coin->symbol,coin->smartaddr,0); - LP_address(coin,coin->smartaddr); + LP_address(coin,coin->smart`addr); if ( coin->inactive == 0 && (array= LP_listunspent(coin->symbol,coin->smartaddr)) != 0 ) { txfee = LP_txfeecalc(coin,0,0); From 99d27240095d2d79bc6996b0ad820e2817b6a25d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:51:56 +0300 Subject: [PATCH 292/346] Test --- iguana/exchanges/LP_utxos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 5e258fbd0..b467bf294 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -520,7 +520,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri //printf("privkey init.(%s) %s\n",coin->symbol,coin->smartaddr); if ( coin->inactive == 0 ) LP_listunspent_issue(coin->symbol,coin->smartaddr,0); - LP_address(coin,coin->smart`addr); + LP_address(coin,coin->smartaddr); if ( coin->inactive == 0 && (array= LP_listunspent(coin->symbol,coin->smartaddr)) != 0 ) { txfee = LP_txfeecalc(coin,0,0); From f261c7176d5bf79ae888b9cd868362e55f7c18c6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 17:53:15 +0300 Subject: [PATCH 293/346] Test --- iguana/exchanges/LP_utxo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 62fae25ae..9244889b8 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -178,7 +178,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout) { struct LP_address *ap; struct LP_address_utxo *up,*tmp; - printf("LP_address_utxofind %s add addr.%s\n",coin->symbol,coinaddr); + //printf("LP_address_utxofind %s add addr.%s\n",coin->symbol,coinaddr); if ( (ap= _LP_address(coin,coinaddr)) != 0 ) { DL_FOREACH_SAFE(ap->utxos,up,tmp) From 814e1a3cc93363c59117d165a64f1977960a58d9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 18:17:11 +0300 Subject: [PATCH 294/346] New auto price --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_socket.c | 4 ++-- iguana/exchanges/autoprice | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7f6055f7a..5c159e440 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -361,7 +361,7 @@ void LP_smartutxos_push(struct iguana_info *coin) vout = jint(item,"tx_pos"); value = j64bits(item,"value"); height = jint(item,"height"); - if ( 0 && IAMLP == 0 ) + if ( (rand() % 100) == 0 && IAMLP == 0 ) { HASH_ITER(hh,LP_peerinfos,peer,tmp) { diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index cb697972a..53d800a1d 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -547,9 +547,9 @@ cJSON *electrum_getchunk(char *symbol,struct electrum_info *ep,cJSON **retjsonp, cJSON *LP_transaction_fromdata(struct iguana_info *coin,bits256 txid,uint8_t *serialized,int32_t len) { uint8_t *extraspace; cJSON *txobj; char str[65],str2[65]; struct iguana_msgtx msgtx; bits256 checktxid; - extraspace = calloc(1,1000000); + extraspace = calloc(1,4000000); memset(&msgtx,0,sizeof(msgtx)); - txobj = bitcoin_data2json(coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->height,&checktxid,&msgtx,extraspace,1000000,serialized,len,0,0); + txobj = bitcoin_data2json(coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->height,&checktxid,&msgtx,extraspace,4000000,serialized,len,0,0); //printf("TX.(%s) match.%d\n",jprint(txobj,0),bits256_cmp(txid,checktxid)); free(extraspace); if ( bits256_cmp(txid,checktxid) != 0 ) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index a95a3f5e3..5cb422e84 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -8,3 +8,4 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" From 8623e767c9f9f9d078c809a660cd9f48c2ec8d7d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:23:38 +0300 Subject: [PATCH 295/346] New autoprice --- iguana/exchanges/LP_commands.c | 4 +- iguana/exchanges/LP_portfolio.c | 75 +++++++++++++++++++++++++++------ iguana/exchanges/LP_prices.c | 3 ++ 3 files changed, 68 insertions(+), 14 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 519546882..31679e2eb 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -97,7 +97,7 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *r available localhost RPC commands: * means it needs to be a signed request\n \ pricearray(base, rel, firsttime=0, lasttime=-1, timescale=60) -> [timestamp, avebid, aveask, highbid, lowask]\n\ setprice(base, rel, price)*\n\ -autoprice(base, rel, price, margin, type)*\n\ +autoprice(base, rel, minprice, margin, refbase, refrel, factor, offset)*\n\ goal(coin=*, val=)*\n\ myprice(base, rel)\n\ enable(coin)*\n\ @@ -214,7 +214,7 @@ dividends(coin, height, )\n\ else if ( strcmp(method,"autoprice") == 0 ) { //LP_signature_add(argjson,base,rel,(uint64_t)price * SATOSHIDEN); - if ( LP_autoprice(base,rel,price,jdouble(argjson,"margin"),jstr(argjson,"type")) < 0 ) + if ( LP_autoprice(base,rel,argjson) < 0 ) return(clonestr("{\"error\":\"couldnt set autoprice\"}")); else return(clonestr("{\"result\":\"success\"}")); } diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 75e8fd330..e6cbf31db 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -198,7 +198,12 @@ char *LP_portfolio_goal(char *symbol,double goal) } else return(clonestr("{\"error\":\"cant set goal for inactive coin\"}")); } -int32_t LP_autoprices; +int32_t LP_autoprices,num_LP_autorefs; + +struct LP_autoprice_ref +{ + char refbase[16],refrel[16],base[16],rel[16]; +} LP_autorefs[100]; /*int32_t LP_autofill(char *base,char *rel,double maxprice,double totalrelvolume) { @@ -213,26 +218,65 @@ int32_t LP_autoprices; return(-1); }*/ -int32_t LP_autoprice(char *base,char *rel,double minprice,double margin,char *type) +int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) { - struct LP_priceinfo *basepp,*relpp; + //curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" + struct LP_priceinfo *basepp,*relpp; int32_t i; char *refbase,*refrel; double minprice,margin,offset,factor; if ( (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { + if ( jobj(argjson,"minprice") != 0 ) + minprice = jdouble(argjson,"minprice"); + else minprice = 0.; + margin = jdouble(argjson,"margin"); + offset = jdouble(argjson,"offset"); + factor = jdouble(argjson,"factor"); basepp->minprices[relpp->ind] = minprice; basepp->margins[relpp->ind] = margin; + basepp->offsets[relpp->ind] = offset; + basepp->factors[relpp->ind] = factor; + if ( (refbase= jstr(argjson,"refbase")) != 0 && (refrel= jstr(argjson,"refrel")) != 0 ) + { + for (i=0; imargins[relpp->ind]; oppomargin = relpp->margins[basepp->ind]; if ( margin != 0. || oppomargin != 0. ) { + if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 ) + { + price = LP_myprice(&bid,&ask,refbase,refrel); + printf("USE ref %s/%s %.8f\n",refbase,refrel,price); + } + offset = basepp->offsets[relpp->ind]; + if ( (factor= basepp->factors[relpp->ind]) > SMALLVAL ) + price = (price * factor) + offset; if ( margin == 0. ) margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); @@ -325,8 +369,8 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - LP_autopriceset(ctx,1,refpp,coinpp,price); - LP_autopriceset(ctx,-1,coinpp,refpp,price); + LP_autopriceset(ctx,1,refpp,coinpp,price,0,0); + LP_autopriceset(ctx,-1,coinpp,refpp,price,0,0); } } } @@ -358,7 +402,7 @@ static char *assetids[][3] = void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { - char *retstr; cJSON *retjson,*bid,*ask; uint64_t bidsatoshis,asksatoshis; int32_t i; double nxtkmd,price; struct LP_priceinfo *kmdpp,*fiatpp,*nxtpp; + char *retstr; cJSON *retjson,*bid,*ask; uint64_t bidsatoshis,asksatoshis; int32_t i; double nxtkmd,price; struct LP_priceinfo *kmdpp,*fiatpp,*nxtpp,*basepp,*relpp; if ( (retstr= issue_curlt("https://bittrex.com/api/v1.1/public/getmarketsummaries",LP_HTTP_TIMEOUT*10)) == 0 ) { printf("trex error getting marketsummaries\n"); @@ -385,8 +429,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - LP_autopriceset(ctx,1,kmdpp,fiatpp,price); - LP_autopriceset(ctx,-1,fiatpp,kmdpp,price); + LP_autopriceset(ctx,1,kmdpp,fiatpp,price,0,0); + LP_autopriceset(ctx,-1,fiatpp,kmdpp,price,0,0); free_json(retjson); } } @@ -409,14 +453,21 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - LP_autopriceset(ctx,1,kmdpp,nxtpp,price); - LP_autopriceset(ctx,-1,nxtpp,kmdpp,price); + LP_autopriceset(ctx,1,kmdpp,nxtpp,price,0,0); + LP_autopriceset(ctx,-1,nxtpp,kmdpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); } } } } + for (i=0; i 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { + if ( fabs(basepp->myprices[relpp->ind] - price) > SMALLVAL ) *changedp = 1; basepp->myprices[relpp->ind] = price; // ask From 722815c4ad605cfd32c3a5cc9b6d26889b04de54 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:26:10 +0300 Subject: [PATCH 296/346] Test --- iguana/exchanges/enable | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/enable b/iguana/exchanges/enable index 75c0bc838..90b006dfe 100755 --- a/iguana/exchanges/enable +++ b/iguana/exchanges/enable @@ -2,3 +2,4 @@ source userpass curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"REVS\"}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"CHIPS\"}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"MNZ\"}" From b58933919d4ac282ac4313452513474f17fc74b0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:30:35 +0300 Subject: [PATCH 297/346] Test --- iguana/exchanges/autoprice | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index 5cb422e84..ab4e2e6b7 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -8,4 +8,4 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" From 6e89d6c560bf19bb8d130f776c01e610a8a9182a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:32:06 +0300 Subject: [PATCH 298/346] Test --- iguana/exchanges/LP_portfolio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index e6cbf31db..07f177806 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -222,6 +222,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) { //curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" struct LP_priceinfo *basepp,*relpp; int32_t i; char *refbase,*refrel; double minprice,margin,offset,factor; + printf("autoprice.(%s %s) %s\n",base,rel,jprint(argjson,0)); if ( (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { if ( jobj(argjson,"minprice") != 0 ) From 2ab48b722d22af7dea2f2169f2f4676b32777627 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:47:05 +0300 Subject: [PATCH 299/346] Test --- iguana/exchanges/LP_portfolio.c | 12 ++++++++---- iguana/exchanges/autoprice | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 07f177806..7f719356f 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -222,7 +222,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) { //curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" struct LP_priceinfo *basepp,*relpp; int32_t i; char *refbase,*refrel; double minprice,margin,offset,factor; - printf("autoprice.(%s %s) %s\n",base,rel,jprint(argjson,0)); + //printf("autoprice.(%s %s) %s\n",base,rel,jprint(argjson,0)); if ( (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { if ( jobj(argjson,"minprice") != 0 ) @@ -270,14 +270,18 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *relpp,struct LP_ oppomargin = relpp->margins[basepp->ind]; if ( margin != 0. || oppomargin != 0. ) { + offset = basepp->offsets[relpp->ind]; + factor = basepp->factors[relpp->ind]; if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 ) { price = LP_myprice(&bid,&ask,refbase,refrel); - printf("USE ref %s/%s %.8f\n",refbase,refrel,price); + printf("USE ref %s/%s %.8f factor %.8f offset %.8f\n",refbase,refrel,price,factor,offset); } - offset = basepp->offsets[relpp->ind]; - if ( (factor= basepp->factors[relpp->ind]) > SMALLVAL ) + if ( factor > SMALLVAL ) + { + printf("price %.8f -> %.8f\n",price,(price * factor) + offset); price = (price * factor) + offset; + } if ( margin == 0. ) margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index ab4e2e6b7..9ec3ce3f1 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -8,4 +8,4 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.1,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":0.01}" From 771fe9b3d0dc6fd82efc7326d343d423cda8fdad Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:54:12 +0300 Subject: [PATCH 300/346] Test --- iguana/exchanges/LP_portfolio.c | 39 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 7f719356f..0c58e6713 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -243,7 +243,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) { safecopy(LP_autorefs[i].refbase,refbase,sizeof(LP_autorefs[i].refbase)); safecopy(LP_autorefs[i].refrel,refrel,sizeof(LP_autorefs[i].refrel)); - printf("%d Update ref %s/%s for %s/%s\n",i,refbase,refrel,base,rel); + printf("%d Update ref %s/%s for %s/%s factor %.8f offset %.8f\n",i,refbase,refrel,base,rel,factor,offset); break; } } @@ -253,7 +253,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) safecopy(LP_autorefs[num_LP_autorefs].refrel,refrel,sizeof(LP_autorefs[num_LP_autorefs].refrel)); safecopy(LP_autorefs[num_LP_autorefs].base,base,sizeof(LP_autorefs[num_LP_autorefs].base)); safecopy(LP_autorefs[num_LP_autorefs].rel,rel,sizeof(LP_autorefs[num_LP_autorefs].rel)); - printf("%d Using ref %s/%s for %s/%s\n",num_LP_autorefs,refbase,refrel,base,rel); + printf("%d Using ref %s/%s for %s/%s %.8f %.8f\n",num_LP_autorefs,refbase,refrel,base,rel,factor,offset); num_LP_autorefs++; } } @@ -277,23 +277,26 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *relpp,struct LP_ price = LP_myprice(&bid,&ask,refbase,refrel); printf("USE ref %s/%s %.8f factor %.8f offset %.8f\n",refbase,refrel,price,factor,offset); } - if ( factor > SMALLVAL ) + if ( LP_pricevalid(price) > 0 ) { - printf("price %.8f -> %.8f\n",price,(price * factor) + offset); - price = (price * factor) + offset; - } - if ( margin == 0. ) - margin = oppomargin; - //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); - if ( dir > 0 ) - price = 1. / (price * (1. - margin)); - else price = (price * (1. + margin)); - if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) - { - LP_mypriceset(&changed,relpp->symbol,basepp->symbol,price); - //printf("changed.%d\n",changed); - if ( changed != 0 ) - LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,price); + if ( factor > SMALLVAL ) + { + printf("price %.8f -> %.8f\n",price,(price * factor) + offset); + price = (price * factor) + offset; + } + if ( margin == 0. ) + margin = oppomargin; + //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); + if ( dir > 0 ) + price = 1. / (price * (1. - margin)); + else price = (price * (1. + margin)); + if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) + { + LP_mypriceset(&changed,relpp->symbol,basepp->symbol,price); + //printf("changed.%d\n",changed); + if ( changed != 0 ) + LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,price); + } } } } From 8eb68b61a025714fffb1d106befa9260813690c8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:56:08 +0300 Subject: [PATCH 301/346] Test --- iguana/exchanges/LP_portfolio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 0c58e6713..2f5b9d217 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -281,7 +281,7 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *relpp,struct LP_ { if ( factor > SMALLVAL ) { - printf("price %.8f -> %.8f\n",price,(price * factor) + offset); + printf("price %.8f -> %.8f factor %.8f offset %.8f\n",price,(price * factor) + offset,factor,offset); price = (price * factor) + offset; } if ( margin == 0. ) From 8c1207b462e10939fba83c67f54ceadd85da097a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:57:47 +0300 Subject: [PATCH 302/346] Test --- iguana/exchanges/LP_portfolio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 2f5b9d217..ef7be2955 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -377,8 +377,8 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - LP_autopriceset(ctx,1,refpp,coinpp,price,0,0); - LP_autopriceset(ctx,-1,coinpp,refpp,price,0,0); + LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); + LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0); } } } @@ -437,8 +437,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - LP_autopriceset(ctx,1,kmdpp,fiatpp,price,0,0); - LP_autopriceset(ctx,-1,fiatpp,kmdpp,price,0,0); + LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); + LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0); free_json(retjson); } } @@ -461,8 +461,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - LP_autopriceset(ctx,1,kmdpp,nxtpp,price,0,0); - LP_autopriceset(ctx,-1,nxtpp,kmdpp,price,0,0); + LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); + LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); } From e583382a8c6b9a500c6c365971f5acea22ac6fb2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 19:58:07 +0300 Subject: [PATCH 303/346] Test --- iguana/exchanges/LP_portfolio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index ef7be2955..89dc5d24a 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -263,7 +263,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) return(-1); } -void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *relpp,struct LP_priceinfo *basepp,double price,char *refbase,char *refrel) +void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP_priceinfo *relpp,double price,char *refbase,char *refrel) { double margin,minprice,oppomargin,factor,offset; double bid,ask; int32_t changed; margin = basepp->margins[relpp->ind]; From 471795aed5e19089546a10a97533d899fe8f5d04 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:05:19 +0300 Subject: [PATCH 304/346] Test --- iguana/exchanges/LP_portfolio.c | 3 ++- iguana/exchanges/autoprice | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 89dc5d24a..e563e9371 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -281,7 +281,8 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP { if ( factor > SMALLVAL ) { - printf("price %.8f -> %.8f factor %.8f offset %.8f\n",price,(price * factor) + offset,factor,offset); + double tmp = (price * factor) + offset; + printf("price %.8f -> %.8f factor %.8f offset %.8f [%.8f %.8f]\n",price,tmp,factor,offset,(tmp * (1. + margin)),1./(tmp * (1. + margin))); price = (price * factor) + offset; } if ( margin == 0. ) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index 9ec3ce3f1..ecdcecc84 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -5,7 +5,8 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"HUSH\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"HUSH\",\"rel\":\"KMD\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"USD\",\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" +#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" +#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":0.01}" +#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":0.01}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" From 2acc7df4dcad27068b591022b8ceaca0ec229439 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:10:00 +0300 Subject: [PATCH 305/346] Test --- iguana/exchanges/LP_portfolio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index e563e9371..3f1ff3e51 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -275,14 +275,14 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 ) { price = LP_myprice(&bid,&ask,refbase,refrel); - printf("USE ref %s/%s %.8f factor %.8f offset %.8f\n",refbase,refrel,price,factor,offset); + printf("USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f\n",refbase,refrel,price,factor,offset,margin); } if ( LP_pricevalid(price) > 0 ) { if ( factor > SMALLVAL ) { double tmp = (price * factor) + offset; - printf("price %.8f -> %.8f factor %.8f offset %.8f [%.8f %.8f]\n",price,tmp,factor,offset,(tmp * (1. + margin)),1./(tmp * (1. + margin))); + printf("price %.8f -> %.8f factor %.8f offset %.8f margin %.8f [%.8f %.8f] [%.8f %.8f]\n",price,tmp,factor,offset,margin,(tmp * (1. + margin)),1./(tmp * (1. - margin)),(tmp * (1. - margin)),1./(tmp * (1. + margin))); price = (price * factor) + offset; } if ( margin == 0. ) From 1eee23d32e2c3dcdf616fd62516314b7d801760a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:12:22 +0300 Subject: [PATCH 306/346] Test --- iguana/exchanges/autoprice | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index ecdcecc84..5944209dd 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -8,5 +8,5 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ #curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" #curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" -#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":0.01}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":-0.2}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":-0.2}" From 6b0c69c873a90184231fd56dd5eefb6b9eabcdaf Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:19:58 +0300 Subject: [PATCH 307/346] Test --- iguana/exchanges/LP_portfolio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 3f1ff3e51..5b2ea43e4 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -290,7 +290,7 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) price = 1. / (price * (1. - margin)); - else price = (price * (1. + margin)); + else price = (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,price); From 082eb218bf0df0a6500710da100dc2337bb3ef58 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:21:10 +0300 Subject: [PATCH 308/346] Test --- iguana/exchanges/LP_portfolio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 5b2ea43e4..b2ec8ff2a 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -275,7 +275,7 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 ) { price = LP_myprice(&bid,&ask,refbase,refrel); - printf("USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f\n",refbase,refrel,price,factor,offset,margin); + printf("%s/%s USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f\n",basepp->symbol,relpp->symbol,refbase,refrel,price,factor,offset,margin); } if ( LP_pricevalid(price) > 0 ) { From 1f7d117738c2f1fdd51beeade13a49c4417be543 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:40:37 +0300 Subject: [PATCH 309/346] Test --- iguana/exchanges/LP_portfolio.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index b2ec8ff2a..3e56b9fbb 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -265,7 +265,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP_priceinfo *relpp,double price,char *refbase,char *refrel) { - double margin,minprice,oppomargin,factor,offset; double bid,ask; int32_t changed; + double margin,minprice,newprice,oppomargin,factor,offset; double bid,ask; int32_t changed; margin = basepp->margins[relpp->ind]; oppomargin = relpp->margins[basepp->ind]; if ( margin != 0. || oppomargin != 0. ) @@ -288,15 +288,17 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP if ( margin == 0. ) margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); - if ( dir > 0 ) - price = 1. / (price * (1. - margin)); - else price = (price * (1. - margin)); + //if ( dir > 0 ) + // price = 1. / (price * (1. - margin)); + //else price = (price * (1. - margin)); + + newprice = (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { - LP_mypriceset(&changed,relpp->symbol,basepp->symbol,price); - //printf("changed.%d\n",changed); + LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); + printf("changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,newprice); if ( changed != 0 ) - LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,price); + LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,newprice); } } } @@ -378,7 +380,7 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); + //LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0); } } @@ -438,7 +440,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); + //LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0); free_json(retjson); } @@ -462,7 +464,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); + //LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); @@ -475,7 +477,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) basepp = LP_priceinfofind(LP_autorefs[i].base); relpp = LP_priceinfofind(LP_autorefs[i].rel); if ( basepp != 0 && relpp != 0 ) - LP_autopriceset(ctx,1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel); + LP_autopriceset(ctx,-1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel); } } From 181f4f68762fb54a5eccd2ffe2b5c49854461e1d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:47:02 +0300 Subject: [PATCH 310/346] Test --- iguana/exchanges/LP_portfolio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 3e56b9fbb..5d7927574 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -292,11 +292,11 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP // price = 1. / (price * (1. - margin)); //else price = (price * (1. - margin)); - newprice = (price * (1. - margin)); + newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); - printf("changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,newprice); + printf("changed.%d %s/%s <- %.8f\n",changed,relpp->symbol,basepp->symbol,newprice); if ( changed != 0 ) LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,newprice); } From 490b995f18f6db7ab6a942786db27f7e96d29248 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:49:32 +0300 Subject: [PATCH 311/346] Test --- iguana/exchanges/LP_portfolio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 5d7927574..81aca5097 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -292,7 +292,7 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP // price = 1. / (price * (1. - margin)); //else price = (price * (1. - margin)); - newprice = 1. / (price * (1. - margin)); + newprice = (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); From 4fa8066558812c7e627063f8e99c1f93bad1e3c6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:50:10 +0300 Subject: [PATCH 312/346] Test --- iguana/exchanges/autoprice | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index 5944209dd..50210de86 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -9,4 +9,4 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ #curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":-0.2}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":-0.2}" +#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":-0.2}" From f212e74674eaa2072b853b961a8bd3695eee3072 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 20:54:42 +0300 Subject: [PATCH 313/346] Test --- iguana/exchanges/autoprice | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index 50210de86..539c6f9f1 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -8,5 +8,5 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ #curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"USD\",\"rel\":\"KMD\",\"margin\":0.01}" #curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"JUMBLR\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"JUMBLR\",\"rel\":\"KMD\",\"margin\":0.01}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":-0.2}" -#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":-0.2}" +#curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"BTC\",\"refrel\":\"KMD\",\"factor\":0.00006667,\"margin\":-0.2}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MNZ\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"BTC\",\"factor\":15000,\"margin\":-0.2}" From e0d818f0c8ae6d5cdae2ed28496ecf8a8cb4847f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:00:07 +0300 Subject: [PATCH 314/346] Test --- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_portfolio.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 120ee3899..32b5914ec 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -801,7 +801,7 @@ int32_t LP_quotecmp(struct LP_quoteinfo *qp,struct LP_quoteinfo *qp2) void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp) { double price,maxprice = LP_Alicemaxprice; - if ( time(NULL) > qp->timestamp+Alice_timeout ) + if ( 0 && time(NULL) > qp->timestamp+Alice_timeout ) { printf("time expired for Alice_request\n"); memset(&LP_Alicequery,0,sizeof(LP_Alicequery)); diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 81aca5097..2a72bb438 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -292,11 +292,11 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP // price = 1. / (price * (1. - margin)); //else price = (price * (1. - margin)); - newprice = (price * (1. - margin)); + newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); - printf("changed.%d %s/%s <- %.8f\n",changed,relpp->symbol,basepp->symbol,newprice); + printf("changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,price); if ( changed != 0 ) LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,newprice); } From b9332019efc6e6b8c3c0345dd113ea62c234bff2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:02:02 +0300 Subject: [PATCH 315/346] Test --- iguana/exchanges/LP_portfolio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 2a72bb438..23919cd69 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -288,11 +288,11 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP if ( margin == 0. ) margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); - //if ( dir > 0 ) - // price = 1. / (price * (1. - margin)); - //else price = (price * (1. - margin)); + if ( dir > 0 ) + newprice = 1. / (price * (1. - margin)); + else newprice = (price * (1. - margin)); - newprice = 1. / (price * (1. - margin)); + //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); @@ -380,7 +380,7 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - //LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); + LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0); } } @@ -440,7 +440,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - //LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); + LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0); free_json(retjson); } @@ -464,7 +464,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - //LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); + LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); @@ -477,7 +477,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) basepp = LP_priceinfofind(LP_autorefs[i].base); relpp = LP_priceinfofind(LP_autorefs[i].rel); if ( basepp != 0 && relpp != 0 ) - LP_autopriceset(ctx,-1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel); + LP_autopriceset(ctx,1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel); } } From a53ffd5e852acb3465f3e3b5baefedf04508c86b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:10:04 +0300 Subject: [PATCH 316/346] Test --- iguana/exchanges/LP_portfolio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 23919cd69..48e022d68 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -289,8 +289,8 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) - newprice = 1. / (price * (1. - margin)); - else newprice = (price * (1. - margin)); + newprice = 1. / (price * (1. + margin)); + else newprice = (price * (1. + margin)); //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) From feab8be8227e85ab775d0114cbe819f5b8bf30c6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:13:54 +0300 Subject: [PATCH 317/346] Test --- iguana/exchanges/LP_portfolio.c | 4 ++-- iguana/exchanges/autoprice | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 48e022d68..23919cd69 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -289,8 +289,8 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) - newprice = 1. / (price * (1. + margin)); - else newprice = (price * (1. + margin)); + newprice = 1. / (price * (1. - margin)); + else newprice = (price * (1. - margin)); //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) diff --git a/iguana/exchanges/autoprice b/iguana/exchanges/autoprice index 539c6f9f1..21369b468 100755 --- a/iguana/exchanges/autoprice +++ b/iguana/exchanges/autoprice @@ -1,7 +1,7 @@ #!/bin/bash source userpass -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"BTC\",\"margin\":0.0001}" -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"BTC\",\"rel\":\"KMD\",\"margin\":0.0001}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"BTC\",\"margin\":0.03}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"BTC\",\"rel\":\"KMD\",\"margin\":0.03}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"HUSH\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"HUSH\",\"rel\":\"KMD\",\"margin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"USD\",\"margin\":0.01}" From 26dd7b91847b88eabf2bc3b3307ad2607279144e Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:19:30 +0300 Subject: [PATCH 318/346] Test --- iguana/exchanges/LP_portfolio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 23919cd69..7401e2ba5 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -253,7 +253,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) safecopy(LP_autorefs[num_LP_autorefs].refrel,refrel,sizeof(LP_autorefs[num_LP_autorefs].refrel)); safecopy(LP_autorefs[num_LP_autorefs].base,base,sizeof(LP_autorefs[num_LP_autorefs].base)); safecopy(LP_autorefs[num_LP_autorefs].rel,rel,sizeof(LP_autorefs[num_LP_autorefs].rel)); - printf("%d Using ref %s/%s for %s/%s %.8f %.8f\n",num_LP_autorefs,refbase,refrel,base,rel,factor,offset); + printf("%d Using ref %s/%s for %s/%s factor %.8f, offset %.8f, margin %.8f\n",num_LP_autorefs,refbase,refrel,base,rel,factor,offset,margin); num_LP_autorefs++; } } @@ -275,28 +275,28 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 ) { price = LP_myprice(&bid,&ask,refbase,refrel); - printf("%s/%s USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f\n",basepp->symbol,relpp->symbol,refbase,refrel,price,factor,offset,margin); + //printf("%s/%s USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f\n",basepp->symbol,relpp->symbol,refbase,refrel,price,factor,offset,margin); } if ( LP_pricevalid(price) > 0 ) { if ( factor > SMALLVAL ) { - double tmp = (price * factor) + offset; - printf("price %.8f -> %.8f factor %.8f offset %.8f margin %.8f [%.8f %.8f] [%.8f %.8f]\n",price,tmp,factor,offset,margin,(tmp * (1. + margin)),1./(tmp * (1. - margin)),(tmp * (1. - margin)),1./(tmp * (1. + margin))); + //double tmp = (price * factor) + offset; + //printf("price %.8f -> %.8f factor %.8f offset %.8f margin %.8f [%.8f %.8f] [%.8f %.8f]\n",price,tmp,factor,offset,margin,(tmp * (1. + margin)),1./(tmp * (1. - margin)),(tmp * (1. - margin)),1./(tmp * (1. + margin))); price = (price * factor) + offset; } if ( margin == 0. ) margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) - newprice = 1. / (price * (1. - margin)); + newprice = 1. / (price * (1. + margin)); else newprice = (price * (1. - margin)); //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); - printf("changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,price); + //printf("changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,price); if ( changed != 0 ) LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,newprice); } From 4052426cfc3af042148697e0c10576de085d1ea6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:22:51 +0300 Subject: [PATCH 319/346] Test --- iguana/exchanges/LP_portfolio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 7401e2ba5..bf7d37b33 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -289,8 +289,8 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) - newprice = 1. / (price * (1. + margin)); - else newprice = (price * (1. - margin)); + newprice = 1. / (price * (1. - margin)); + else newprice = (price * (1. + margin)); //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) @@ -380,8 +380,8 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); - LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0); + LP_autopriceset(ctx,-1,coinpp,refpp,price,0,0); + LP_autopriceset(ctx,1,refpp,coinpp,price,0,0); } } } @@ -440,8 +440,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); - LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0); + LP_autopriceset(ctx,-1,fiatpp,kmdpp,price,0,0); + LP_autopriceset(ctx,1,kmdpp,fiatpp,price,0,0); free_json(retjson); } } @@ -464,8 +464,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); - LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0); + LP_autopriceset(ctx,-1,nxtpp,kmdpp,price,0,0); + LP_autopriceset(ctx,1,kmdpp,nxtpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); } From 51e042bca9373f2d3fd3b34362e55b2bde9d2ce8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:26:05 +0300 Subject: [PATCH 320/346] Test --- iguana/exchanges/LP_nativeDEX.c | 5 ++--- iguana/exchanges/LP_portfolio.c | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 5c159e440..d50f4893a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -18,13 +18,12 @@ // LP_nativeDEX.c // marketmaker // -// autoprice based on formula // sign critical api calls (pubkey reg, listunspent, orders?) -// stats using KV opreturn +// stats using local files // deal with offline pubkeys, reputations, etc. // dPoW security -> 2: KMD notarized, 3: BTC notarized // add interest to KMD withdraw -// verify portfolio, pricearray, withdraw +// verify portfolio, pricearray // dICO allocation // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index bf7d37b33..43e3ab4ae 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -290,7 +290,7 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) newprice = 1. / (price * (1. - margin)); - else newprice = (price * (1. + margin)); + else newprice = (price * (1. - margin)); //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) @@ -380,8 +380,8 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - LP_autopriceset(ctx,-1,coinpp,refpp,price,0,0); - LP_autopriceset(ctx,1,refpp,coinpp,price,0,0); + LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); + LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0); } } } @@ -440,8 +440,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - LP_autopriceset(ctx,-1,fiatpp,kmdpp,price,0,0); - LP_autopriceset(ctx,1,kmdpp,fiatpp,price,0,0); + LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); + LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0); free_json(retjson); } } @@ -464,8 +464,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - LP_autopriceset(ctx,-1,nxtpp,kmdpp,price,0,0); - LP_autopriceset(ctx,1,kmdpp,nxtpp,price,0,0); + LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); + LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); } From 9a6b09a06ac069dace210804f155fb2b437b2313 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:28:58 +0300 Subject: [PATCH 321/346] Test --- iguana/exchanges/LP_portfolio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 43e3ab4ae..482327f49 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -289,8 +289,8 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP margin = oppomargin; //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) - newprice = 1. / (price * (1. - margin)); - else newprice = (price * (1. - margin)); + newprice = (1. / price) * (1. + margin); + else newprice = (price * (1. + margin)); //newprice = 1. / (price * (1. - margin)); if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) From 1a4caa5ce71246eda348cc38b8774d944acf8c76 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:36:40 +0300 Subject: [PATCH 322/346] Test --- iguana/exchanges/LP_prices.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 217514983..d23dbbb68 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -789,6 +789,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) jaddi(array,LP_orderbookjson(rel,bids[i])); if ( n < 10 && bids[i]->numutxos == 0 )//|| relcoin->electrum == 0 ) { + printf("bid ping %s %s\n",rel,bids[i]->coinaddr); LP_address(relcoin,bids[i]->coinaddr); if ( relcoin->electrum == 0 ) LP_listunspent_issue(rel,bids[i]->coinaddr,0); @@ -808,6 +809,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) jaddi(array,LP_orderbookjson(base,asks[i])); if ( n < 10 && asks[i]->numutxos == 0 )//|| basecoin->electrum == 0 ) { + printf("ask ping %s %s\n",base,asks[i]->coinaddr); LP_address(basecoin,asks[i]->coinaddr); if ( basecoin->electrum == 0 ) LP_listunspent_issue(base,asks[i]->coinaddr,0); From 767727694ea0f1d0aceb4b0ba25a791875d38fae Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 23:38:48 +0300 Subject: [PATCH 323/346] Test --- iguana/exchanges/LP_prices.c | 4 ++-- iguana/exchanges/LP_remember.c | 12 ++++++------ iguana/exchanges/LP_utxo.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index d23dbbb68..531a2fdb0 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -789,7 +789,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) jaddi(array,LP_orderbookjson(rel,bids[i])); if ( n < 10 && bids[i]->numutxos == 0 )//|| relcoin->electrum == 0 ) { - printf("bid ping %s %s\n",rel,bids[i]->coinaddr); + //printf("bid ping %s %s\n",rel,bids[i]->coinaddr); LP_address(relcoin,bids[i]->coinaddr); if ( relcoin->electrum == 0 ) LP_listunspent_issue(rel,bids[i]->coinaddr,0); @@ -809,7 +809,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) jaddi(array,LP_orderbookjson(base,asks[i])); if ( n < 10 && asks[i]->numutxos == 0 )//|| basecoin->electrum == 0 ) { - printf("ask ping %s %s\n",base,asks[i]->coinaddr); + //printf("ask ping %s %s\n",base,asks[i]->coinaddr); LP_address(basecoin,asks[i]->coinaddr); if ( basecoin->electrum == 0 ) LP_listunspent_issue(base,asks[i]->coinaddr,0); diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 119b35f94..752c63956 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -247,7 +247,7 @@ bits256 basilisk_swap_privBn_extract(bits256 *bobrefundp,char *bobcoin,bits256 b return(privBn); } -bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflags,bits256 *txids,int32_t utxoind,int32_t alicespent,int32_t bobspent,int32_t vout,char *aliceaddr,char *bobaddr,char *Adest,char *dest) +bits256 basilisk_swap_spendupdate(int32_t iambob,char *symbol,char *spentaddr,int32_t *sentflags,bits256 *txids,int32_t utxoind,int32_t alicespent,int32_t bobspent,int32_t vout,char *aliceaddr,char *bobaddr,char *Adest,char *dest) { bits256 spendtxid,txid; char destaddr[64],str[65]; struct iguana_info *coin; cJSON *histobj; if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) @@ -285,13 +285,13 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag else { printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); - if ( aliceaddr != 0 ) + if ( iambob == 0 ) { sentflags[bobspent] = 1; sentflags[alicespent] = 0; txids[bobspent] = spendtxid; } - else if ( bobaddr != 0 ) + else { sentflags[alicespent] = 1; sentflags[bobspent] = 0; @@ -914,9 +914,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti LP_rswap_checktx(&rswap,rswap.alicecoin,BASILISK_ALICEPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBPAYMENT); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBDEPOSIT); - rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); - rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,destAdest,destBdest,rswap.Adestaddr,rswap.destaddr); - rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); + rswap.paymentspent = basilisk_swap_spendupdate(rswap.iambob,rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); + rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.iambob,rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,destAdest,destBdest,rswap.Adestaddr,rswap.destaddr); + rswap.depositspent = basilisk_swap_spendupdate(rswap.iambob,rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); LP_spends_set(&rswap); if ( rswap.iambob == 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 9244889b8..b60b3b7f5 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -160,7 +160,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight); + char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) @@ -241,7 +241,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 0 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) + if ( 1 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) printf("ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); From 634ad6778a05cacac1025f0a3da729fa21ae42d3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 23:43:06 +0300 Subject: [PATCH 324/346] Test --- iguana/exchanges/LP_utxo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b60b3b7f5..c330ef305 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -160,7 +160,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight); + char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%p\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) @@ -172,6 +172,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 } } portable_mutex_unlock(&LP_utxomutex); + printf("return n.%d\n",n); return(n); } From 8d084c7021708d7d56c993ae096e9120da66fae4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 23:56:05 +0300 Subject: [PATCH 325/346] Test --- iguana/exchanges/LP_ordermatch.c | 4 ++-- iguana/exchanges/LP_utxo.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 32b5914ec..6c3cdcf62 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -507,7 +507,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** if ( (m= LP_address_utxo_ptrs(iambob,utxos,max,ap,coinaddr)) > 1 ) { targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee); - if ( 0 ) + if ( 1 ) { int32_t i; for (i=0; i targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); + printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index c330ef305..4be11c04e 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -160,7 +160,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 portable_mutex_lock(&LP_utxomutex); DL_FOREACH_SAFE(ap->utxos,up,tmp) { - char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%p\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); + //char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%p\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout)); if ( up->spendheight <= 0 ) { if ( LP_allocated(up->U.txid,up->U.vout) == 0 ) @@ -172,7 +172,7 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32 } } portable_mutex_unlock(&LP_utxomutex); - printf("return n.%d\n",n); + //printf("return n.%d\n",n); return(n); } From e67c08d1952981bb3456cea3faad7dfa90541ab2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 23:59:08 +0300 Subject: [PATCH 326/346] Test --- iguana/exchanges/LP_ordermatch.c | 6 +++--- iguana/exchanges/LP_utxo.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 6c3cdcf62..cbf060638 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -478,7 +478,7 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,char *coinaddr,struct LP_a continue; } //else printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); } - if ( up->SPV > 0 && dist >= 0 && dist < mindist ) + if ( (coin->electrum == 0 || up->SPV > 0) && dist >= 0 && dist < mindist ) { //printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); mini = i; @@ -507,7 +507,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** if ( (m= LP_address_utxo_ptrs(iambob,utxos,max,ap,coinaddr)) > 1 ) { targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee); - if ( 1 ) + if ( 0 ) { int32_t i; for (i=0; i targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); + //printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval); if ( (double)up->U.value/targetval < LP_MINVOL-1 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 4be11c04e..26d0c6300 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -242,7 +242,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid, DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( 1 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) + if ( 0 && height > 0 && strcmp("REVS",coin->symbol) == 0 ) printf("ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); From 7fac9e7387e1176ae30cc13c2da90eb4e6e42107 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:08:49 +0300 Subject: [PATCH 327/346] Test --- iguana/exchanges/LP_nativeDEX.c | 4 ++++ iguana/exchanges/LP_network.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index d50f4893a..cb75b35e8 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -339,6 +339,8 @@ void command_rpcloop(void *myipaddr) usleep(1000); else usleep(10000); } + else if ( IAMLP == 0 ) + usleep(1000); } } @@ -729,6 +731,8 @@ int32_t LP_reserved_msgs() n++; #ifdef __APPLE__ usleep(5000); +#else + usleep(100); #endif } portable_mutex_unlock(&LP_reservedmutex); diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 0036a4e86..14f452dbe 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -203,6 +203,8 @@ void queue_loop(void *ignore) // printf("LP_Q.[%d]\n",n); if ( nonz == 0 ) usleep(5000); + else if ( IAMLP == 0 ) + usleep(1000); } } From ed53146c921ebae347de4f7c5441161aea1f38d7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:28:10 +0300 Subject: [PATCH 328/346] Stats.log --- iguana/exchanges/LP_prices.c | 2 +- iguana/exchanges/LP_remember.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 531a2fdb0..58bb302ed 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -169,7 +169,7 @@ struct LP_address *_LP_addressadd(struct iguana_info *coin,char *coinaddr) ap->pubkey = pubp->pubkey; memcpy(ap->pubsecp,pubp->pubsecp,sizeof(ap->pubsecp)); } - printf("LP_ADDRESS %s ADD.(%s)\n",coin->symbol,coinaddr); + //printf("LP_ADDRESS %s ADD.(%s)\n",coin->symbol,coinaddr); HASH_ADD_KEYPTR(hh,coin->addresses,ap->coinaddr,strlen(ap->coinaddr),ap); return(ap); } diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 752c63956..66c0bcc75 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1203,6 +1203,19 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) void LP_tradecommand_log(cJSON *argjson) { - + static FILE *logfp; char *jsonstr; + if ( logfp == 0 ) + { + if ( (logfp= fopen("stats.log","rb+")) != 0 ) + fseek(logfp,0,SEEK_END); + else logfp = fopen("stats.log","wb"); + } + if ( logfp != 0 ) + { + jsonstr = jprint(argjson,0); + fprintf(logfp,"%s\n",jsonstr); + free(jsonstr); + fflush(logfp); + } } From 088a91f482095e122ec7b0db8d79cf802fd0c786 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:30:06 +0300 Subject: [PATCH 329/346] Test --- iguana/exchanges/LP_commands.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 31679e2eb..87f493035 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -159,6 +159,11 @@ dividends(coin, height, )\n\ } return(clonestr("{\"result\":\"success\"}")); } + else if ( strcmp(method,"stop") == 0 ) + { + printf("DEBUG stop\n"); + exit(0); + } else if ( strcmp(method,"getmessages") == 0 ) { if ( (retjson= LP_getmessages(jint(argjson,"firsti"),jint(argjson,"num"))) != 0 ) From 566c99a5236281fb2b1268c754529e09dd804ad7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:35:30 +0300 Subject: [PATCH 330/346] Test --- iguana/exchanges/profile | 1 + iguana/m_mm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100755 iguana/exchanges/profile diff --git a/iguana/exchanges/profile b/iguana/exchanges/profile new file mode 100755 index 000000000..50c1df851 --- /dev/null +++ b/iguana/exchanges/profile @@ -0,0 +1 @@ +gprof -b ../marketmaker ../gmon.out diff --git a/iguana/m_mm b/iguana/m_mm index b5ba405ca..f124ecaa1 100755 --- a/iguana/m_mm +++ b/iguana/m_mm @@ -1,3 +1,3 @@ cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana -gcc -g -o marketmaker -I../crypto777 exchanges/mm.c mini-gmp.c secp256k1.o ../agents/libcrypto777.a -lnanomsg -lcurl -lpthread -lm +gcc -pg -o marketmaker -I../crypto777 exchanges/mm.c mini-gmp.c secp256k1.o ../agents/libcrypto777.a -lnanomsg -lcurl -lpthread -lm From 9445a5d9bfa041dca414f4fa4b4fe916201aa8d3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:36:31 +0300 Subject: [PATCH 331/346] Test --- iguana/exchanges/stop | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 iguana/exchanges/stop diff --git a/iguana/exchanges/stop b/iguana/exchanges/stop new file mode 100644 index 000000000..7bf610384 --- /dev/null +++ b/iguana/exchanges/stop @@ -0,0 +1,2 @@ +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"stop\"}" From 8a66df1fcd6f6399577c71dbb536e83c3be36f32 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:39:09 +0300 Subject: [PATCH 332/346] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index cb75b35e8..536480025 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -292,7 +292,7 @@ int32_t LP_nanomsg_recvs(void *ctx) if ( (origipaddr= LP_myipaddr) == 0 ) origipaddr = "127.0.0.1"; milli = OS_milliseconds(); - if ( lastmilli > 0. && milli > lastmilli+1000 ) + if ( lastmilli > 0. && milli > lastmilli+3000 ) fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds\n",milli-lastmilli); lastmilli = milli; //portable_mutex_lock(&LP_nanorecvsmutex); From 59db65c50c1b7c4522e5f1782f35cb4ffe70cb3b Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 01:57:37 +0300 Subject: [PATCH 333/346] Withdraw interest --- iguana/exchanges/LP_nativeDEX.c | 10 ++++---- iguana/exchanges/LP_rpc.c | 11 +++++++++ iguana/exchanges/LP_transaction.c | 40 +++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 536480025..c54e2da4f 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -18,13 +18,13 @@ // LP_nativeDEX.c // marketmaker // -// sign critical api calls (pubkey reg, listunspent, orders?) -// stats using local files -// deal with offline pubkeys, reputations, etc. -// dPoW security -> 2: KMD notarized, 3: BTC notarized +// dPoW security -> 4: KMD notarized, 5: BTC notarized +// dICO allocation script // add interest to KMD withdraw +// sign critical api calls (pubkey reg, listunspent, orders?) +// process stats.log local file // verify portfolio, pricearray -// dICO allocation +// deal with offline pubkeys, reputations, etc. // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index c6cc3e298..18a7c89e1 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -268,6 +268,17 @@ cJSON *LP_gettx(char *symbol,bits256 txid) } } +uint32_t LP_locktime(char *symbol,bits256 txid) +{ + cJSON *txobj; uint32_t locktime = 0; + if ( (txobj= LP_gettx(symbol,txid)) != 0 ) + { + locktime = juint(txobj,"locktime"); + free_json(txobj); + } + return(locktime); +} + cJSON *LP_gettxout_json(bits256 txid,int32_t vout,int32_t height,char *coinaddr,uint64_t value) { cJSON *retjson,*addresses,*sobj; diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 48c03efa1..ff032f126 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -778,10 +778,38 @@ cJSON *LP_inputjson(bits256 txid,int32_t vout,char *spendscriptstr) return(item); } +uint64_t _komodo_interestnew(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime) +{ + int32_t minutes; uint64_t interest = 0; + if ( (minutes= (tiptime - nLockTime) / 60) >= 60 ) + { + if ( minutes > 365 * 24 * 60 ) + minutes = 365 * 24 * 60; + minutes -= 59; + interest = ((nValue / 10512000) * minutes); + } + return(interest); +} + +int64_t LP_komodo_interest(bits256 txid,int64_t value) +{ + uint32_t nLockTime; uint32_t tiptime; int64_t interest = 0; + if ( value >= 10*SATOSHIDEN ) + { + if ( (nLockTime= LP_locktime("KMD",txid)) >= 500000000 ) + { + tiptime = (uint32_t)time(NULL) - 777; + interest = _komodo_interestnew(value,nLockTime,tiptime); + } + } + return(interest); +} + int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_t amount,struct vin_info *V,struct LP_address_utxo **utxos,int32_t numunspents,int32_t suppress_pubkeys,int32_t ignore_cltverr,bits256 privkey,cJSON *privkeys,cJSON *vins,uint8_t *script,int32_t scriptlen) { - char wifstr[128],spendscriptstr[128]; int32_t i,n,ind,abovei,belowi,maxmode=0; struct vin_info *vp; struct LP_address_utxo *up; int64_t above,below,remains = amount,total = 0; + char wifstr[128],spendscriptstr[128]; int32_t i,n,ind,abovei,belowi,maxmode=0; struct vin_info *vp; struct LP_address_utxo *up; int64_t interest,interestsum,above,below,remains = amount,total = 0; *totalp = 0; + interestsum = 0; init_hexbytes_noT(spendscriptstr,script,scriptlen); bitcoin_priv2wif(coin->wiftaddr,wifstr,privkey,coin->wiftype); for (i=n=0; iU.value; remains -= up->U.value; + //if ( coin->electrum == 0 && strcmp(coin->symbol,"KMD") == 0 ) + { + if ( (interest= LP_komodo_interest(up->U.txid,up->U.value)) > 0 ) + { + interestsum += interest; + char str[65]; printf("%s/%d %.8f interest %.8f -> sum %.8f\n",bits256_str(str,up->U.txid),up->U.vout,dstr(up->U.value),dstr(interest),dstr(interestsum)); + } + } vp = &V[n++]; vp->N = vp->M = 1; vp->signers[0].privkey = privkey; @@ -825,7 +861,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ return(0); } } - *totalp = total; + *totalp = total + interestsum; return(n); } From bf2148cefad44a8afaadd67b0e2177dad2fc9ecb Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 02:19:10 +0300 Subject: [PATCH 334/346] Test --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- iguana/exchanges/LP_network.c | 2 +- iguana/exchanges/stop | 0 3 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 iguana/exchanges/stop diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index c54e2da4f..5a4df4fc6 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -20,10 +20,10 @@ // // dPoW security -> 4: KMD notarized, 5: BTC notarized // dICO allocation script -// add interest to KMD withdraw // sign critical api calls (pubkey reg, listunspent, orders?) + // process stats.log local file -// verify portfolio, pricearray +// verify portfolio, pricearray, interest to KMD withdraw // deal with offline pubkeys, reputations, etc. // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 14f452dbe..7b04dc444 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -87,7 +87,7 @@ void _LP_sendqueueadd(uint32_t crc32,int32_t sock,uint8_t *msg,int32_t msglen,in int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32) { - static uint32_t crcs[8192]; static unsigned long dup,total; + static uint32_t crcs[64]; static unsigned long dup,total; int32_t i; *duplicatep = 0; if ( ind < 0 ) diff --git a/iguana/exchanges/stop b/iguana/exchanges/stop old mode 100644 new mode 100755 From 4883a3c8fb0367c59e938daecf2306a0aa73dcbc Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 11:43:10 +0300 Subject: [PATCH 335/346] Test --- iguana/exchanges/LP_commands.c | 7 ++++++- iguana/exchanges/LP_nativeDEX.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 87f493035..6b6dc5df9 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -271,7 +271,12 @@ dividends(coin, height, )\n\ if ( (ptr= LP_coinsearch(coin)) != 0 ) { if ( ptr->userpass[0] == 0 ) - return(clonestr("{\"error\":\"couldnt find coin locally installed\"}")); + { + cJSON *retjson = cJSON_CreateObject(); + jaddstr(retjson,"error","couldnt find coin locally installed"); + jaddstr(retjson,"coin",coin); + return(jprint(retjson,1)); + } if ( LP_conflicts_find(ptr) == 0 ) { ptr->inactive = 0; diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 5a4df4fc6..4d2888eb2 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -24,6 +24,7 @@ // process stats.log local file // verify portfolio, pricearray, interest to KMD withdraw + // deal with offline pubkeys, reputations, etc. // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN From 70ec72915d575e8e3b484268b31030b5a8993e14 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 12:20:09 +0300 Subject: [PATCH 336/346] Recent swaps --- iguana/exchanges/LP_commands.c | 5 +++++ iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_remember.c | 32 ++++++++++++++++++++++++++++++++ iguana/exchanges/recentswaps | 3 +++ iguana/exchanges/stop | 1 + 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 iguana/exchanges/recentswaps diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 6b6dc5df9..2219b5caa 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -110,6 +110,7 @@ sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)*\n\ withdraw(coin, outputs[])*\n\ sendrawtransaction(coin, signedtx)\n\ swapstatus()*\n\ +recentswaps(limit=3)\n\ swapstatus(requestid, quoteid)*\n\ public API:\n \ getcoins()\n\ @@ -159,6 +160,10 @@ dividends(coin, height, )\n\ } return(clonestr("{\"result\":\"success\"}")); } + else if ( strcmp(method,"recentswaps") == 0 ) + { + return(LP_recent_swaps(jint(argjson,"limit"))); + } else if ( strcmp(method,"stop") == 0 ) { printf("DEBUG stop\n"); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 4d2888eb2..88837e542 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -24,7 +24,7 @@ // process stats.log local file // verify portfolio, pricearray, interest to KMD withdraw - +// handles<->pubkeys // deal with offline pubkeys, reputations, etc. // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 66c0bcc75..959b08a23 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1219,3 +1219,35 @@ void LP_tradecommand_log(cJSON *argjson) } } +char *LP_recent_swaps(int32_t limit) +{ + char fname[512]; long fsize,offset; FILE *fp; int32_t i=0; uint32_t requestid,quoteid; cJSON *array,*item; + if ( limit <= 0 ) + limit = 3; + sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); + array = cJSON_CreateArray(); + if ( (fp= fopen(fname,"rb")) != 0 ) + { + fseek(fp,0,SEEK_END); + fsize = ftell(fp); + offset = (sizeof(requestid) + sizeof(quoteid)); + while ( offset <= fsize ) + { + i++; + offset = i * (sizeof(requestid) + sizeof(quoteid)); + fseek(fp,fsize-offset,SEEK_SET); + if ( ftell(fp) == fsize-offset ) + { + if ( fread(&requestid,1,sizeof(requestid),fp) == sizeof(requestid) && fread("eid,1,sizeof(quoteid),fp) == sizeof(quoteid) ) + { + item = cJSON_CreateArray(); + jaddinum(item,requestid); + jaddinum(item,quoteid); + jaddi(array,item); + } else break; + } else break; + } + fclose(fp); + } + return(jprint(array,1)); +} diff --git a/iguana/exchanges/recentswaps b/iguana/exchanges/recentswaps new file mode 100755 index 000000000..d24b99840 --- /dev/null +++ b/iguana/exchanges/recentswaps @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"recentswaps\",\"limit\":1}" diff --git a/iguana/exchanges/stop b/iguana/exchanges/stop index 7bf610384..d13a70243 100755 --- a/iguana/exchanges/stop +++ b/iguana/exchanges/stop @@ -1,2 +1,3 @@ +#!/bin/bash source userpass curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"stop\"}" From 3037ff3b2eabd6cdecf804156f8cadb9dad53894 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 12:34:53 +0300 Subject: [PATCH 337/346] Test --- iguana/exchanges/LP_remember.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 959b08a23..e7a6a536e 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1231,7 +1231,7 @@ char *LP_recent_swaps(int32_t limit) fseek(fp,0,SEEK_END); fsize = ftell(fp); offset = (sizeof(requestid) + sizeof(quoteid)); - while ( offset <= fsize ) + while ( offset <= fsize && i < limit ) { i++; offset = i * (sizeof(requestid) + sizeof(quoteid)); From 05d79003d2b3ceda53fc638e431dc9edca168e12 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 12:45:18 +0300 Subject: [PATCH 338/346] Test --- iguana/exchanges/LP_commands.c | 1 + iguana/exchanges/LP_ordermatch.c | 9 +++++---- iguana/exchanges/LP_remember.c | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 2219b5caa..c57e9b3fd 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -132,6 +132,7 @@ electrum(coin, ipaddr, port)*\n\ snapshot(coin, height)\n\ snapshot_balance(coin, height, addresses[])\n\ dividends(coin, height, )\n\ +stop()\n\ \"}")); //sell(base, rel, price, basevolume, timeout=10, duration=3600)\n\ diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index cbf060638..13c3db920 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -776,7 +776,8 @@ char *LP_bestfit(char *rel,double relvolume) } struct LP_quoteinfo LP_Alicequery; -double LP_Alicemaxprice; int32_t Alice_timeout; +double LP_Alicemaxprice; +uint32_t Alice_expiration; char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp,double maxprice,int32_t timeout,int32_t duration) { struct LP_utxoinfo *aliceutxo; double price; //cJSON *bestitem=0; int32_t DEXselector=0; uint32_t expiration; double price; struct LP_pubkeyinfo *pubp; struct basilisk_swap *swap; @@ -787,7 +788,7 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q } price = 0.; LP_query(ctx,myipaddr,mypubsock,"request",qp); - LP_Alicequery = *qp, LP_Alicemaxprice = maxprice, Alice_timeout = timeout; + LP_Alicequery = *qp, LP_Alicemaxprice = maxprice, Alice_expiration = qp->timestamp + timeout; return(clonestr("{\"result\":\"success\"}")); } @@ -801,12 +802,12 @@ int32_t LP_quotecmp(struct LP_quoteinfo *qp,struct LP_quoteinfo *qp2) void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp) { double price,maxprice = LP_Alicemaxprice; - if ( 0 && time(NULL) > qp->timestamp+Alice_timeout ) + if ( time(NULL) > Alice_expiration ) { printf("time expired for Alice_request\n"); memset(&LP_Alicequery,0,sizeof(LP_Alicequery)); LP_Alicemaxprice = 0.; - Alice_timeout = 0; + Alice_expiration = 0; } else if ( LP_quotecmp(qp,&LP_Alicequery) == 0 ) { diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index e7a6a536e..208216537 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1219,9 +1219,12 @@ void LP_tradecommand_log(cJSON *argjson) } } +extern struct LP_quoteinfo LP_Alicequery; +extern uint32_t Alice_expiration; + char *LP_recent_swaps(int32_t limit) { - char fname[512]; long fsize,offset; FILE *fp; int32_t i=0; uint32_t requestid,quoteid; cJSON *array,*item; + char fname[512]; long fsize,offset; FILE *fp; int32_t i=0; uint32_t requestid,quoteid; cJSON *array,*item,*retjson; if ( limit <= 0 ) limit = 3; sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); @@ -1249,5 +1252,19 @@ char *LP_recent_swaps(int32_t limit) } fclose(fp); } - return(jprint(array,1)); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jadd(retjson,"swaps",array); + if ( time(NULL) < Alice_expiration ) + { + item = cJSON_CreateObject(); + jaddnum(item,"expiration",Alice_expiration); + jaddnum(item,"timeleft",Alice_expiration-time(NULL)); + jaddstr(item,"base",LP_Alicequery.srccoin); + jaddnum(item,"basevalue",dstr(LP_Alicequery.satoshis)); + jaddstr(item,"rel",LP_Alicequery.destcoin); + jaddnum(item,"relvalue",dstr(LP_Alicequery.destsatoshis)); + jadd(retjson,"pending",item); + } else Alice_expiration = 0; + return(jprint(retjson,1)); } From 0da2b5024f8ec99246e64a16b7cbb8ebc84383d1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 13:45:20 +0300 Subject: [PATCH 339/346] Persistent asset chain notarizations --- iguana/dPoW.h | 2 +- iguana/dpow/dpow_fsm.c | 5 +++++ iguana/dpow/dpow_rpc.c | 14 +++++++------- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 2 +- iguana/iguana_notary.c | 22 +++++++++++++++++++--- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 47e9f1642..f2bd64821 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -132,7 +132,7 @@ struct dpow_info char symbol[16],dest[16]; uint8_t minerkey33[33],minerid; uint64_t lastrecvmask; struct dpow_checkpoint checkpoint,last,destchaintip,srcfifo[DPOW_FIFOSIZE],destfifo[DPOW_FIFOSIZE]; struct dpow_hashheight approved[DPOW_FIFOSIZE],notarized[DPOW_FIFOSIZE]; - bits256 srctx[DPOW_MAXTX],desttx[DPOW_MAXTX]; + bits256 activehash,lastnotarized,srctx[DPOW_MAXTX],desttx[DPOW_MAXTX]; uint32_t SRCREALTIME,destupdated,srcconfirms,numdesttx,numsrctx,lastsplit,cancelratify; int32_t lastheight,maxblocks,SRCHEIGHT,SHORTFLAG,ratifying; struct pax_transaction *PAX; diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 18afb868b..8adf8ddec 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -447,6 +447,11 @@ void dpow_statemachinestart(void *ptr) dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); dpow_nanomsg_update(myinfo); } + else + { + dp->lastnotarized = bp->srctxid; + printf("notarized %s %s\n",dp->symbol,bits256_str(str,bp->srctxid)); + } if ( 0 && dp->cancelratify != 0 && bp->isratify != 0 ) { printf("abort pending ratify\n"); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 0e294f4d9..64dc63d87 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -1154,10 +1154,11 @@ void dpow_issuer_voutupdate(struct dpow_info *dp,char *symbol,int32_t isspecial, } } -int32_t dpow_issuer_tx(struct dpow_info *dp,struct iguana_info *coin,int32_t height,int32_t txi,char *txidstr,uint32_t port) +int32_t dpow_issuer_tx(int32_t *isspecialp,struct dpow_info *dp,struct iguana_info *coin,int32_t height,int32_t txi,char *txidstr,uint32_t port) { - char *retstr,params[256],*hexstr; uint8_t script[16384]; cJSON *json,*oldpub,*newpub,*result,*vouts,*item,*sobj; int32_t vout,n,len,isspecial,retval = -1; uint64_t value; bits256 txid; + char *retstr,params[256],*hexstr; uint8_t script[16384]; cJSON *json,*oldpub,*newpub,*result,*vouts,*item,*sobj; int32_t vout,n,len,retval = -1; uint64_t value; bits256 txid; sprintf(params,"[\"%s\", 1]",txidstr); + *isspecialp = 0; if ( (retstr= dpow_issuemethod(coin->chain->userpass,(char *)"getrawtransaction",params,port)) != 0 ) { if ( (json= cJSON_Parse(retstr)) != 0 ) @@ -1170,7 +1171,6 @@ int32_t dpow_issuer_tx(struct dpow_info *dp,struct iguana_info *coin,int32_t hei retval = 0; if ( oldpub == 0 && newpub == 0 && (vouts= jarray(&n,result,(char *)"vout")) != 0 ) { - isspecial = 0; txid = jbits256(result,(char *)"txid"); for (vout=0; vout> 1; if ( vout == 0 && ((memcmp(&hexstr[2],CRYPTO777_PUBSECPSTR,66) == 0 && len == 35) || (memcmp(&hexstr[6],CRYPTO777_RMD160STR,40) == 0 && len == 25)) ) - isspecial = 1; + *isspecialp = 1; else if ( len <= sizeof(script) ) { decode_hex(script,len,hexstr); - dpow_issuer_voutupdate(dp,coin->symbol,isspecial,height,txi,txid,vout,n,value,script,len); + dpow_issuer_voutupdate(dp,coin->symbol,*isspecialp,height,txi,txid,vout,n,value,script,len); } } } @@ -1202,7 +1202,7 @@ int32_t dpow_issuer_tx(struct dpow_info *dp,struct iguana_info *coin,int32_t hei int32_t dpow_issuer_block(struct dpow_info *dp,struct iguana_info *coin,int32_t height,uint16_t port) { - char *retstr,*retstr2,params[128],*txidstr; int32_t i,n,retval = -1; cJSON *json,*tx=0,*result=0,*result2; + char *retstr,*retstr2,params[128],*txidstr; int32_t i,isspecial,n,retval = -1; cJSON *json,*tx=0,*result=0,*result2; sprintf(params,"[%d]",height); if ( (retstr= dpow_issuemethod(coin->chain->userpass,(char *)"getblockhash",params,port)) != 0 ) { @@ -1219,7 +1219,7 @@ int32_t dpow_issuer_block(struct dpow_info *dp,struct iguana_info *coin,int32_t if ( (result2= jobj(json,(char *)"result")) != 0 && (tx= jarray(&n,result2,(char *)"tx")) != 0 ) { for (i=0; ipubkeys +// handles <-> pubkeys // deal with offline pubkeys, reputations, etc. // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 13c3db920..d1982812b 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1074,7 +1074,7 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel if ( (bestutxo= LP_buyutxo(&ordermatchprice,&bestsatoshis,&bestdestsatoshis,autxo,base,maxprice,duration,txfee,desttxfee,gui,pubkeys,numpubs)) == 0 || ordermatchprice == 0. || bestdestsatoshis == 0 ) { printf("bestutxo.%p ordermatchprice %.8f bestdestsatoshis %.8f\n",bestutxo,ordermatchprice,dstr(bestdestsatoshis)); - return(clonestr("{\"error\":\"cant find ordermatch utxo\"}")); + return(clonestr("{\"error\":\"cant find ordermatch utxo, need to change relvolume to be closer to available\"}")); } pubkeys[numpubs++] = bestutxo->pubkey; if ( LP_quoteinfoinit(&Q,bestutxo,rel,ordermatchprice,bestsatoshis,bestdestsatoshis) < 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index b04431d4d..8120fed4c 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -75,8 +75,21 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he } printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); - if ( dp->SRCREALTIME == 0 && strcmp(dp->dest,"KMD") == 0 ) - return; + if ( strcmp(dp->dest,"KMD") == 0 ) + { + if ( dp->SRCREALTIME == 0 ) + return; + if ( bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) + { + printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); + return; + } + if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) + { + printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); + return; + } + } if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 ) { dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000); @@ -84,9 +97,12 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he ptrs[0] = (void *)myinfo; ptrs[1] = (void *)dp; ptrs[2] = (void *)(uint64_t)minsigs; - ptrs[3] = (void *)DPOW_DURATION; + if ( strcmp(dp->dest,"KMD") == 0 ) + ptrs[3] = (void *)(DPOW_DURATION * 60); // essentially try forever for assetchains + else ptrs[3] = (void *)DPOW_DURATION; ptrs[4] = 0; memcpy(&ptrs[5],&checkpoint,sizeof(checkpoint)); + dp->activehash = checkpoint.blockhash.hash; if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 ) { } From ba46c908608c24232272a3dfade6f2f2d8bb7236 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 13:47:16 +0300 Subject: [PATCH 340/346] Test --- iguana/iguana_notary.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 8120fed4c..4049b6602 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -89,6 +89,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); return; } + printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); } if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 ) { From dfd881e7a50393d497e49c1668b302b033c9a175 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 14:22:53 +0300 Subject: [PATCH 341/346] Test --- iguana/dpow/dpow_rpc.c | 2 +- iguana/iguana_notary.c | 41 ++++++++++++++++++++++++++++------------- iguana/m_splitfund | 1 + 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 64dc63d87..f69d68886 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -177,7 +177,7 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c memset(blockhash.bytes,0,sizeof(blockhash)); if ( coin->FULLNODE < 0 ) { - if ( coin->lastbesthashtime+20 > time(NULL) && bits256_nonz(coin->lastbesthash) != 0 ) + if ( coin->lastbesthashtime+2 > time(NULL) && bits256_nonz(coin->lastbesthash) != 0 ) return(coin->lastbesthash); if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getbestblockhash","")) != 0 ) { diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 4049b6602..2bd00f340 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -60,7 +60,7 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { - void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t freq,minsigs; //uint8_t pubkeys[64][33]; + void **ptrs; char str[65]; cJSON *blockjson; struct iguana_info *coin; struct dpow_checkpoint checkpoint; int32_t freq,minsigs; //uint8_t pubkeys[64][33]; dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); checkpoint = dp->srcfifo[dp->srcconfirms]; if ( strcmp("BTC",dp->dest) == 0 ) @@ -73,26 +73,41 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he freq = 1; minsigs = 11; } - printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { if ( dp->SRCREALTIME == 0 ) return; - if ( bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) + if ( (coin= iguana_coinfind(dp->symbol)) != 0 ) { - printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); - return; - } - if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) - { - printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); - return; - } - printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); + hash = dpow_getbestblockhash(myinfo,coin); + if ( bits256_nonz(hash) != 0 ) + { + if ( (blockjson= dpow_getblock(myinfo,coin,hash)) != 0 ) + { + height = jint(blockjson,"height"); + blocktime = juint(blockjson,"time"); + if ( height > 0 && blocktime > 0 ) + dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); + free_json(blockjson); + if ( bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) + { + printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); + return; + } + if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) + { + printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); + return; + } + printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); + } else return; + } else return; + } else return; } if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 ) { + printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000); ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint)); ptrs[0] = (void *)myinfo; @@ -193,7 +208,7 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) } if ( (height= dpow_getchaintip(myinfo,&blockhash,&blocktime,dp->srctx,&dp->numsrctx,src)) != dp->last.blockhash.height && height >= 0 ) { - char str[65]; printf("[%s].%d %s %s height.%d vs last.%d\n",dp->dest,dp->SRCHEIGHT,dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height); + //char str[65]; printf("[%s].%d %s %s height.%d vs last.%d\n",dp->dest,dp->SRCHEIGHT,dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height); if ( dp->lastheight == 0 ) dp->lastheight = height-1; if ( height < dp->last.blockhash.height ) diff --git a/iguana/m_splitfund b/iguana/m_splitfund index dbaf4cb51..342f8e6de 100755 --- a/iguana/m_splitfund +++ b/iguana/m_splitfund @@ -22,6 +22,7 @@ curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"WLC\",\"agent\":\"iguana\ curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"KV\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":10}" curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"CEAL\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":10}" curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"MESH\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":10}" +curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"MNZ\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":10}" curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"USD\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":10}" curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"EUR\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":10}" From 68c14b85fb696fdf82e21b677165350dd784640f Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 15:13:15 +0300 Subject: [PATCH 342/346] Test --- iguana/dPoW.h | 1 + iguana/iguana_notary.c | 110 ++++++++++++++++++++++++++++++++++------- 2 files changed, 93 insertions(+), 18 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index f2bd64821..b95c550f7 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -20,6 +20,7 @@ #define DPOW_CHECKPOINTFREQ 10 #define DPOW_MINSIGS 13 +#define DPOW_MIN_ASSETCHAIN_SIGS 11 //#define DPOW_M(bp) ((bp)->minsigs) // (((bp)->numnotaries >> 1) + 1) #define DPOW_MODIND(bp,offset) (((((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries) + (offset)) % (bp)->numnotaries) #define DPOW_VERSION 0x0781 diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 2bd00f340..5e61662f6 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -58,6 +58,77 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che checkpoint->blockhash.height = height; } +int32_t dpow_txhasnotarization(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) +{ + cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[35]; bits256 spenttxid; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0; + if ( (txobj= dpow_gettransaction(myinfo,coin,txid)) != 0 ) + { + if ( (vins= jarray(&numvins,txobj,"vin")) != 0 ) + { + if ( numvins >= DPOW_MIN_ASSETCHAIN_SIGS ) + { + numnotaries = 0; + for (i=0; i>= 1; + decode_hex(script,len,hexstr); + if ( script[0] == 33 && script[34] == 0xac ) + { + for (j=0; j 0 ) + { + if ( numnotaries >= DPOW_MIN_ASSETCHAIN_SIGS ) + hasnotarization = 1; + printf("numnotaries.%d hasnotarization.%d\n",numnotaries,hasnotarization); + } + } + } + free_json(txobj); + } + return(hasnotarization); +} + +int32_t dpow_hasnotarization(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *blockjson) +{ + int32_t i,n,hasnotarization = 0; bits256 txid; cJSON *txarray; + if ( (txarray= jarray(&n,blockjson,"tx")) != 0 ) + { + for (i=0; isrcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - if ( dp->SRCREALTIME == 0 ) - return; + //if ( dp->SRCREALTIME == 0 ) + // return; if ( (coin= iguana_coinfind(dp->symbol)) != 0 ) { hash = dpow_getbestblockhash(myinfo,coin); @@ -85,22 +156,25 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { if ( (blockjson= dpow_getblock(myinfo,coin,hash)) != 0 ) { - height = jint(blockjson,"height"); - blocktime = juint(blockjson,"time"); - if ( height > 0 && blocktime > 0 ) - dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); - free_json(blockjson); - if ( bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) + if ( dpow_hasnotarization(myinfo,coin,blockjson) <= 0 ) { - printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); - return; - } - if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) - { - printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); - return; - } - printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); + height = jint(blockjson,"height"); + blocktime = juint(blockjson,"time"); + if ( height > 0 && blocktime > 0 ) + dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); + free_json(blockjson); + if ( bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) + { + printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); + return; + } + if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) + { + printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); + return; + } + printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); + } else return; } else return; } else return; } else return; From 9bd6e83700c3d44b624424eafc8946dcfc6ac5c0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 15:23:38 +0300 Subject: [PATCH 343/346] Test --- iguana/iguana_notary.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 5e61662f6..427fdd37f 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -160,15 +160,19 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { height = jint(blockjson,"height"); blocktime = juint(blockjson,"time"); + free_json(blockjson); if ( height > 0 && blocktime > 0 ) + { dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); - free_json(blockjson); - if ( bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) + printf("dynamic set %s <- height.%d\n",bits256_str(str,hash),height); + } + else return; + if ( bits256_nonz(dp->activehash) != 0 && bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) { printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); return; } - if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) + else if ( bits256_nonz(dp->lastnotarized) != 0 && bits256_cmp(dp->lastnotarized,checkpoint.blockhash.hash) == 0 ) { printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); return; @@ -264,7 +268,7 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) if ( (height= dpow_getchaintip(myinfo,&blockhash,&blocktime,dp->desttx,&dp->numdesttx,dest)) != dp->destchaintip.blockhash.height && height >= 0 ) { char str[65]; - if ( strcmp(dp->symbol,"KMD") == 0 || height != dp->destchaintip.blockhash.height+1 ) + if ( strcmp(dp->symbol,"KMD") == 0 )//|| height != dp->destchaintip.blockhash.height+1 ) printf("[%s].%d %s %s height.%d vs last.%d\n",dp->symbol,dp->SRCHEIGHT,dp->dest,bits256_str(str,blockhash),height,dp->destchaintip.blockhash.height); if ( height <= dp->destchaintip.blockhash.height ) { From ff57103aa9eb406ee256bd250660ea950550da34 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 15:27:33 +0300 Subject: [PATCH 344/346] Test --- iguana/iguana_notary.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 427fdd37f..69f72b99c 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -306,7 +306,7 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) } } } - else + else if ( strcmp(dp->symbol,"KMD") == 0 ) { while ( dp->lastheight <= height ) { @@ -314,6 +314,12 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) dpow_srcupdate(myinfo,dp,dp->lastheight++,blockhash,(uint32_t)time(NULL),blocktime); } } + else + { + dp->lastheight = height; + blockhash = dpow_getblockhash(myinfo,src,dp->lastheight); + dpow_srcupdate(myinfo,dp,dp->lastheight,blockhash,(uint32_t)time(NULL),blocktime); + } } //else printf("error getchaintip for %s\n",dp->symbol); } else printf("iguana_dPoWupdate missing src.(%s) %p or dest.(%s) %p\n",dp->symbol,src,dp->dest,dest); } From b4b3109eb51b5d29cc94b72681cdd7ac80357e07 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 15:33:44 +0300 Subject: [PATCH 345/346] Test --- iguana/iguana_notary.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 69f72b99c..a37c8853c 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -164,9 +164,9 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( height > 0 && blocktime > 0 ) { dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); - printf("dynamic set %s <- height.%d\n",bits256_str(str,hash),height); - } - else return; + printf("dynamic set %s/%s %s <- height.%d\n",dp->symbol,dp->dest,bits256_str(str,hash),height); + checkpoint = dp->last; + } else return; if ( bits256_nonz(dp->activehash) != 0 && bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) { printf("activehash.(%s) is current checkpoint, skip\n",bits256_str(str,dp->activehash)); From 6bf17b2b34ef7b7f078783faa9d158fe3dc596a3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 18 Oct 2017 15:40:19 +0300 Subject: [PATCH 346/346] Test --- basilisk/basilisk_bitcoin.c | 4 ++-- iguana/dpow/dpow_fsm.c | 2 +- iguana/iguana_notary.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index ae7937fe9..942539260 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -602,7 +602,7 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi free_json(vins); return(rawtx); } - printf("splitfunds tx.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); + printf("%s splitfunds tx.(%s) vins.(%s)\n",coin->symbol,rawtx,jprint(vins,0)); if ( signedtxidp != 0 ) { if ( (signedtx= iguana_signrawtx(myinfo,coin,0,signedtxidp,completedp,vins,rawtx,0,0)) != 0 ) @@ -615,7 +615,7 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi free(rawtx); rawtx = signedtx, signedtx = 0; } - } else printf("error signing raw utxoduplicates tx\n"); + } else printf("error signing raw %s utxoduplicates tx\n",coin->symbol); } } if ( vins != 0 ) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 8adf8ddec..848b87bf9 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -326,7 +326,7 @@ void dpow_statemachinestart(void *ptr) return; } bp->myind = myind; - printf("[%d] statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",bp->myind,dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp); + printf("[%d] notarize %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",bp->myind,dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp); if ( bp->isratify != 0 && memcmp(bp->notaries[0].pubkey,bp->ratified_pubkeys[0],33) != 0 ) { for (i=0; i<33; i++) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index a37c8853c..c6f98f4f2 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -164,7 +164,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( height > 0 && blocktime > 0 ) { dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); - printf("dynamic set %s/%s %s <- height.%d\n",dp->symbol,dp->dest,bits256_str(str,hash),height); + //printf("dynamic set %s/%s %s <- height.%d\n",dp->symbol,dp->dest,bits256_str(str,hash),height); checkpoint = dp->last; } else return; if ( bits256_nonz(dp->activehash) != 0 && bits256_cmp(dp->activehash,checkpoint.blockhash.hash) == 0 ) @@ -177,7 +177,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); return; } - printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); + //printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); } else return; } else return; } else return; @@ -185,7 +185,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he } if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 ) { - printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); + //printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000); ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint)); ptrs[0] = (void *)myinfo;