From 4adcaa9eee97f450094fc8d785c0567695a26edd Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Nov 2017 16:13:03 +0400 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 16 ++++++++++++++++ iguana/exchanges/LP_zeroconf.c | 8 ++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 8f8e11968..2df539365 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -292,6 +292,22 @@ zeroconf_claim(address, expiration=0)\n\ return(basilisk_swapentries(base,rel,jint(argjson,"limit"))); else return(basilisk_swaplist(0,0)); } + else if ( strcmp(method,"dynamictrust") == 0 ) + { + struct LP_address *ap; char *coinaddr; + if ( (ptr= LP_coinsearch("KMD")) != 0 && (coinaddr= jstr(argjson,"address")) != 0 ) + { + if ( (ap= LP_addressfind(ptr,coinaddr)) != 0 ) + { + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"address",coinaddr); + jaddnum(retjson,"zcredits",dstr(ap->zeroconf_credits)); + return(jprint(retjson,1)); + } + } + return(clonestr("{\"error\":\"cant find address\"}")); + } else if ( (retstr= LP_istradebots_command(ctx,pubsock,method,argjson)) != 0 ) return(retstr); if ( base[0] != 0 && rel[0] != 0 ) diff --git a/iguana/exchanges/LP_zeroconf.c b/iguana/exchanges/LP_zeroconf.c index f013c9965..876ac4128 100644 --- a/iguana/exchanges/LP_zeroconf.c +++ b/iguana/exchanges/LP_zeroconf.c @@ -206,7 +206,11 @@ void LP_zeroconf_credit(char *coinaddr,uint64_t satoshis,int32_t weeki,char *p2s void LP_zeroconf_deposits(struct iguana_info *coin) { - cJSON *array,*item,*txjson,*vouts,*v,*txobj; int32_t i,n,numvouts,height,vout,weeki; bits256 txid; char destaddr[64],p2shaddr[64]; int64_t satoshis,amount64; + cJSON *array,*item,*txjson,*vouts,*v,*txobj; int32_t i,n,numvouts,height,vout,weeki; bits256 txid; char destaddr[64],p2shaddr[64]; struct LP_address *ap,*tmp; int64_t satoshis,amount64; + HASH_ITER(hh,coin->addresses,ap,tmp) + { + ap->zeroconf_credits = 0; + } if ( (array= LP_listreceivedbyaddress("KMD",BOTS_BONDADDRESS)) != 0 ) { //printf("ZEROCONF.(%s)\n",jprint(array,0)); @@ -252,7 +256,7 @@ int64_t LP_dynamictrust(bits256 pubkey,int64_t kmdvalue) if ( (coin= LP_coinfind("KMD")) != 0 && (pubp= LP_pubkeyfind(pubkey)) != 0 ) { bitcoin_address(coinaddr,coin->taddr,coin->pubtype,pubp->pubsecp,33); - if ((ap= LP_address(coin,coinaddr)) != 0 && ap->zeroconf_credits >= kmdvalue ) + if ((ap= LP_address(coin,coinaddr)) != 0 )//&& ap->zeroconf_credits >= kmdvalue ) { DL_FOREACH_SAFE(pubp->bobswaps,ptr,tmp) {