From 72a4c6b958a4295a3936faf4e50183c76f31a2d0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 May 2018 10:17:17 +0300 Subject: [PATCH 1/7] + --- iguana/m_notary_run | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/m_notary_run b/iguana/m_notary_run index 09d7fc66c..c11469e8c 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -21,6 +21,7 @@ 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\":\"54.95.68.31\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"142.54.164.114\"}" 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\"}" #tests/addnotarys_7776 coins/btc_7776 From cd042e5ead2f701a7fa042a2815e965d706e18e6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 May 2018 13:52:18 +0300 Subject: [PATCH 2/7] Default using SPV cache firsttime --- iguana/exchanges/LP_socket.c | 2 +- iguana/exchanges/LP_transaction.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 8444a69cc..39b96b0d6 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -613,7 +613,7 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON if ( (ap= LP_address(coin,addr)) != 0 ) { if ( ap->unspenttime == 0 ) - usecache = 0; + usecache = 1; else if ( ap->unspentheight < height ) usecache = 0; else if ( G.LP_pendingswaps != 0 && time(NULL) > ap->unspenttime+13 ) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 5d6a9b40d..8c2f1006e 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1035,6 +1035,8 @@ uint64_t _komodo_interestnew(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime //printf("minutes.%d tiptime.%u locktime.%u\n",minutes,tiptime,nLockTime); if ( minutes > 365 * 24 * 60 ) minutes = 365 * 24 * 60; + if ( nLockTime > 1536000000 && minutes > 31*24*60 ) + minutes = 31 * 24 * 60; minutes -= 59; interest = ((nValue / 10512000) * minutes); } From 0f123f5992377e21a4304d53af3615fa26fd4d79 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 May 2018 14:37:56 +0300 Subject: [PATCH 3/7] Make portfolio purely local --- iguana/exchanges/LP_nativeDEX.c | 2 ++ iguana/exchanges/LP_portfolio.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7270ca787..5a291227c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -570,6 +570,8 @@ void LP_coinsloop(void *_coins) memset(&zero,0,sizeof(zero)); if ( coin->inactive != 0 ) continue; + coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); + coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); if ( coin->did_addrutxo_reset == 0 ) { int32_t num; diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 276e27f3b..54f7365a0 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -143,14 +143,14 @@ char *LP_portfolio() { HASH_ITER(hh,LP_coins,coin,tmp) { - if ( coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) + if ( coin->inactive != 0 || coin->balanceA == 0 || coin->balanceB == 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; if ( iter == 0 ) { //printf("from portfolio\n"); //LP_privkey_init(-1,coin,G.LP_privkey,G.LP_mypub25519); - coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); - coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); + //coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); + //coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); if ( strcmp(coin->symbol,"KMD") != 0 ) coin->price_kmd = LP_price(coin->symbol,"KMD"); else coin->price_kmd = 1.; From 422317a7ae35da8646bb9d2537936bd506803cc5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 May 2018 18:04:23 +0300 Subject: [PATCH 4/7] Coinmarketcap v2 api --- crypto777/iguana_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto777/iguana_utils.c b/crypto777/iguana_utils.c index 05897a953..41eefc8e3 100755 --- a/crypto777/iguana_utils.c +++ b/crypto777/iguana_utils.c @@ -1147,7 +1147,7 @@ void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen) char *cmc_ticker(char *base) { char url[512]; - sprintf(url,"https://api.coinmarketcap.com/v1/ticker/%s/",base); + sprintf(url,"https://api.coinmarketcap.com/v2/ticker/%s/",base); return(issue_curl(url)); } From 710227aedffa622b6b4e77628cbe76e286e5752a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 10 May 2018 10:21:53 +0300 Subject: [PATCH 5/7] Revert portfolio caching --- iguana/exchanges/LP_nativeDEX.c | 2 -- iguana/exchanges/LP_portfolio.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 5a291227c..7270ca787 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -570,8 +570,6 @@ void LP_coinsloop(void *_coins) memset(&zero,0,sizeof(zero)); if ( coin->inactive != 0 ) continue; - coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); - coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); if ( coin->did_addrutxo_reset == 0 ) { int32_t num; diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 54f7365a0..276e27f3b 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -143,14 +143,14 @@ char *LP_portfolio() { HASH_ITER(hh,LP_coins,coin,tmp) { - if ( coin->inactive != 0 || coin->balanceA == 0 || coin->balanceB == 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) + if ( coin->inactive != 0 )//|| (coin->electrum != 0 && coin->obooktime == 0) ) continue; if ( iter == 0 ) { //printf("from portfolio\n"); //LP_privkey_init(-1,coin,G.LP_privkey,G.LP_mypub25519); - //coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); - //coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); + coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); + coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); if ( strcmp(coin->symbol,"KMD") != 0 ) coin->price_kmd = LP_price(coin->symbol,"KMD"); else coin->price_kmd = 1.; From bc676d57dc1e028486258e99f6a8c438cdd26de1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 10 May 2018 10:23:08 +0300 Subject: [PATCH 6/7] Revert cmc v2 to v1 --- crypto777/iguana_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto777/iguana_utils.c b/crypto777/iguana_utils.c index 41eefc8e3..05897a953 100755 --- a/crypto777/iguana_utils.c +++ b/crypto777/iguana_utils.c @@ -1147,7 +1147,7 @@ void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen) char *cmc_ticker(char *base) { char url[512]; - sprintf(url,"https://api.coinmarketcap.com/v2/ticker/%s/",base); + sprintf(url,"https://api.coinmarketcap.com/v1/ticker/%s/",base); return(issue_curl(url)); } From 2800b74418ee46ce1c163bb5cb167e3803536569 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 10 May 2018 10:27:28 +0300 Subject: [PATCH 7/7] Initial condition fix --- iguana/exchanges/LP_socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 39b96b0d6..b8e74e84c 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -613,7 +613,11 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON if ( (ap= LP_address(coin,addr)) != 0 ) { if ( ap->unspenttime == 0 ) + { + ap->unspenttime = (uint32_t)time(NULL); + ap->unspentheight = height; usecache = 1; + } else if ( ap->unspentheight < height ) usecache = 0; else if ( G.LP_pendingswaps != 0 && time(NULL) > ap->unspenttime+13 )