Browse Source

Test

etomic
jl777 8 years ago
parent
commit
cd4829da4a
  1. 2
      iguana/exchanges/LP_nativeDEX.c
  2. 2
      iguana/exchanges/LP_prices.c
  3. 8
      iguana/exchanges/LP_utxos.c

2
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) HASH_ITER(hh,LP_utxoinfos[1],utxo,utmp)
{ {
LP_utxo_spentcheck(pubsock,utxo); 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)); char str[65]; printf("publish mybob %s\n",bits256_str(str,utxo->payment.txid));
LP_utxo_clientpublish(utxo); LP_utxo_clientpublish(utxo);

2
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 = realloc(*arrayp,sizeof(*(*arrayp)) * (num+1));
(*arrayp)[num++] = op; (*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); LP_utxo_clientpublish(utxo);
} }
} }

8
iguana/exchanges/LP_utxos.c

@ -471,9 +471,12 @@ char *LP_spentcheck(cJSON *argjson)
void LP_utxo_clientpublish(struct LP_utxoinfo *utxo) void LP_utxo_clientpublish(struct LP_utxoinfo *utxo)
{ {
bits256 zero; char *msg; bits256 zero; char *msg;
if ( LP_isunspent(utxo) > 0 )
{
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
msg = jprint(LP_utxojson(utxo),1); msg = jprint(LP_utxojson(utxo),1);
LP_broadcast_message(LP_mypubsock,utxo->coin,"",zero,msg); LP_broadcast_message(LP_mypubsock,utxo->coin,"",zero,msg);
}
/*struct LP_peerinfo *peer,*tmp; cJSON *retjson; char *retstr; int32_t n = 0; /*struct LP_peerinfo *peer,*tmp; cJSON *retjson; char *retstr; int32_t n = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp) HASH_ITER(hh,LP_peerinfos,peer,tmp)
{ {
@ -604,13 +607,16 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bit
msg = jprint(LP_utxojson(utxo),1); msg = jprint(LP_utxojson(utxo),1);
/LP_send(mypubsock,msg,(int32_t)strlen(msg)+1,1); /LP_send(mypubsock,msg,(int32_t)strlen(msg)+1,1);
} else LP_utxo_clientpublish(utxo);*/ } else LP_utxo_clientpublish(utxo);*/
if ( LP_ismine(utxo) > 0 )
{
LP_utxo_clientpublish(utxo); LP_utxo_clientpublish(utxo);
if ( LP_mypeer != 0 && LP_ismine(utxo) > 0 ) if ( LP_mypeer != 0 )
{ {
LP_mypeer->numutxos++; LP_mypeer->numutxos++;
utxo->T.lasttime = (uint32_t)time(NULL); utxo->T.lasttime = (uint32_t)time(NULL);
} }
} }
}
return(utxo); return(utxo);
} }

Loading…
Cancel
Save