From 32e6b02d2e6fa8ea0695cda62412f507768bc658 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 12:23:23 +0300 Subject: [PATCH 01/11] dont broadcast BTC autosplit --- 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 a08b5c77f..cf357ffa9 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1936,7 +1936,7 @@ char *LP_autosplit(struct iguana_info *coin) jaddnum(item,coin->smartaddr,dstr(balance - 2*halfval)); jaddi(outputs,item); jadd(argjson,"outputs",outputs); - jaddnum(argjson,"broadcast",1); + jaddnum(argjson,"broadcast",strcmp(coin->symbol,"BTC") != 0); jaddstr(argjson,"coin",coin->symbol); //printf("autosplit.(%s)\n",jprint(argjson,0)); retstr = LP_withdraw(coin,argjson); From ab35803ed8485e223cc49a18a035ae8c089ae0bd Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:21:44 +0300 Subject: [PATCH 02/11] Test --- iguana/exchanges/LP_transaction.c | 2 +- iguana/m_notary_run | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index cf357ffa9..886164eeb 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1921,7 +1921,7 @@ char *LP_autosplit(struct iguana_info *coin) else balance = LP_RTsmartbalance(coin); //printf("%s balance %.8f\n",coin->symbol,dstr(balance)); balance -= coin->txfee - 0.001; - if ( balance > coin->txfee && balance > 1000000 ) + if ( balance > coin->txfee && balance >= 1000000 ) { halfval = (balance / 100) * 45; argjson = cJSON_CreateObject(); diff --git a/iguana/m_notary_run b/iguana/m_notary_run index 402787236..0bb889232 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -23,6 +23,8 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"ad curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"45.7.229.33\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"103.6.12.111\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"155.254.17.21\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"138.121.203.210\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"209.58.169.65\"}" #tests/addnotarys_7776 coins/btc_7776 From 03e1855facca527e5a78f323ad4ce550b1d61d46 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:34:41 +0300 Subject: [PATCH 03/11] Test --- iguana/exchanges/LP_transaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 886164eeb..a5fb49bbf 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1919,7 +1919,7 @@ char *LP_autosplit(struct iguana_info *coin) if ( coin->electrum != 0 ) balance = LP_unspents_load(coin->symbol,coin->smartaddr); else balance = LP_RTsmartbalance(coin); - //printf("%s balance %.8f\n",coin->symbol,dstr(balance)); + printf("%s balance %.8f\n",coin->symbol,dstr(balance)); balance -= coin->txfee - 0.001; if ( balance > coin->txfee && balance >= 1000000 ) { @@ -1938,7 +1938,7 @@ char *LP_autosplit(struct iguana_info *coin) jadd(argjson,"outputs",outputs); jaddnum(argjson,"broadcast",strcmp(coin->symbol,"BTC") != 0); jaddstr(argjson,"coin",coin->symbol); - //printf("autosplit.(%s)\n",jprint(argjson,0)); + printf("halfval %.8f autosplit.(%s)\n",dstr(halfval),jprint(argjson,0)); retstr = LP_withdraw(coin,argjson); free_json(argjson); return(retstr); From 4f57796ffa6eb900a40d20544f11896b2bce8b9a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:38:28 +0300 Subject: [PATCH 04/11] 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 a5fb49bbf..96546ada7 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1913,13 +1913,14 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) char *LP_autosplit(struct iguana_info *coin) { - char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,halfval; + char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,halfval,txfee; if ( coin->etomic[0] == 0 ) { if ( coin->electrum != 0 ) balance = LP_unspents_load(coin->symbol,coin->smartaddr); else balance = LP_RTsmartbalance(coin); - printf("%s balance %.8f\n",coin->symbol,dstr(balance)); + if ( (txfee= coin->txfee) == 0 ) // BTC + txfee = LP_txfeecalc(coin,0,500); balance -= coin->txfee - 0.001; if ( balance > coin->txfee && balance >= 1000000 ) { @@ -1938,7 +1939,7 @@ char *LP_autosplit(struct iguana_info *coin) jadd(argjson,"outputs",outputs); jaddnum(argjson,"broadcast",strcmp(coin->symbol,"BTC") != 0); jaddstr(argjson,"coin",coin->symbol); - printf("halfval %.8f autosplit.(%s)\n",dstr(halfval),jprint(argjson,0)); + //printf("halfval %.8f autosplit.(%s)\n",dstr(halfval),jprint(argjson,0)); retstr = LP_withdraw(coin,argjson); free_json(argjson); return(retstr); From 418defb016f8f98640de5d44f84105a00512c4d0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:39:43 +0300 Subject: [PATCH 05/11] Test --- iguana/exchanges/LP_transaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 96546ada7..b53222dbf 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1921,8 +1921,8 @@ char *LP_autosplit(struct iguana_info *coin) else balance = LP_RTsmartbalance(coin); if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); - balance -= coin->txfee - 0.001; - if ( balance > coin->txfee && balance >= 1000000 ) + balance -= txfee - 0.001; + if ( balance > txfee && balance >= 1000000 ) { halfval = (balance / 100) * 45; argjson = cJSON_CreateObject(); From fef876e5f1c78cafccc45b2bce4bb32aaeeba548 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:43:09 +0300 Subject: [PATCH 06/11] 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 b53222dbf..e75342dd2 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1922,7 +1922,7 @@ char *LP_autosplit(struct iguana_info *coin) if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); balance -= txfee - 0.001; - if ( balance > txfee && balance >= 1000000 ) + if ( balance > txfee && balance >= (1000000 - (txfee - 0.001)) ) { halfval = (balance / 100) * 45; argjson = cJSON_CreateObject(); From 3ba7840d9c58e4e396e417c2ebd696dec8b0c14f Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:47:19 +0300 Subject: [PATCH 07/11] 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 e75342dd2..fca8384cf 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1922,6 +1922,7 @@ char *LP_autosplit(struct iguana_info *coin) if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); balance -= txfee - 0.001; + printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txstr),dstr((1000000 - (txfee - 0.001)))); if ( balance > txfee && balance >= (1000000 - (txfee - 0.001)) ) { halfval = (balance / 100) * 45; From f18b9268a2c95db667a546ea98b955ebd44ccfeb Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:49:01 +0300 Subject: [PATCH 08/11] 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 fca8384cf..d0298a92d 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1922,7 +1922,7 @@ char *LP_autosplit(struct iguana_info *coin) if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); balance -= txfee - 0.001; - printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txstr),dstr((1000000 - (txfee - 0.001)))); + printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee - 0.001)))); if ( balance > txfee && balance >= (1000000 - (txfee - 0.001)) ) { halfval = (balance / 100) * 45; From 3586a13e04cdd42d5f03601f8fc149752b3e1090 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:51:27 +0300 Subject: [PATCH 09/11] Test --- 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 d0298a92d..4b850a098 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1921,9 +1921,9 @@ char *LP_autosplit(struct iguana_info *coin) else balance = LP_RTsmartbalance(coin); if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); - balance -= txfee - 0.001; - printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee - 0.001)))); - if ( balance > txfee && balance >= (1000000 - (txfee - 0.001)) ) + balance -= txfee - 100000; + printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee - 100000)))); + if ( balance > txfee && balance >= (1000000 - (txfee - 100000)) ) { halfval = (balance / 100) * 45; argjson = cJSON_CreateObject(); From d705c142375e9e90c418267892a833e5a24126ca Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:52:48 +0300 Subject: [PATCH 10/11] Test --- 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 4b850a098..85ff6fbca 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1921,9 +1921,9 @@ char *LP_autosplit(struct iguana_info *coin) else balance = LP_RTsmartbalance(coin); if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); - balance -= txfee - 100000; - printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee - 100000)))); - if ( balance > txfee && balance >= (1000000 - (txfee - 100000)) ) + balance -= (txfee + 100000); + printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee + 100000)))); + if ( balance > txfee && balance >= (1000000 - (txfee + 100000)) ) { halfval = (balance / 100) * 45; argjson = cJSON_CreateObject(); From 6855611f6cad1b75adf434ac93aa6e08d8ed63a9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 16 May 2018 13:53:48 +0300 Subject: [PATCH 11/11] Fix BTC autosplit --- iguana/exchanges/LP_transaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 85ff6fbca..35c366513 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1922,7 +1922,7 @@ char *LP_autosplit(struct iguana_info *coin) if ( (txfee= coin->txfee) == 0 ) // BTC txfee = LP_txfeecalc(coin,0,500); balance -= (txfee + 100000); - printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee + 100000)))); + //printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee + 100000)))); if ( balance > txfee && balance >= (1000000 - (txfee + 100000)) ) { halfval = (balance / 100) * 45; @@ -1938,7 +1938,7 @@ char *LP_autosplit(struct iguana_info *coin) jaddnum(item,coin->smartaddr,dstr(balance - 2*halfval)); jaddi(outputs,item); jadd(argjson,"outputs",outputs); - jaddnum(argjson,"broadcast",strcmp(coin->symbol,"BTC") != 0); + jaddnum(argjson,"broadcast",1); jaddstr(argjson,"coin",coin->symbol); //printf("halfval %.8f autosplit.(%s)\n",dstr(halfval),jprint(argjson,0)); retstr = LP_withdraw(coin,argjson);