Browse Source

Test

etomic
jl777 8 years ago
parent
commit
982be563cf
  1. 5
      iguana/exchanges/LP_commands.c
  2. 13
      iguana/exchanges/LP_nativeDEX.c

5
iguana/exchanges/LP_commands.c

@ -313,12 +313,11 @@ char *stats_JSON(cJSON *argjson,char *remoteaddr,uint16_t port) // from rpc port
return(clonestr("{\"error\":\"need method in request\"}")); return(clonestr("{\"error\":\"need method in request\"}"));
else else
{ {
amclient = 0; amclient = (LP_mypeer == 0);
if ( (ipaddr= jstr(argjson,"ipaddr")) != 0 && (argport= juint(argjson,"port")) != 0 ) if ( (ipaddr= jstr(argjson,"ipaddr")) != 0 && (argport= juint(argjson,"port")) != 0 )
{ {
if ( strcmp(ipaddr,"127.0.0.1") != 0 && port >= 1000 ) if ( strcmp(ipaddr,"127.0.0.1") != 0 && port >= 1000 )
{ {
amclient = 0;
if ( (pushport= juint(argjson,"push")) == 0 ) if ( (pushport= juint(argjson,"push")) == 0 )
pushport = argport + 1; pushport = argport + 1;
if ( (subport= juint(argjson,"sub")) == 0 ) if ( (subport= juint(argjson,"sub")) == 0 )
@ -334,7 +333,7 @@ char *stats_JSON(cJSON *argjson,char *remoteaddr,uint16_t port) // from rpc port
} }
//printf("peer.(%s) found (%d %d) (%d %d) (%s)\n",peer->ipaddr,peer->numpeers,peer->numutxos,otherpeers,othernumutxos,jprint(argjson,0)); //printf("peer.(%s) found (%d %d) (%d %d) (%s)\n",peer->ipaddr,peer->numpeers,peer->numutxos,otherpeers,othernumutxos,jprint(argjson,0));
} else LP_addpeer(amclient,LP_mypeer,LP_mypubsock,ipaddr,argport,pushport,subport,jdouble(argjson,"profit"),jint(argjson,"numpeers"),jint(argjson,"numutxos")); } else LP_addpeer(amclient,LP_mypeer,LP_mypubsock,ipaddr,argport,pushport,subport,jdouble(argjson,"profit"),jint(argjson,"numpeers"),jint(argjson,"numutxos"));
} else amclient = 1; }
} }
if ( strcmp(method,"quote") == 0 || strcmp(method,"reserved") == 0 ) if ( strcmp(method,"quote") == 0 || strcmp(method,"reserved") == 0 )
retstr = LP_quote(juint(argjson,"pending"),jstr(argjson,"base"),jstr(argjson,"rel"),jbits256(argjson,"txid"),jint(argjson,"vout"),jdouble(argjson,"price"),j64bits(argjson,"satoshis")); retstr = LP_quote(juint(argjson,"pending"),jstr(argjson,"base"),jstr(argjson,"rel"),jbits256(argjson,"txid"),jint(argjson,"vout"),jdouble(argjson,"price"),j64bits(argjson,"satoshis"));

13
iguana/exchanges/LP_nativeDEX.c

@ -301,20 +301,23 @@ struct LP_utxoinfo *LP_addutxo(int32_t amclient,struct LP_peerinfo *mypeer,int32
safecopy(utxo->coin,coin,sizeof(utxo->coin)); safecopy(utxo->coin,coin,sizeof(utxo->coin));
safecopy(utxo->coinaddr,coinaddr,sizeof(utxo->coinaddr)); safecopy(utxo->coinaddr,coinaddr,sizeof(utxo->coinaddr));
safecopy(utxo->spendscript,spendscript,sizeof(utxo->spendscript)); safecopy(utxo->spendscript,spendscript,sizeof(utxo->spendscript));
if ( amclient == 0 )
{
utxo->txid = txid; utxo->txid = txid;
utxo->vout = vout; utxo->vout = vout;
utxo->satoshis = satoshis; utxo->satoshis = satoshis;
if ( amclient == 0 )
{
utxo->deposittxid = deposittxid; utxo->deposittxid = deposittxid;
utxo->depositvout = depositvout; utxo->depositvout = depositvout;
utxo->depositsatoshis = depositsatoshis; utxo->depositsatoshis = depositsatoshis;
} }
else else
{ {
utxo->feetxid = deposittxid; utxo->feetxid = txid;
utxo->feevout = depositvout; utxo->feevout = vout;
utxo->feesatoshis = depositsatoshis; utxo->feesatoshis = satoshis;
utxo->txid = deposittxid;
utxo->vout = depositvout;
utxo->satoshis = depositsatoshis;
} }
memcpy(key,txid.bytes,sizeof(txid)); memcpy(key,txid.bytes,sizeof(txid));
memcpy(&key[sizeof(txid)],&vout,sizeof(vout)); memcpy(&key[sizeof(txid)],&vout,sizeof(vout));

Loading…
Cancel
Save