From cd4829da4a0a2e46c28df5d39c0d29aaf20109fb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 8 Jul 2017 13:17:48 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_prices.c | 2 +- iguana/exchanges/LP_utxos.c | 20 +++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0914b9503..d49fb01d7 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -379,7 +379,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int HASH_ITER(hh,LP_utxoinfos[1],utxo,utmp) { LP_utxo_spentcheck(pubsock,utxo); - if ( utxo->T.spentflag == 0 && utxo->T.lasttime == 0 && LP_ismine(utxo) > 0 ) + if ( LP_isunspent(utxo) > 0 && utxo->T.lasttime == 0 && LP_ismine(utxo) > 0 ) { char str[65]; printf("publish mybob %s\n",bits256_str(str,utxo->payment.txid)); LP_utxo_clientpublish(utxo); diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 1fd2fd4ed..ce0146e67 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -542,7 +542,7 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char * { *arrayp = realloc(*arrayp,sizeof(*(*arrayp)) * (num+1)); (*arrayp)[num++] = op; - if ( bits256_cmp(utxo->pubkey,LP_mypub25519) == 0 && utxo->T.lasttime == 0 ) + if ( LP_ismine(utxo) > 0 && utxo->T.lasttime == 0 ) LP_utxo_clientpublish(utxo); } } diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index aa7bdb934..abd88f3ef 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -471,9 +471,12 @@ char *LP_spentcheck(cJSON *argjson) void LP_utxo_clientpublish(struct LP_utxoinfo *utxo) { bits256 zero; char *msg; - memset(zero.bytes,0,sizeof(zero)); - msg = jprint(LP_utxojson(utxo),1); - LP_broadcast_message(LP_mypubsock,utxo->coin,"",zero,msg); + if ( LP_isunspent(utxo) > 0 ) + { + memset(zero.bytes,0,sizeof(zero)); + msg = jprint(LP_utxojson(utxo),1); + LP_broadcast_message(LP_mypubsock,utxo->coin,"",zero,msg); + } /*struct LP_peerinfo *peer,*tmp; cJSON *retjson; char *retstr; int32_t n = 0; HASH_ITER(hh,LP_peerinfos,peer,tmp) { @@ -604,11 +607,14 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bit msg = jprint(LP_utxojson(utxo),1); /LP_send(mypubsock,msg,(int32_t)strlen(msg)+1,1); } else LP_utxo_clientpublish(utxo);*/ - LP_utxo_clientpublish(utxo); - if ( LP_mypeer != 0 && LP_ismine(utxo) > 0 ) + if ( LP_ismine(utxo) > 0 ) { - LP_mypeer->numutxos++; - utxo->T.lasttime = (uint32_t)time(NULL); + LP_utxo_clientpublish(utxo); + if ( LP_mypeer != 0 ) + { + LP_mypeer->numutxos++; + utxo->T.lasttime = (uint32_t)time(NULL); + } } } return(utxo);