From b19e6a3e9ae36450d9ade3ffdd7ac40dea45d435 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Dec 2017 22:47:50 +0400 Subject: [PATCH] Test --- iguana/exchanges/LP_include.h | 1 + iguana/exchanges/LP_instantdex.c | 17 ++++++++++++++++- iguana/exchanges/LP_utxo.c | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 77c71ece4..bb7e77d73 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -500,6 +500,7 @@ struct LP_address *_LP_addressadd(struct iguana_info *coin,char *coinaddr); int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,struct iguana_msgtx *msgtx,char **signedtxp,bits256 *signedtxidp,struct vin_info *V,int32_t numinputs,char *rawtx,cJSON *vins,cJSON *privkeysjson,int32_t zcash); //void LP_butxo_swapfields_set(struct LP_utxoinfo *butxo); struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout); +int64_t LP_myzcredits(); int32_t LP_destaddr(char *destaddr,cJSON *item); int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int32_t duration); cJSON *LP_statslog_disp(uint32_t starttime,uint32_t endtime,char *refgui,bits256 refpubkey,char *refbase,char *refrel); diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 20e79fb47..d2ee44382 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -424,5 +424,20 @@ int64_t LP_instantdex_proofcheck(char *coinaddr,cJSON *proof,int32_t num) printf("validated instantdex %s.[%d] proof.(%s) credits %.8f net %.8f\n",othersmartaddr,num,jprint(proof,0),dstr(ap->instantdex_credits),dstr(net)); } else printf("cant find ap.%p or already did %d %.8f\n",ap,ap!=0?ap->didinstantdex:-1,ap!=0?dstr(ap->instantdex_credits):-1); } - return(net); + return(ap->instantdex_credits); +} + +int64_t LP_myzcredits() +{ + cJSON *proof; struct iguana_info *coin; int64_t zcredits; + if ( (coin= LP_coinfind("KMD")) != 0 ) + { + if ( (proof= LP_instantdex_txids()) != 0 ) + { + zcredits = LP_instantdex_proofcheck(coin->smartaddr,proof,cJSON_GetArraySize(proof)); + free_json(proof); + return(zcredits); + } + } + return(0); } diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index f2ac7ab7f..c1611b654 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -619,6 +619,8 @@ cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electr jaddstr(retjson,"coin",coin->symbol); jaddstr(retjson,"address",coinaddr); jaddnum(retjson,"balance",dstr(balance)); + if ( strcmp(coin->symbol,"KMD") == 0 ) + jaddnum(retjson,"zcredits",dstr(LP_myzcredits())); return(retjson); }