From 96e5fd5850a98bbed1ce7d15b024d0c818aaeef9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 19:07:12 +0200 Subject: [PATCH 01/33] Test --- iguana/exchanges/LP_instantdex.c | 2 +- iguana/exchanges/LP_rpc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 02c584080..34560238a 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -335,7 +335,7 @@ char *LP_unlockedspend(void *ctx,char *symbol,bits256 utxotxid) jaddnum(retjson,"expiration",expiration); claimtime = LP_claimtime(coin,expiration); jaddnum(retjson,"claimtime",claimtime); - if ( claimtime != 0 && strcmp(destaddr,coin->smartaddr) == 0 && time(NULL) > expiration ) + if ( claimtime > expiration && strcmp(destaddr,coin->smartaddr) == 0 ) { char str[65]; printf("LP_timespend satoshis %.8f %s/v%d\n",dstr(satoshis - coin->txfee),bits256_str(str,utxotxid),utxovout); if ( (signedtx= basilisk_swap_bobtxspend(&signedtxid,coin->txfee,"timespend",coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->wiftype,ctx,G.LP_privkey,0,redeemscript+2,redeemlen-2,0,0,utxotxid,utxovout,coin->smartaddr,G.LP_pubsecp,0,claimtime,&destamount,0,0,vinaddr,0,coin->zcash)) != 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index b8e20e017..a91a1d6ed 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -928,7 +928,7 @@ uint32_t LP_heighttime(char *symbol,int32_t height) { if ( (retjson= cJSON_Parse(blockhashstr)) != 0 ) { - //printf("height.(%s)\n",jprint(retjson,0)); + printf("height.(%s)\n",jprint(retjson,0)); timestamp = juint(retjson,"time"); free_json(retjson); } From 5bcb5966f77b4900da8434859004e24688f50ad5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 19:12:38 +0200 Subject: [PATCH 02/33] 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 a91a1d6ed..5b4e1a39f 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -926,9 +926,9 @@ uint32_t LP_heighttime(char *symbol,int32_t height) { if ( (blockhashstr= LP_blockhashstr(symbol,height)) != 0 ) { - if ( (retjson= cJSON_Parse(blockhashstr)) != 0 ) + if ( (retjson= LP_getblockhashstr(symbol,blockhashstr)) != 0 ) { - printf("height.(%s)\n",jprint(retjson,0)); + printf("%s -> height.(%s)\n",blockhashstr,jprint(retjson,0)); timestamp = juint(retjson,"time"); free_json(retjson); } From 53debd139cc9602c9e41e41e30e78addb4ab6c9a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 19:15:45 +0200 Subject: [PATCH 03/33] Test --- iguana/exchanges/LP_instantdex.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 34560238a..404b04398 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -288,10 +288,13 @@ int64_t LP_claimtx(void *ctx,struct iguana_info *coin,bits256 *claimtxidp,bits25 uint32_t LP_claimtime(struct iguana_info *coin,uint32_t expiration) { uint32_t heighttime,now = (uint32_t)time(NULL); - heighttime = LP_heighttime(coin->symbol,coin->height); - printf("claimtime: now %u height.%d heighttime.%u expiration.%u\n",now,coin->height,heighttime,expiration); - if ( heighttime >= expiration ) - return(heighttime + 1); + if ( coin->height > 0 ) + { + heighttime = LP_heighttime(coin->symbol,coin->height-1); + printf("claimtime: now %u height.%d heighttime.%u expiration.%u\n",now,coin->height,heighttime,expiration); + if ( heighttime >= expiration ) + return(heighttime + 1); + } return(0); } From e4bde87d8a0c3d481c7134a369cc8147890c16ee Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 19:18:16 +0200 Subject: [PATCH 04/33] Test --- iguana/exchanges/LP_instantdex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 404b04398..1e0a01562 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -288,9 +288,9 @@ int64_t LP_claimtx(void *ctx,struct iguana_info *coin,bits256 *claimtxidp,bits25 uint32_t LP_claimtime(struct iguana_info *coin,uint32_t expiration) { uint32_t heighttime,now = (uint32_t)time(NULL); - if ( coin->height > 0 ) + if ( coin->height > 8 ) { - heighttime = LP_heighttime(coin->symbol,coin->height-1); + heighttime = LP_heighttime(coin->symbol,coin->height-8); printf("claimtime: now %u height.%d heighttime.%u expiration.%u\n",now,coin->height,heighttime,expiration); if ( heighttime >= expiration ) return(heighttime + 1); From 3c6136ad2950bca93c93bf2d86aefb24296a820f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 19:40:36 +0200 Subject: [PATCH 05/33] Enable auto spend --- iguana/exchanges/LP_instantdex.c | 31 ++++++++++++++++--------------- iguana/exchanges/LP_rpc.c | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 1e0a01562..247d158e4 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -155,6 +155,19 @@ void LP_instantdex_depositadd(char *coinaddr,bits256 txid) LP_instantdex_filescreate(coinaddr); } +uint32_t LP_claimtime(struct iguana_info *coin,uint32_t expiration) +{ + uint32_t heighttime,now = (uint32_t)time(NULL); + if ( coin->height > 8 ) + { + heighttime = LP_heighttime(coin->symbol,coin->height-8); + printf("claimtime: now %u height.%d heighttime.%u expiration.%u\n",now,coin->height,heighttime,expiration); + if ( heighttime >= expiration ) + return(heighttime + 1); + } + return(0); +} + int32_t LP_deposit_addr(char *symbol,char *p2shaddr,uint8_t *script,uint8_t taddr,uint8_t p2shtype,uint32_t timestamp,uint8_t *pubsecp33) { uint8_t elsepub33[33],p2sh_rmd160[20]; int32_t n; @@ -285,19 +298,6 @@ int64_t LP_claimtx(void *ctx,struct iguana_info *coin,bits256 *claimtxidp,bits25 return(sum); } -uint32_t LP_claimtime(struct iguana_info *coin,uint32_t expiration) -{ - uint32_t heighttime,now = (uint32_t)time(NULL); - if ( coin->height > 8 ) - { - heighttime = LP_heighttime(coin->symbol,coin->height-8); - printf("claimtime: now %u height.%d heighttime.%u expiration.%u\n",now,coin->height,heighttime,expiration); - if ( heighttime >= expiration ) - return(heighttime + 1); - } - return(0); -} - char *LP_unlockedspend(void *ctx,char *symbol,bits256 utxotxid) { cJSON *txjson,*vouts,*vout0,*opret,*sobj,*retjson; uint16_t utxovout; char *signedtx,*opretstr,vinaddr[64],destaddr[64]; uint32_t expiration,claimtime; uint8_t redeemscript[128]; bits256 signedtxid,sendtxid; int32_t numvouts,redeemlen; int64_t satoshis,destamount; struct iguana_info *coin; @@ -340,10 +340,10 @@ char *LP_unlockedspend(void *ctx,char *symbol,bits256 utxotxid) jaddnum(retjson,"claimtime",claimtime); if ( claimtime > expiration && strcmp(destaddr,coin->smartaddr) == 0 ) { - char str[65]; printf("LP_timespend satoshis %.8f %s/v%d\n",dstr(satoshis - coin->txfee),bits256_str(str,utxotxid),utxovout); + char str[65]; //printf("LP_timespend satoshis %.8f %s/v%d\n",dstr(satoshis - coin->txfee),bits256_str(str,utxotxid),utxovout); if ( (signedtx= basilisk_swap_bobtxspend(&signedtxid,coin->txfee,"timespend",coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->wiftype,ctx,G.LP_privkey,0,redeemscript+2,redeemlen-2,0,0,utxotxid,utxovout,coin->smartaddr,G.LP_pubsecp,0,claimtime,&destamount,0,0,vinaddr,0,coin->zcash)) != 0 ) { - //sendtxid = LP_broadcast("timespend",symbol,signedtx,signedtxid); + sendtxid = LP_broadcast("timespend",symbol,signedtx,signedtxid); jaddstr(retjson,"signedtx",signedtx); jaddbits256(retjson,"txid",signedtxid); if ( bits256_cmp(sendtxid,signedtxid) == 0 ) @@ -422,6 +422,7 @@ int32_t LP_claim_submit(void *ctx,cJSON *txids,int64_t *sump,struct iguana_info { flagi = 1; claimtime = (uint32_t)time(NULL)-777; + //claimtime = LP_claimtime(coin,expiration); item = cJSON_CreateObject(); jaddbits256(item,"txid",utxotxid); jaddnum(item,"deposit",dstr(LP_value_extract(vout0,0))); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 5b4e1a39f..28b340167 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -928,7 +928,7 @@ uint32_t LP_heighttime(char *symbol,int32_t height) { if ( (retjson= LP_getblockhashstr(symbol,blockhashstr)) != 0 ) { - printf("%s -> height.(%s)\n",blockhashstr,jprint(retjson,0)); + //printf("%s -> height.(%s)\n",blockhashstr,jprint(retjson,0)); timestamp = juint(retjson,"time"); free_json(retjson); } From b4bc25d1baf36c834a23f8dc462df98fd3ee7a46 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 20:28:08 +0200 Subject: [PATCH 06/33] Print --- 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 7d598d394..8a260f807 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -1266,13 +1266,13 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu char *myipaddr=0,version[64]; long filesize,n; int32_t valid,timeout; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); sprintf(version,"Marketmaker %s.%s %s rsize.%ld",LP_MAJOR_VERSION,LP_MINOR_VERSION,LP_BUILD_NUMBER,sizeof(struct basilisk_request)); bitcoind_RPC_inittime = 1; - printf("%s %u\n",version,calc_crc32(0,version,(int32_t)strlen(version))); if ( LP_MAXPRICEINFOS > 256 ) { printf("LP_MAXPRICEINFOS %d wont fit in a uint8_t, need to increase the width of the baseind and relind for struct LP_pubkey_quote\n",LP_MAXPRICEINFOS); exit(-1); } LP_showwif = juint(argjson,"wif"); + printf("showwif.%d %s %u\n",LP_showwif,version,calc_crc32(0,version,(int32_t)strlen(version))); if ( passphrase == 0 || passphrase[0] == 0 ) { printf("jeezy says we cant use the nullstring as passphrase and I agree\n"); From c9b16cbbc2b6f948c22a5f3c39e02768b0a92d4e Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 20:29:45 +0200 Subject: [PATCH 07/33] 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 364d9ff6f..4a565e9aa 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -309,7 +309,7 @@ char *LP_getcoin(char *symbol) HASH_ITER(hh,LP_coins,coin,tmp) { if ( strcmp(symbol,coin->symbol) == 0 ) - item = LP_coinjson(coin,0); + item = LP_coinjson(coin,LP_showwif); if ( coin->inactive == 0 ) numenabled++; else numdisabled++; From c5b3e039c090397806638ee9f660acf0b70da374 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 21:10:35 +0200 Subject: [PATCH 08/33] Btc2kmd wif conversion --- iguana/exchanges/mm.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index 7bc05d9f1..04d848599 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -161,23 +161,35 @@ int main(int argc, const char * argv[]) OS_init(); if ( strstr(argv[0],"btc2kmd") != 0 && argv[1] != 0 ) { - uint8_t addrtype,rmd160[20],rmd160b[20]; char coinaddr[64],coinaddr2[64]; - bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160,(char *)argv[1]); - if ( addrtype == 0 ) + bits256 privkey,checkkey; uint8_t addrtype,tmptype,rmd160[20],rmd160b[20]; char coinaddr[64],coinaddr2[64],kmdwif[64],str[65],str2[65]; + if ( LP_wifstr_valid("BTC",(char *)argv[1]) > 0 ) { - bitcoin_address("KMD",coinaddr,0,60,rmd160,20); - bitcoin_addr2rmd160("KMD",0,&addrtype,rmd160b,coinaddr); - bitcoin_address("BTC",coinaddr2,0,0,rmd160b,20); + bitcoin_wif2priv("BTC",0,&tmptype,&privkey,(char *)argv[1]); + bitcoin_priv2wif("KMD",0,kmdwif,privkey,188); + bitcoin_wif2priv("KMD",0,&tmptype,&checkkey,kmdwif); + if ( bits256_cmp(privkey,checkkey) == 0 ) + printf("BTC %s -> KMD %s: privkey %s\n",argv[1],kmdwif,bits256_str(str,privkey)); + else printf("ERROR BTC %s %s != KMD %s %s\n",argv[1],bits256_str(str,privkey),kmdwif,bits256_str(str2,checkkey)); } - else if ( addrtype == 60 ) + else { - bitcoin_address("BTC",coinaddr,0,0,rmd160,20); - bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160b,coinaddr); - bitcoin_address("KMD",coinaddr2,0,60,rmd160b,20); + bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160,(char *)argv[1]); + if ( addrtype == 0 ) + { + bitcoin_address("KMD",coinaddr,0,60,rmd160,20); + bitcoin_addr2rmd160("KMD",0,&addrtype,rmd160b,coinaddr); + bitcoin_address("BTC",coinaddr2,0,0,rmd160b,20); + } + else if ( addrtype == 60 ) + { + bitcoin_address("BTC",coinaddr,0,0,rmd160,20); + bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160b,coinaddr); + bitcoin_address("KMD",coinaddr2,0,60,rmd160b,20); + } + printf("(%s) -> %s -> %s\n",(char *)argv[1],coinaddr,coinaddr2); + if ( strcmp((char *)argv[1],coinaddr2) != 0 ) + printf("ERROR\n"); } - printf("(%s) -> %s -> %s\n",(char *)argv[1],coinaddr,coinaddr2); - if ( strcmp((char *)argv[1],coinaddr2) != 0 ) - printf("ERROR\n"); exit(0); } else if ( argv[1] != 0 && strcmp(argv[1],"hush") == 0 ) From 948d26d68a87b5ff49eef0b42d14f8bd2de6352f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Feb 2018 22:16:15 +0200 Subject: [PATCH 09/33] Move mutex --- iguana/exchanges/LP_nativeDEX.c | 4 ++-- iguana/exchanges/LP_remember.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 8a260f807..d11343045 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -651,7 +651,7 @@ void LP_coinsloop(void *_coins) nonz++; if ( strcmp("BTC",coins) == 0 )//&& coin->lastscanht < coin->longestchain-3 ) printf("[%s]: %s ref.%d scan.%d to %d, longest.%d\n",coins,coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); - for (j=0; j<1000; j++) + for (j=0; j<100; j++) { if ( LP_blockinit(coin,coin->lastscanht) < 0 ) { @@ -663,7 +663,7 @@ void LP_coinsloop(void *_coins) if ( coin->lastscanht == coin->longestchain+1 || strcmp("BTC",coins) == 0 ) break; } - if ( strcmp("BTC",coins) == 0 ) + //if ( strcmp("BTC",coins) == 0 ) printf("done [%s]: %s ref.%d scan.%d to %d, longest.%d\n",coins,coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); } } diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index e078e7082..25bc3ace8 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1162,6 +1162,12 @@ 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 ( 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(cJSON_Parse("{\"error\":\"inactive bob or alice coin\"}")); + } + portable_mutex_lock(&LP_swaplistmutex); //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); @@ -1170,11 +1176,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti { //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); - 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); LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBDEPOSIT); @@ -1486,6 +1487,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti free_json(item); item = 0; } + portable_mutex_unlock(&LP_swaplistmutex); return(item); } @@ -1514,7 +1516,7 @@ void for_satinder() char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid,int32_t forceflag,int32_t pendingonly) { uint64_t ridqids[4096],ridqid; char fname[512]; FILE *fp; cJSON *item,*retjson,*array,*totalsobj; uint32_t r,q,quoteid,requestid; int64_t KMDtotals[LP_MAXPRICEINFOS],BTCtotals[LP_MAXPRICEINFOS],Btotal,Ktotal; int32_t i,j,count=0; - portable_mutex_lock(&LP_swaplistmutex); + //portable_mutex_lock(&LP_swaplistmutex); memset(ridqids,0,sizeof(ridqids)); memset(KMDtotals,0,sizeof(KMDtotals)); memset(BTCtotals,0,sizeof(BTCtotals)); @@ -1595,7 +1597,7 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid,int32_t forc else if ( Ktotal < 0 && Btotal > 0 ) jaddnum(retjson,"avesell",(double)-Btotal/Ktotal); } - portable_mutex_unlock(&LP_swaplistmutex); + //portable_mutex_unlock(&LP_swaplistmutex); return(jprint(retjson,1)); } From 28aa5c8f842fe4cf6bc2a7f9577d85fa085d94f0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 00:35:31 +0200 Subject: [PATCH 10/33] Pause before exit swap loops --- iguana/exchanges/LP_swap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 64ac8a3be..ad2e9be0d 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -906,6 +906,7 @@ void LP_bobloop(void *_swap) } } else printf("swap timed out\n"); LP_swap_endcritical = (uint32_t)time(NULL); + sleep(13); LP_pendswap_add(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid); //swap->I.finished = LP_swapwait(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(swap->I.bobstr,swap->I.alicestr)*3,swap->I.aliceconfirms == 0 ? 3 : 30); basilisk_swap_finished(swap); @@ -986,6 +987,7 @@ void LP_aliceloop(void *_swap) } } LP_swap_endcritical = (uint32_t)time(NULL); + sleep(13); LP_pendswap_add(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid); //swap->I.finished = LP_swapwait(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(swap->I.bobstr,swap->I.alicestr)*3,swap->I.aliceconfirms == 0 ? 3 : 30); basilisk_swap_finished(swap); From f22e23317b63dcb6867e1ca057657e03dd91d3b3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 10:57:28 +0200 Subject: [PATCH 11/33] UFO --- iguana/exchanges/coins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/coins b/iguana/exchanges/coins index 75a237cac..f912c86fe 100644 --- a/iguana/exchanges/coins +++ b/iguana/exchanges/coins @@ -1,2 +1,2 @@ -export coins="[{\"coin\":\"ETH\",\"name\":\"ethereum\",\"etomic\":\"0x0000000000000000000000000000000000000000\",\"rpcport\":80}, {\"coin\":\"EOS\",\"name\":\"EOS\",\"etomic\":\"0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0\",\"rpcport\":80}, {\"coin\":\"KREDS\",\"name\":\"kreds\",\"rpcport\":3850,\"pubtype\":45,\"p2shtype\":5,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"SNG\",\"name\":\"snowgem\",\"rpcport\":16112,\"taddr\":28,\"pubtype\":40,\"p2shtype\":45,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"ZEL\",\"name\":\"zelcash\",\"rpcport\":16124,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"HTML\",\"name\":\"htmlcoin\",\"rpcport\":4889,\"pubtype\":41,\"p2shtype\":100,\"wiftype\":169,\"txfee\":400000}, {\"coin\":\"MNX\",\"name\":\"Minexcoin\",\"rpcport\":17786,\"pubtype\":75,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LTZ\",\"name\":\"litecoinz\",\"rpcport\":29332,\"taddr\":10,\"pubtype\":179,\"p2shtype\":184,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"BAY\",\"name\":\"bitbay\",\"isPoS\":1,\"rpcport\":19915,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"OOT\",\"asset\":\"OOT\",\"rpcport\":12467}, {\"coin\":\"ZOI\",\"name\":\"zoin\",\"rpcport\":8255,\"pubtype\":80,\"p2shtype\":7,\"wiftype\":208,\"txfee\":1000}, {\"coin\": \"PIZZA\",\"asset\": \"PIZZA\",\"rpcport\": 11116},{\"coin\": \"BEER\",\"asset\": \"BEER\",\"rpcport\": 8923}, {\"coin\":\"GRS\",\"name\":\"groestlcoin\",\"rpcport\":1441,\"pubtype\":36,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XMCC\",\"name\":\"monoeci\",\"confpath\":\"${HOME#}/.monoeciCore/monoeci.conf\",\"rpcport\":24156,\"pubtype\":50,\"p2shtype\":73,\"wiftype\":77,\"txfee\":10000}, {\"coin\":\"BTCH\",\"asset\":\"BTCH\",\"rpcport\":8800},{\"coin\":\"ETOMIC\",\"asset\":\"ETOMIC\",\"rpcport\":10271},{\"coin\":\"AXO\",\"asset\":\"AXO\",\"rpcport\":12927},{\"coin\":\"CRC\",\"name\":\"crowdcoin\",\"confpath\":\"${HOME#}/.crowdcoincore/crowdcoin.conf\",\"rpcport\":11998,\"pubtype\":28,\"p2shtype\":88,\"wiftype\":0,\"txfee\":10000}, {\"coin\":\"VOT\",\"name\":\"votecoin\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"INN\",\"name\":\"innova\",\"confpath\":\"${HOME#}/.innovacore/innova.conf\",\"rpcport\":8818,\"pubtype\":102,\"p2shtype\":20,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":28,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"EFL\",\"name\":\"egulden\",\"confpath\":\"${HOME#}/.egulden/coin.conf\",\"rpcport\":21015,\"pubtype\":48,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"GBX\",\"name\":\"gobyte\",\"confpath\":\"${HOME#}/.gobytecore/gobyte.conf\",\"rpcport\":12454,\"pubtype\":38,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"BCO\",\"name\":\"bridgecoin\",\"rpcport\":6332,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"confpath\":\"${HOME#}/.lore/blackcoin.conf\",\"isPoS\":1,\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":100000}, {\"coin\":\"BTG\",\"name\":\"bitcoingold\",\"rpcport\":8332,\"pubtype\":38,\"p2shtype\":23,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BCH\",\"name\":\"bch\",\"rpcport\":33333,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"ABY\",\"name\":\"applebyte\",\"rpcport\":8607,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":100000}, {\"coin\":\"STAK\",\"name\":\"straks\",\"rpcport\":7574,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"XZC\",\"name\":\"zcoin\",\"rpcport\":8888,\"pubtype\":82,\"p2shtype\":7,\"wiftype\":210,\"txfee\":10000}, {\"coin\":\"QTUM\",\"name\":\"qtum\",\"rpcport\":3889,\"pubtype\":58,\"p2shtype\":50,\"wiftype\":128,\"txfee\":400000}, {\"coin\":\"PURA\",\"name\":\"pura\",\"rpcport\":55555,\"pubtype\":55,\"p2shtype\":16,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"DSR\",\"name\":\"desire\",\"confpath\":\"${HOME#}/.desirecore/desire.conf\",\"rpcport\":9918,\"pubtype\":30,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"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\":\"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\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"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\":\"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\":10000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"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\":100000}, {\"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\":10000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":10000}, {\"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\":\"MSHARK\",\"asset\":\"MSHARK\",\"rpcport\":8846}, {\"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\":\"UFO\",\"name\":\"ufocoin\",\"confpath\":\"${HOME#}/.ufo/ufocoin.conf\",\"rpcport\":9888,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":155,\"txfee\":100000}, {\"coin\":\"ETH\",\"name\":\"ethereum\",\"etomic\":\"0x0000000000000000000000000000000000000000\",\"rpcport\":80}, {\"coin\":\"EOS\",\"name\":\"EOS\",\"etomic\":\"0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0\",\"rpcport\":80}, {\"coin\":\"KREDS\",\"name\":\"kreds\",\"rpcport\":3850,\"pubtype\":45,\"p2shtype\":5,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"SNG\",\"name\":\"snowgem\",\"rpcport\":16112,\"taddr\":28,\"pubtype\":40,\"p2shtype\":45,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"ZEL\",\"name\":\"zelcash\",\"rpcport\":16124,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"HTML\",\"name\":\"htmlcoin\",\"rpcport\":4889,\"pubtype\":41,\"p2shtype\":100,\"wiftype\":169,\"txfee\":400000}, {\"coin\":\"MNX\",\"name\":\"Minexcoin\",\"rpcport\":17786,\"pubtype\":75,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LTZ\",\"name\":\"litecoinz\",\"rpcport\":29332,\"taddr\":10,\"pubtype\":179,\"p2shtype\":184,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"BAY\",\"name\":\"bitbay\",\"isPoS\":1,\"rpcport\":19915,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"OOT\",\"asset\":\"OOT\",\"rpcport\":12467}, {\"coin\":\"ZOI\",\"name\":\"zoin\",\"rpcport\":8255,\"pubtype\":80,\"p2shtype\":7,\"wiftype\":208,\"txfee\":1000}, {\"coin\": \"PIZZA\",\"asset\": \"PIZZA\",\"rpcport\": 11116},{\"coin\": \"BEER\",\"asset\": \"BEER\",\"rpcport\": 8923}, {\"coin\":\"GRS\",\"name\":\"groestlcoin\",\"rpcport\":1441,\"pubtype\":36,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XMCC\",\"name\":\"monoeci\",\"confpath\":\"${HOME#}/.monoeciCore/monoeci.conf\",\"rpcport\":24156,\"pubtype\":50,\"p2shtype\":73,\"wiftype\":77,\"txfee\":10000}, {\"coin\":\"BTCH\",\"asset\":\"BTCH\",\"rpcport\":8800},{\"coin\":\"ETOMIC\",\"asset\":\"ETOMIC\",\"rpcport\":10271},{\"coin\":\"AXO\",\"asset\":\"AXO\",\"rpcport\":12927},{\"coin\":\"CRC\",\"name\":\"crowdcoin\",\"confpath\":\"${HOME#}/.crowdcoincore/crowdcoin.conf\",\"rpcport\":11998,\"pubtype\":28,\"p2shtype\":88,\"wiftype\":0,\"txfee\":10000}, {\"coin\":\"VOT\",\"name\":\"votecoin\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"INN\",\"name\":\"innova\",\"confpath\":\"${HOME#}/.innovacore/innova.conf\",\"rpcport\":8818,\"pubtype\":102,\"p2shtype\":20,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":28,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"EFL\",\"name\":\"egulden\",\"confpath\":\"${HOME#}/.egulden/coin.conf\",\"rpcport\":21015,\"pubtype\":48,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"GBX\",\"name\":\"gobyte\",\"confpath\":\"${HOME#}/.gobytecore/gobyte.conf\",\"rpcport\":12454,\"pubtype\":38,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"BCO\",\"name\":\"bridgecoin\",\"rpcport\":6332,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"confpath\":\"${HOME#}/.lore/blackcoin.conf\",\"isPoS\":1,\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":100000}, {\"coin\":\"BTG\",\"name\":\"bitcoingold\",\"rpcport\":8332,\"pubtype\":38,\"p2shtype\":23,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BCH\",\"name\":\"bch\",\"rpcport\":33333,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"ABY\",\"name\":\"applebyte\",\"rpcport\":8607,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":100000}, {\"coin\":\"STAK\",\"name\":\"straks\",\"rpcport\":7574,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"XZC\",\"name\":\"zcoin\",\"rpcport\":8888,\"pubtype\":82,\"p2shtype\":7,\"wiftype\":210,\"txfee\":10000}, {\"coin\":\"QTUM\",\"name\":\"qtum\",\"rpcport\":3889,\"pubtype\":58,\"p2shtype\":50,\"wiftype\":128,\"txfee\":400000}, {\"coin\":\"PURA\",\"name\":\"pura\",\"rpcport\":55555,\"pubtype\":55,\"p2shtype\":16,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"DSR\",\"name\":\"desire\",\"confpath\":\"${HOME#}/.desirecore/desire.conf\",\"rpcport\":9918,\"pubtype\":30,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"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\":\"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\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"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\":\"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\":10000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"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\":100000}, {\"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\":10000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":10000}, {\"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\":\"MSHARK\",\"asset\":\"MSHARK\",\"rpcport\":8846}, {\"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 64affa509823c4aac257c71c45020582124cc25c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 12:06:06 +0200 Subject: [PATCH 12/33] 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 9b9372cf9..a313a3791 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -965,9 +965,9 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru p = (double)qp->destsatoshis / (qp->satoshis - qp->txfee); if ( LP_trades_pricevalidate(qp,coin,p) < 0. ) return(0); - if ( p >= qprice ) + if ( qprice >= p ) break; - price /= 0.99; + price *= 0.995; i++; } printf("i.%d qprice %.8f myprice %.8f price %.8f [%.8f]\n",i,qprice,myprice,price,p); From a86de6d5ebde1ee2b797f779d0da5e8249bf25fc Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 12:06:51 +0200 Subject: [PATCH 13/33] 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 d11343045..c1615f846 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -663,7 +663,7 @@ void LP_coinsloop(void *_coins) if ( coin->lastscanht == coin->longestchain+1 || strcmp("BTC",coins) == 0 ) break; } - //if ( strcmp("BTC",coins) == 0 ) + if ( strcmp("BTC",coins) == 0 ) printf("done [%s]: %s ref.%d scan.%d to %d, longest.%d\n",coins,coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); } } From da49d43d499d8eae132a763b085aa6a1063bc99d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 12:19:48 +0200 Subject: [PATCH 14/33] Reset iterations to price if threes dominate --- iguana/exchanges/LP_ordermatch.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a313a3791..6ca66b1bd 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -965,9 +965,17 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru p = (double)qp->destsatoshis / (qp->satoshis - qp->txfee); if ( LP_trades_pricevalidate(qp,coin,p) < 0. ) return(0); - if ( qprice >= p ) - break; - price *= 0.995; + if ( i == 0 && p < myprice ) + { + price = qprice; + printf("reset price <- qprice %.8f\n",qprice); + } + else + { + if ( qprice >= p ) + break; + price *= 0.995; + } i++; } printf("i.%d qprice %.8f myprice %.8f price %.8f [%.8f]\n",i,qprice,myprice,price,p); From 007489f4aaacd3f40576916e5beb1cd6989b29ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 14:59:22 +0200 Subject: [PATCH 15/33] BTCP support --- iguana/exchanges/LP_bitcoin.c | 8 ++++++-- iguana/exchanges/LP_swap.c | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 29d8d90d6..10ec14d12 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -3391,7 +3391,7 @@ int32_t iguana_rwmsgtx(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2shty bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,uint8_t *serialized,int32_t maxlen,struct iguana_msgtx *msgtx,int32_t vini,uint8_t *spendscript,int32_t spendlen,uint64_t spendamount,uint32_t hashtype,char *vpnstr,int32_t suppress_pubkeys,int32_t zcash) { - int32_t i,len,sbtcflag = 0; bits256 sigtxid,txid,revsigtxid; struct iguana_msgtx dest; + int32_t i,len,sbtcflag = 0,btcpflag=0; bits256 sigtxid,txid,revsigtxid; struct iguana_msgtx dest; dest = *msgtx; dest.vins = calloc(dest.tx_in,sizeof(*dest.vins)); dest.vouts = calloc(dest.tx_out,sizeof(*dest.vouts)); @@ -3400,6 +3400,8 @@ bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2sht memset(sigtxid.bytes,0,sizeof(sigtxid)); if ( strcmp(symbol,"SBTC") == 0 ) sbtcflag = 1; + else if ( strcmp(symbol,"BTCP") == 0 ) + btcpflag = 1; if ( ((hashtype & ~SIGHASH_FORKID) & 0xff) != SIGHASH_ALL ) { printf("currently only SIGHASH_ALL supported, not %d\n",hashtype); @@ -3434,6 +3436,8 @@ bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2sht if ( height >= BTC2_HARDFORK_HEIGHT ) hashtype |= (0x777 << 20); #endif + if ( btcpflag != 0 ) + hashtype = 0x2a41; len += iguana_rwnum(1,&serialized[len],sizeof(hashtype),&hashtype); if ( sbtcflag != 0 ) { @@ -3610,7 +3614,7 @@ uint32_t LP_sighash(char *symbol,int32_t zcash) sighash |= SIGHASH_FORKID; sighash |= (LP_IS_BITCOINGOLD << 8); } - else if ( strcmp(symbol,"SBTC") == 0 ) + else if ( strcmp(symbol,"SBTC") == 0 || strcmp(symbol,"BTCP") == 0 ) sighash |= SIGHASH_FORKID; return(sighash); } diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index ad2e9be0d..bcecd5232 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -969,10 +969,6 @@ void LP_aliceloop(void *_swap) printf("error waiting for bobpayment\n"); else { - if ( swap->I.alicetomic[0] != 0 ) - { - // artem: do stuff alice needs to do after bobpayment comes in - } LP_swap_endcritical = (uint32_t)time(NULL); while ( (n= LP_numconfirms(bobstr,swap->bobpayment.I.destaddr,swap->bobpayment.I.signedtxid,0,1)) < swap->I.bobconfirms ) { From 5efa94623e203aebb630a919fddc16814b1bbe90 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 15:23:29 +0200 Subject: [PATCH 16/33] SPV to detect spent unconfirmed --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_scan.c | 6 +++--- iguana/exchanges/LP_transaction.c | 18 ++++++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 9f32ee47b..b4e4ee24e 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -559,7 +559,7 @@ char *LP_unspents_filestr(char *symbol,char *addr); cJSON *bitcoin_data2json(char *symbol,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 zcash); //int32_t LP_butxo_findeither(bits256 txid,int32_t vout); cJSON *LP_listunspent(char *symbol,char *coinaddr,bits256 reftxid,bits256 reftxid2); -int32_t LP_gettx_presence(char *symbol,bits256 expectedtxid); +int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxid,char *coinaddr); double LP_getestimatedrate(struct iguana_info *coin); 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); diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index a70a1bb44..2e0c4d009 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -448,7 +448,7 @@ int32_t LP_mempoolscan(char *symbol,bits256 searchtxid) int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int32_t duration) { - struct iguana_info *coin; bits256 zero; cJSON *array,*item; uint32_t expiration,i,n; int32_t numconfirms = -1; + struct iguana_info *coin; bits256 zero; cJSON *array,*item; uint32_t expiration,i,n; int32_t num,numconfirms = -1; if ( (coin= LP_coinfind(symbol)) == 0 || coin->inactive != 0 ) { printf("LP_waitmempool missing coin.%p or inactive\n",coin); @@ -457,8 +457,8 @@ int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int expiration = (uint32_t)time(NULL) + duration; while ( LP_STOP_RECEIVED == 0 ) { - if ( LP_gettx_presence(symbol,txid) != 0 ) - numconfirms = 0; + if ( LP_gettx_presence(&num,symbol,txid,coinaddr) != 0 ) + numconfirms = num; else { if ( coin->electrum == 0 ) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index eb4e5d8c2..9ed38905e 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -60,15 +60,25 @@ bits256 LP_pubkey(bits256 privkey) return(pubkey); } -int32_t LP_gettx_presence(char *symbol,bits256 expectedtxid) +int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxid,char *coinaddr) { - cJSON *txobj; bits256 txid; int32_t flag = 0; + cJSON *txobj,*retjson; bits256 txid; struct iguana_info *coin; int32_t flag = 0; + if ( numconfirmsp != 0 ) + *numconfirmsp = -1; if ( (txobj= LP_gettx(symbol,expectedtxid,0)) != 0 ) { txid = jbits256(txobj,"txid"); if ( jobj(txobj,"error") == 0 && bits256_cmp(txid,expectedtxid) == 0 ) { - //char str[65]; printf("%s already in gettx (%s)\n",bits256_str(str,txid),jprint(txobj,0)); + if ( numconfirmsp != 0 && coinaddr != 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) + { + char str[65]; printf("%s %s already in gettx (%s)\n",coinaddr,bits256_str(str,txid),jprint(txobj,0)); + if ( (retjson= electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,expectedtxid)) != 0 ) + { + printf("got history\n"); + free_json(retjson); + } + } flag = 1; } free_json(txobj); @@ -94,7 +104,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); - if ( sentflag == 0 && LP_gettx_presence(symbol,expectedtxid) != 0 ) + if ( sentflag == 0 && LP_gettx_presence(0,symbol,expectedtxid,0) != 0 ) sentflag = 1; if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes)) != 0 ) { From 90794db3413782b69f3acec8d4fde5179f4c37c3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 15:24:05 +0200 Subject: [PATCH 17/33] 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 9ed38905e..2c3de6406 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -72,6 +72,7 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi { if ( numconfirmsp != 0 && coinaddr != 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) { + *numconfirmsp = 0; char str[65]; printf("%s %s already in gettx (%s)\n",coinaddr,bits256_str(str,txid),jprint(txobj,0)); if ( (retjson= electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,expectedtxid)) != 0 ) { From 09187b1f93119816ee6633823c14d663feb9af14 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 15:34:10 +0200 Subject: [PATCH 18/33] 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 28b340167..e8c165601 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -182,7 +182,7 @@ cJSON *LP_paxprice(char *fiat) cJSON *LP_gettx(char *symbol,bits256 txid,int32_t suppress_errors) { struct iguana_info *coin; char buf[512],str[65]; int32_t height; cJSON *retjson; - //printf("LP_gettx %s %s\n",symbol,bits256_str(str,txid)); + printf("LP_gettx %s %s\n",symbol,bits256_str(str,txid)); if ( symbol == 0 || symbol[0] == 0 ) return(cJSON_Parse("{\"error\":\"null symbol\"}")); coin = LP_coinfind(symbol); From 850a2d588bd3d59538468495577a86570edb66fc Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 15:48:30 +0200 Subject: [PATCH 19/33] Test --- iguana/exchanges/LP_commands.c | 2 +- iguana/exchanges/LP_instantdex.c | 6 +++--- iguana/exchanges/LP_remember.c | 4 ++-- iguana/exchanges/LP_rpc.c | 10 +++++----- iguana/exchanges/LP_transaction.c | 10 +++++----- iguana/exchanges/LP_utxo.c | 8 ++++---- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index be3c73466..b88a92ef8 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -523,7 +523,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } else if ( strcmp(method,"getrawtransaction") == 0 ) { - return(jprint(LP_gettx(coin,jbits256(argjson,"txid"),0),1)); + return(jprint(LP_gettx("stats_JSON",coin,jbits256(argjson,"txid"),0),1)); } else if ( strcmp(method,"withdraw") == 0 ) { diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 247d158e4..a20244cf5 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -306,7 +306,7 @@ char *LP_unlockedspend(void *ctx,char *symbol,bits256 utxotxid) retjson = cJSON_CreateObject(); utxovout = 0; memset(&sendtxid,0,sizeof(sendtxid)); - if ( (txjson= LP_gettx(coin->symbol,utxotxid,1)) != 0 ) + if ( (txjson= LP_gettx("LP_unlockedspend",coin->symbol,utxotxid,1)) != 0 ) { if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && numvouts >= 2 ) { @@ -397,7 +397,7 @@ char *LP_timelock(char *symbol,uint32_t duration,char *destaddr,uint64_t satoshi int32_t LP_claim_submit(void *ctx,cJSON *txids,int64_t *sump,struct iguana_info *coin,bits256 utxotxid) { uint8_t redeemscript[512]; bits256 claimtxid; cJSON *txjson,*vout0,*vout1,*vout2,*vouts,*item; int32_t numvouts; char str[65],vinaddr[64],destaddr[64],checkaddr[64]; int32_t j,utxovout,flagi = 0,redeemlen,weeki,iter; int64_t weeksatoshis,satoshis; uint32_t expiration,claimtime; - if ( (txjson= LP_gettx(coin->symbol,utxotxid,1)) != 0 ) + if ( (txjson= LP_gettx("LP_claim_submit",coin->symbol,utxotxid,1)) != 0 ) { if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && numvouts >= 3 ) { @@ -515,7 +515,7 @@ int64_t LP_instantdex_credit(int32_t dispflag,char *coinaddr,int64_t satoshis,in int64_t LP_instantdex_creditcalc(struct iguana_info *coin,int32_t dispflag,bits256 txid,char *refaddr,char *origcoinaddr) { cJSON *txjson,*vouts,*txobj,*item; int64_t satoshis=0,amount64; int32_t weeki,numvouts; char destaddr[64],p2shaddr[64]; - if ( (txjson= LP_gettx(coin->symbol,txid,0)) != 0 ) + if ( (txjson= LP_gettx("LP_instantdex_creditcalc",coin->symbol,txid,0)) != 0 ) { // vout0 deposit, vout1 botsfee, vout2 smartaddress if ( (vouts= jarray(&numvouts,txjson,"vout")) > 0 && numvouts >= 3 && LP_destaddr(destaddr,jitem(vouts,2)) == 0 ) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index 25bc3ace8..644a82017 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -290,7 +290,7 @@ bits256 basilisk_swap_spendupdate(int32_t iambob,char *symbol,char *spentaddr,in printf("i.%d of %d: %s\n",i,n,bits256_str(str,txid)); if ( bits256_cmp(txid,txids[utxoind]) != 0 ) { - if ( (txobj= LP_gettx(symbol,txid,1)) != 0 ) + if ( (txobj= LP_gettx("basilisk_swap_spendupdate",symbol,txid,1)) != 0 ) { if ( (vins= jarray(&numvins,txobj,"vin")) != 0 ) { @@ -934,7 +934,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap,int32_t forceflag) safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin)); if ( rswap->finishedflag == 0 ) { - if ( (sentobj= LP_gettx(symbol,txid,1)) == 0 ) + if ( (sentobj= LP_gettx("LP_remember",symbol,txid,1)) == 0 ) { //char str2[65]; printf("%s %s ready to broadcast %s r%u q%u\n",symbol,bits256_str(str2,txid),txnames[i],rswap->requestid,rswap->quoteid); } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index e8c165601..b5b354765 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -179,10 +179,10 @@ cJSON *LP_paxprice(char *fiat) return(bitcoin_json(coin,"paxprice",buf)); } -cJSON *LP_gettx(char *symbol,bits256 txid,int32_t suppress_errors) +cJSON *LP_gettx(char *debug,char *symbol,bits256 txid,int32_t suppress_errors) { struct iguana_info *coin; char buf[512],str[65]; int32_t height; cJSON *retjson; - printf("LP_gettx %s %s\n",symbol,bits256_str(str,txid)); + printf("%s LP_gettx %s %s\n",debug,symbol,bits256_str(str,txid)); if ( symbol == 0 || symbol[0] == 0 ) return(cJSON_Parse("{\"error\":\"null symbol\"}")); coin = LP_coinfind(symbol); @@ -209,7 +209,7 @@ cJSON *LP_gettx(char *symbol,bits256 txid,int32_t suppress_errors) uint32_t LP_locktime(char *symbol,bits256 txid) { cJSON *txobj; uint32_t locktime = 0; - if ( (txobj= LP_gettx(symbol,txid,0)) != 0 ) + if ( (txobj= LP_gettx("LP_locktime",symbol,txid,0)) != 0 ) { locktime = juint(txobj,"locktime"); free_json(txobj); @@ -1055,7 +1055,7 @@ int32_t LP_txhasnotarization(bits256 *notarizedhashp,struct iguana_info *coin,bi { cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[1024]; bits256 spenttxid; uint64_t notarymask; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0; memset(notarizedhashp,0,sizeof(*notarizedhashp)); - if ( (txobj= LP_gettx(coin->symbol,txid,0)) != 0 ) + if ( (txobj= LP_gettx("LP_txhasnotarization",coin->symbol,txid,0)) != 0 ) { if ( (vins= jarray(&numvins,txobj,"vin")) != 0 ) { @@ -1067,7 +1067,7 @@ int32_t LP_txhasnotarization(bits256 *notarizedhashp,struct iguana_info *coin,bi vin = jitem(vins,i); spenttxid = jbits256(vin,"txid"); spentvout = jint(vin,"vout"); - if ( (spentobj= LP_gettx(coin->symbol,spenttxid,0)) != 0 ) + if ( (spentobj= LP_gettx("LP_txhasnotarization",coin->symbol,spenttxid,0)) != 0 ) { if ( (vouts= jarray(&numvouts,spentobj,"vout")) != 0 ) { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 2c3de6406..4cd4af3ed 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -65,7 +65,7 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi cJSON *txobj,*retjson; bits256 txid; struct iguana_info *coin; int32_t flag = 0; if ( numconfirmsp != 0 ) *numconfirmsp = -1; - if ( (txobj= LP_gettx(symbol,expectedtxid,0)) != 0 ) + if ( (txobj= LP_gettx("LP_gettx_presence",symbol,expectedtxid,0)) != 0 ) { txid = jbits256(txobj,"txid"); if ( jobj(txobj,"error") == 0 && bits256_cmp(txid,expectedtxid) == 0 ) @@ -775,7 +775,7 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch if ( txfee > 0 && txfee < coin->txfee ) txfee = coin->txfee; #ifndef BASILISK_DISABLESENDTX - if ( (txobj= LP_gettx(symbol,utxotxid,0)) != 0 ) + if ( (txobj= LP_gettx("basilisk_swap_bobtxspend",symbol,utxotxid,0)) != 0 ) { if ( (vouts= jarray(&n,txobj,"vout")) != 0 && utxovout < n ) { @@ -1626,7 +1626,7 @@ int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vou { cJSON *retjson; coinaddr[0] = 0; - if ( (retjson= LP_gettx(symbol,txid,0)) != 0 ) + if ( (retjson= LP_gettx("LP_swap_getcoinaddr",symbol,txid,0)) != 0 ) { LP_txdestaddr(coinaddr,txid,vout,retjson); free_json(retjson); @@ -1638,7 +1638,7 @@ int32_t basilisk_swap_getsigscript(char *symbol,uint8_t *script,int32_t maxlen,b { cJSON *retjson,*vins,*item,*skey; int32_t n,scriptlen = 0; char *hexstr; //char str[65]; printf("getsigscript %s %s/v%d\n",symbol,bits256_str(str,txid),vini); - if ( bits256_nonz(txid) != 0 && (retjson= LP_gettx(symbol,txid,0)) != 0 ) + if ( bits256_nonz(txid) != 0 && (retjson= LP_gettx("basilisk_swap_getsigscript",symbol,txid,0)) != 0 ) { //printf("gettx.(%s)\n",jprint(retjson,0)); if ( (vins= jarray(&n,retjson,"vin")) != 0 && vini < n ) @@ -1731,7 +1731,7 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t u for (i=0; iinactive != 0 ) return(0); - if ( txobj != 0 || (txobj= LP_gettx(coin->symbol,txid,0)) != 0 ) + if ( txobj != 0 || (txobj= LP_gettx("LP_transactioninit",coin->symbol,txid,0)) != 0 ) { if ( coin->electrum == 0 ) height = LP_txheight(coin,txid); @@ -873,7 +873,7 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) return(-1); if ( coin->electrum == 0 ) { - if ( (txobj= LP_gettx(coin->symbol,txid,0)) != 0 ) + if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,0)) != 0 ) { //*timestampp = juint(txobj,"locktime"); //*blocktimep = juint(txobj,"blocktime"); @@ -923,7 +923,7 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int } else if ( mempool != 0 && LP_mempoolscan(symbol,txid) >= 0 ) numconfirms = 0; - else if ( (txobj= LP_gettx(symbol,txid,1)) != 0 ) + else if ( (txobj= LP_gettx("LP_numconfirms",symbol,txid,1)) != 0 ) { numconfirms = jint(txobj,"confirmations"); free_json(txobj); @@ -1052,7 +1052,7 @@ int64_t LP_outpoint_amount(char *symbol,bits256 txid,int32_t vout) return(amount); else { - if ( (txjson= LP_gettx(symbol,txid,1)) != 0 ) + if ( (txjson= LP_gettx("LP_outpoint_amount",symbol,txid,1)) != 0 ) { if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && vout < numvouts ) amount = LP_value_extract(jitem(vouts,vout),0); From 6db2628e25919f8fc10bfa0f0c9a1cee07d04349 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 16:01:08 +0200 Subject: [PATCH 20/33] Test --- iguana/exchanges/LP_utxo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 85ba715ab..8626806b9 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -871,6 +871,10 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) bits256 blockhash; struct LP_transaction *tx; cJSON *blockobj,*retjson,*txobj; int32_t height = 0; if ( coin == 0 ) return(-1); + if ( (tx= LP_transactionfind(coin,txid)) != 0 ) + height = tx->height; + if ( height > 0 ) + return(height); if ( coin->electrum == 0 ) { if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,0)) != 0 ) @@ -881,6 +885,8 @@ 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"); + if ( tx != 0 ) + tx->height = 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); @@ -891,8 +897,6 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) } else { - if ( (tx= LP_transactionfind(coin,txid)) != 0 ) - height = tx->height; if ( height == 0 ) { if ( (retjson= electrum_transaction(&height,coin->symbol,coin->electrum,&retjson,txid,0)) != 0 ) From c37f497e31e118217f58425b89ef37a91b6a4b9a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 16:08:30 +0200 Subject: [PATCH 21/33] Test --- iguana/exchanges/LP_rpc.c | 2 +- iguana/exchanges/LP_utxo.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index b5b354765..9ab5faadc 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -182,7 +182,7 @@ cJSON *LP_paxprice(char *fiat) cJSON *LP_gettx(char *debug,char *symbol,bits256 txid,int32_t suppress_errors) { struct iguana_info *coin; char buf[512],str[65]; int32_t height; cJSON *retjson; - printf("%s LP_gettx %s %s\n",debug,symbol,bits256_str(str,txid)); + //printf("%s LP_gettx %s %s\n",debug,symbol,bits256_str(str,txid)); if ( symbol == 0 || symbol[0] == 0 ) return(cJSON_Parse("{\"error\":\"null symbol\"}")); coin = LP_coinfind(symbol); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 8626806b9..2c5ede800 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -868,7 +868,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS int32_t LP_txheight(struct iguana_info *coin,bits256 txid) { - bits256 blockhash; struct LP_transaction *tx; cJSON *blockobj,*retjson,*txobj; int32_t height = 0; + bits256 blockhash; struct LP_transaction *tx; cJSON *blockobj,*retjson,*txobj,*txobj2; int32_t height = 0; if ( coin == 0 ) return(-1); if ( (tx= LP_transactionfind(coin,txid)) != 0 ) @@ -887,6 +887,15 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) height = jint(blockobj,"height"); if ( tx != 0 ) tx->height = height; + else + { + txobj2 = LP_transactioninit(coin,txid,0,0); + txobj2 = LP_transactioninit(coin,txid,1,txobj2); + if ( txobj2 != 0 ) + free_json(txobj2); + if ( (tx= LP_transactionfind(coin,txid)) != 0 ) + tx->height = 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); From 31d6f0623f14ab1706c0b720aa062e5b6b3117aa Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 16:12:52 +0200 Subject: [PATCH 22/33] 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 2c5ede800..4d4d64433 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -887,7 +887,7 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) height = jint(blockobj,"height"); if ( tx != 0 ) tx->height = height; - else + else if ( 0 ) { txobj2 = LP_transactioninit(coin,txid,0,0); txobj2 = LP_transactioninit(coin,txid,1,txobj2); From 474be94ded0ce78ee1742f9a532e20b2b5921d86 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 16:37:19 +0200 Subject: [PATCH 23/33] Test --- iguana/exchanges/LP_transaction.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 4cd4af3ed..e3fefc476 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -62,7 +62,7 @@ bits256 LP_pubkey(bits256 privkey) int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxid,char *coinaddr) { - cJSON *txobj,*retjson; bits256 txid; struct iguana_info *coin; int32_t flag = 0; + cJSON *txobj,*retjson,*item; bits256 txid; struct iguana_info *coin; int32_t height=-1,i,n,flag = 0; if ( numconfirmsp != 0 ) *numconfirmsp = -1; if ( (txobj= LP_gettx("LP_gettx_presence",symbol,expectedtxid,0)) != 0 ) @@ -76,8 +76,23 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi char str[65]; printf("%s %s already in gettx (%s)\n",coinaddr,bits256_str(str,txid),jprint(txobj,0)); if ( (retjson= electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,expectedtxid)) != 0 ) { - printf("got history\n"); + if ( (n= cJSON_GetArraySize(retjson)) > 0 ) + { + for (i=0; iheight ) + *numconfirmsp = (coin->height - height + 1); + break; + } + } + } free_json(retjson); + printf("got %s history height.%d vs coin.%d -> numconfirms.%d\n",coin->symbol,height,coin->height,*numconfirmsp); } } flag = 1; From ab9bd01a2de187d24e5bbb61caf4e941a0e42a47 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 17:18:03 +0200 Subject: [PATCH 24/33] Convaddress --- iguana/exchanges/LP_commands.c | 5 +++++ iguana/exchanges/LP_privkey.c | 37 ++++++++++++++++++++++++++++++++++ iguana/exchanges/convaddress | 3 +++ iguana/exchanges/mm.c | 20 +++--------------- 4 files changed, 48 insertions(+), 17 deletions(-) create mode 100755 iguana/exchanges/convaddress diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index b88a92ef8..b9091e29d 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -161,6 +161,7 @@ bot_status(botid)\n\ bot_stop(botid)\n\ bot_pause(botid)\n\ calcaddress(passphrase)\n\ +convaddress(coin, address, destcoin)\n\ instantdex_deposit(weeks, amount, broadcast=1)\n\ instantdex_claim()\n\ timelock(coin, duration, destaddr=(tradeaddr), amount)\n\ @@ -513,6 +514,10 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ { return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx"))); } + else if ( strcmp(method,"convaddress") == 0 ) + { + return(LP_convaddress(coin,jstr(argjson,"address"),jstr(argjson,"destcoin"))); + } else if ( strcmp(method,"timelock") == 0 ) { return(LP_timelock(coin,juint(argjson,"duration"),jstr(argjson,"destaddr"),jdouble(argjson,"amount")*SATOSHIDEN)); diff --git a/iguana/exchanges/LP_privkey.c b/iguana/exchanges/LP_privkey.c index f8ec16e37..d483b1093 100644 --- a/iguana/exchanges/LP_privkey.c +++ b/iguana/exchanges/LP_privkey.c @@ -251,6 +251,43 @@ int32_t LP_wifstr_valid(char *symbol,char *wifstr) return(0); } +char *LP_convaddress(char *symbol,char *address,char *dest) +{ + struct iguana_info *coin,*destcoin; cJSON *retjson; char destaddress[64],coinaddr2[64]; uint8_t addrtype,rmd160[20],rmd160b[20]; + if ( (coin= LP_coinfind(symbol)) == 0 || (destcoin= LP_coinfind(dest)) == 0 ) + return(clonestr("{\"error\":\"both coins must be present\"}")); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"coin",symbol); + jaddstr(retjson,"address",address); + jaddstr(retjson,"destcoin",dest); + bitcoin_addr2rmd160(symbol,coin->taddr,&addrtype,rmd160,address); + if ( addrtype == coin->pubtype ) + { + bitcoin_address(destcoin->symbol,destaddress,destcoin->taddr,destcoin->pubtype,rmd160,20); + bitcoin_addr2rmd160(destcoin->symbol,destcoin->taddr,&addrtype,rmd160b,destaddress); + bitcoin_address(coin->symbol,coinaddr2,coin->taddr,coin->pubtype,rmd160b,20); + } + else if ( addrtype == coin->p2shtype ) + { + bitcoin_address(destcoin->symbol,destaddress,destcoin->taddr,destcoin->p2shtype,rmd160,20); + bitcoin_addr2rmd160(symbol,coin->taddr,&addrtype,rmd160b,destaddress); + bitcoin_address(destcoin->symbol,coinaddr2,coin->taddr,coin->p2shtype,rmd160b,20); + } + else + { + jaddstr(retjson,"error","invalid base58 prefix"); + jaddnum(retjson,"invalid",addrtype); + } + if ( strcmp(address,coinaddr2) != 0 ) + { + jaddstr(retjson,"error","checkaddress mismatch"); + jaddstr(retjson,"checkaddress",coinaddr2); + } + jaddstr(retjson,"destaddress",destaddress); + return(jprint(retjson,1)); +} + bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguana_info *coin,char *passphrase,char *wifstr) { //static uint32_t counter; diff --git a/iguana/exchanges/convaddress b/iguana/exchanges/convaddress new file mode 100755 index 000000000..fc2d1da2c --- /dev/null +++ b/iguana/exchanges/convaddress @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"convaddress\",\"coin\":\"BTC\",\"address\":\"1KPctPk4Zs4Qbe1x32A5bC1roAnmpvi9Fy\",\"destcoin\":\"KMD\"}" diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index 04d848599..c78aa0864 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -161,7 +161,7 @@ int main(int argc, const char * argv[]) OS_init(); if ( strstr(argv[0],"btc2kmd") != 0 && argv[1] != 0 ) { - bits256 privkey,checkkey; uint8_t addrtype,tmptype,rmd160[20],rmd160b[20]; char coinaddr[64],coinaddr2[64],kmdwif[64],str[65],str2[65]; + bits256 privkey,checkkey; uint8_t tmptype; char kmdwif[64],str[65],str2[65],*retstr; if ( LP_wifstr_valid("BTC",(char *)argv[1]) > 0 ) { bitcoin_wif2priv("BTC",0,&tmptype,&privkey,(char *)argv[1]); @@ -173,22 +173,8 @@ int main(int argc, const char * argv[]) } else { - bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160,(char *)argv[1]); - if ( addrtype == 0 ) - { - bitcoin_address("KMD",coinaddr,0,60,rmd160,20); - bitcoin_addr2rmd160("KMD",0,&addrtype,rmd160b,coinaddr); - bitcoin_address("BTC",coinaddr2,0,0,rmd160b,20); - } - else if ( addrtype == 60 ) - { - bitcoin_address("BTC",coinaddr,0,0,rmd160,20); - bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160b,coinaddr); - bitcoin_address("KMD",coinaddr2,0,60,rmd160b,20); - } - printf("(%s) -> %s -> %s\n",(char *)argv[1],coinaddr,coinaddr2); - if ( strcmp((char *)argv[1],coinaddr2) != 0 ) - printf("ERROR\n"); + if ( (retstr= LP_convaddress("BTC",(char *)argv[1],"KMD")) != 0 ) + printf("%s\n",retstr); } exit(0); } From 0149ef06728de6ad77ab0a7bd24d744b1e8b4a18 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 17:23:16 +0200 Subject: [PATCH 25/33] -prints --- iguana/exchanges/LP_transaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index e3fefc476..11ba55eef 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -73,7 +73,7 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi if ( numconfirmsp != 0 && coinaddr != 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) { *numconfirmsp = 0; - char str[65]; printf("%s %s already in gettx (%s)\n",coinaddr,bits256_str(str,txid),jprint(txobj,0)); + //char str[65]; printf("%s %s already in gettx (%s)\n",coinaddr,bits256_str(str,txid),jprint(txobj,0)); if ( (retjson= electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,expectedtxid)) != 0 ) { if ( (n= cJSON_GetArraySize(retjson)) > 0 ) @@ -84,7 +84,7 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi if ( bits256_cmp(txid,jbits256(item,"tx_hash")) == 0 ) { height = jint(item,"height"); - printf("found txid at height.%d\n",height); + //printf("found txid at height.%d\n",height); if ( height <= coin->height ) *numconfirmsp = (coin->height - height + 1); break; @@ -92,7 +92,7 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi } } free_json(retjson); - printf("got %s history height.%d vs coin.%d -> numconfirms.%d\n",coin->symbol,height,coin->height,*numconfirmsp); + //printf("got %s history height.%d vs coin.%d -> numconfirms.%d\n",coin->symbol,height,coin->height,*numconfirmsp); } } flag = 1; From a9639be0319bcd509ddaf7b95eaf3875e33aed6e Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 17:39:35 +0200 Subject: [PATCH 26/33] Test --- iguana/exchanges/LP_swap.c | 4 ++-- iguana/exchanges/LP_utxo.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index bcecd5232..999de158c 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -1204,9 +1204,9 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.aliceconfirms = BASILISK_DEFAULT_NUMCONFIRMS; } if ( bobcoin->isassetchain != 0 ) - swap->I.bobconfirms = 1; + swap->I.bobconfirms = BASILISK_DEFAULT_MAXCONFIRMS; if ( alicecoin->isassetchain != 0 ) - swap->I.aliceconfirms = 1; + swap->I.aliceconfirms = BASILISK_DEFAULT_MAXCONFIRMS; if ( bobcoin->userconfirms > 0 ) swap->I.bobconfirms = bobcoin->userconfirms; if ( alicecoin->userconfirms > 0 ) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 4d4d64433..d86254f3b 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -954,6 +954,18 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int numconfirms = 0; } } + if ( numconfirms == BASILISK_DEFAULT_MAXCONFIRMS ) + { + if ( coin->isassetchain != 0 || strcmp(coin->symbol,"KMD") == 0 ) + { + numconfirms--; + if ( coin->notarized >= coin->height-numconfirms ) + { + printf("%s notarized.%d current ht.%d - numconfirms.%d -> txheight.%d\n",coin->symbol,coin->notarized,coin->height,numconfirms,coin->height - numconfirms); + numconfirms = BASILISK_DEFAULT_MAXCONFIRMS; + } + } + } return(numconfirms); } From ecd0f69d2fbf9ea7442380daf1eb0b0a16e8bff0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 17:50:08 +0200 Subject: [PATCH 27/33] Test --- iguana/exchanges/LP_coins.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 4a565e9aa..d37152137 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -376,7 +376,8 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse if ( assetname != 0 && strcmp(name,assetname) == 0 ) { //printf("%s is assetchain\n",symbol); - coin->isassetchain = 1; + if ( strcmp(name,"BEER") != 0 && strcmp("PIZZA",name) != 0 ) + coin->isassetchain = 1; } if ( strcmp(symbol,"KMD") == 0 || (assetname != 0 && assetname[0] != 0) ) name2 = 0; From d0f4d792a312ea7537f0ed913ec138adf5a906c7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 18:16:55 +0200 Subject: [PATCH 28/33] Notarized assetchain numconfs --- iguana/exchanges/LP_swap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 999de158c..01811acdc 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -1203,10 +1203,6 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.bobconfirms = BASILISK_DEFAULT_NUMCONFIRMS; swap->I.aliceconfirms = BASILISK_DEFAULT_NUMCONFIRMS; } - if ( bobcoin->isassetchain != 0 ) - swap->I.bobconfirms = BASILISK_DEFAULT_MAXCONFIRMS; - if ( alicecoin->isassetchain != 0 ) - swap->I.aliceconfirms = BASILISK_DEFAULT_MAXCONFIRMS; if ( bobcoin->userconfirms > 0 ) swap->I.bobconfirms = bobcoin->userconfirms; if ( alicecoin->userconfirms > 0 ) @@ -1219,6 +1215,10 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.bobconfirms = swap->I.bobmaxconfirms; if ( swap->I.aliceconfirms > swap->I.alicemaxconfirms ) swap->I.aliceconfirms = swap->I.alicemaxconfirms; + if ( bobcoin->isassetchain != 0 ) + swap->I.bobconfirms = BASILISK_DEFAULT_MAXCONFIRMS; + if ( alicecoin->isassetchain != 0 ) + swap->I.aliceconfirms = BASILISK_DEFAULT_MAXCONFIRMS; if ( strcmp("BAY",swap->I.req.src) != 0 && strcmp("BAY",swap->I.req.dest) != 0 ) { swap->I.bobconfirms *= !swap->I.bobistrusted; From e7aefe7fddc99058305c3e7765e21e741048835a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 18:41:29 +0200 Subject: [PATCH 29/33] Test --- iguana/exchanges/LP_swap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 01811acdc..acd6338d3 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -1224,6 +1224,10 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.bobconfirms *= !swap->I.bobistrusted; swap->I.aliceconfirms *= !swap->I.aliceistrusted; } +if ( bobcoin->isassetchain != 0 ) + swap->I.bobconfirms = BASILISK_DEFAULT_MAXCONFIRMS; +if ( alicecoin->isassetchain != 0 ) + swap->I.aliceconfirms = BASILISK_DEFAULT_MAXCONFIRMS; printf(">>>>>>>>>> jumblrflag.%d <<<<<<<<< r.%u q.%u, %.8f bobconfs.%d, %.8f aliceconfs.%d taddr.%d %d\n",jumblrflag,swap->I.req.requestid,swap->I.req.quoteid,dstr(swap->I.bobsatoshis),swap->I.bobconfirms,dstr(swap->I.alicesatoshis),swap->I.aliceconfirms,bobcoin->taddr,alicecoin->taddr); printf("etomic src (%s %s) dest (%s %s)\n",swap->I.bobtomic,swap->I.etomicsrc,swap->I.alicetomic,swap->I.etomicdest); if ( swap->I.iambob != 0 ) From 3339702116757db9fc98009479b06f18a41aa430 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 19:15:12 +0200 Subject: [PATCH 30/33] Test --- iguana/exchanges/LP_swap.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index acd6338d3..01811acdc 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -1224,10 +1224,6 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256 swap->I.bobconfirms *= !swap->I.bobistrusted; swap->I.aliceconfirms *= !swap->I.aliceistrusted; } -if ( bobcoin->isassetchain != 0 ) - swap->I.bobconfirms = BASILISK_DEFAULT_MAXCONFIRMS; -if ( alicecoin->isassetchain != 0 ) - swap->I.aliceconfirms = BASILISK_DEFAULT_MAXCONFIRMS; printf(">>>>>>>>>> jumblrflag.%d <<<<<<<<< r.%u q.%u, %.8f bobconfs.%d, %.8f aliceconfs.%d taddr.%d %d\n",jumblrflag,swap->I.req.requestid,swap->I.req.quoteid,dstr(swap->I.bobsatoshis),swap->I.bobconfirms,dstr(swap->I.alicesatoshis),swap->I.aliceconfirms,bobcoin->taddr,alicecoin->taddr); printf("etomic src (%s %s) dest (%s %s)\n",swap->I.bobtomic,swap->I.etomicsrc,swap->I.alicetomic,swap->I.etomicdest); if ( swap->I.iambob != 0 ) From 86f985a1f929b84f3faf3b41b7b2f3e29bdee1ed Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 19:33:35 +0200 Subject: [PATCH 31/33] Test --- iguana/exchanges/LP_utxo.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index d86254f3b..ab70469e6 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -868,13 +868,13 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS int32_t LP_txheight(struct iguana_info *coin,bits256 txid) { - bits256 blockhash; struct LP_transaction *tx; cJSON *blockobj,*retjson,*txobj,*txobj2; int32_t height = 0; + bits256 blockhash; struct LP_transaction *tx=0; cJSON *blockobj,*retjson,*txobj,*txobj2; int32_t height = 0; if ( coin == 0 ) return(-1); - if ( (tx= LP_transactionfind(coin,txid)) != 0 ) + /*if ( (tx= LP_transactionfind(coin,txid)) != 0 ) height = tx->height; - if ( height > 0 ) - return(height); + if ( height > 1 ) + return(height);*/ if ( coin->electrum == 0 ) { if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,0)) != 0 ) @@ -906,6 +906,8 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) } else { + if ( (tx= LP_transactionfind(coin,txid)) != 0 ) + height = tx->height; if ( height == 0 ) { if ( (retjson= electrum_transaction(&height,coin->symbol,coin->electrum,&retjson,txid,0)) != 0 ) From 1327ee506d9d3965bbbf01437bfa16cf676a8d9b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 19:55:07 +0200 Subject: [PATCH 32/33] Test --- iguana/exchanges/LP_transaction.c | 2 +- iguana/exchanges/LP_utxo.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 11ba55eef..dda7eb260 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -70,9 +70,9 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi txid = jbits256(txobj,"txid"); if ( jobj(txobj,"error") == 0 && bits256_cmp(txid,expectedtxid) == 0 ) { + *numconfirmsp = 0; if ( numconfirmsp != 0 && coinaddr != 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) { - *numconfirmsp = 0; //char str[65]; printf("%s %s already in gettx (%s)\n",coinaddr,bits256_str(str,txid),jprint(txobj,0)); if ( (retjson= electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,expectedtxid)) != 0 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index ab70469e6..43d7f3865 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -871,10 +871,10 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) bits256 blockhash; struct LP_transaction *tx=0; cJSON *blockobj,*retjson,*txobj,*txobj2; int32_t height = 0; if ( coin == 0 ) return(-1); - /*if ( (tx= LP_transactionfind(coin,txid)) != 0 ) + if ( (tx= LP_transactionfind(coin,txid)) != 0 ) height = tx->height; - if ( height > 1 ) - return(height);*/ + if ( height > 0 ) + return(height); if ( coin->electrum == 0 ) { if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,0)) != 0 ) @@ -906,8 +906,8 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) } else { - if ( (tx= LP_transactionfind(coin,txid)) != 0 ) - height = tx->height; + //if ( (tx= LP_transactionfind(coin,txid)) != 0 ) + // height = tx->height; if ( height == 0 ) { if ( (retjson= electrum_transaction(&height,coin->symbol,coin->electrum,&retjson,txid,0)) != 0 ) From 4a40d35d67d35789f6d9e161557ab229b0b82ab7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 21:05:40 +0200 Subject: [PATCH 33/33] Revert notarization check --- 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 43d7f3865..08e6258ea 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -956,7 +956,7 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int numconfirms = 0; } } - if ( numconfirms == BASILISK_DEFAULT_MAXCONFIRMS ) + /*if ( numconfirms == BASILISK_DEFAULT_MAXCONFIRMS ) { if ( coin->isassetchain != 0 || strcmp(coin->symbol,"KMD") == 0 ) { @@ -967,7 +967,7 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int numconfirms = BASILISK_DEFAULT_MAXCONFIRMS; } } - } + }*/ return(numconfirms); }