Browse Source

Test

etomic
jl777 7 years ago
parent
commit
c778ed10be
  1. 4
      iguana/exchanges/LP_instantdex.c
  2. 2
      iguana/exchanges/LP_nativeDEX.c
  3. 2
      iguana/exchanges/LP_ordermatch.c

4
iguana/exchanges/LP_instantdex.c

@ -297,7 +297,7 @@ int64_t LP_instantdex_creditcalc(struct iguana_info *coin,int32_t dispflag,bits2
void LP_instantdex_proofcheck(char *coinaddr,cJSON *proof,int32_t num) void LP_instantdex_proofcheck(char *coinaddr,cJSON *proof,int32_t num)
{ {
uint8_t rmd160[20],addrtype; int32_t i; char othersmartaddr[64]; struct iguana_info *coin; struct LP_address *ap = 0; uint8_t rmd160[20],addrtype; int32_t i; char othersmartaddr[64]; struct iguana_info *coin; struct LP_address *ap = 0;
if ( (coin= LP_coinfind("KMD")) != 0 && coin->electrum != 0 ) if ( (coin= LP_coinfind("KMD")) != 0 )
{ {
bitcoin_addr2rmd160(0,&addrtype,rmd160,coinaddr); bitcoin_addr2rmd160(0,&addrtype,rmd160,coinaddr);
bitcoin_address(othersmartaddr,0,60,rmd160,20); bitcoin_address(othersmartaddr,0,60,rmd160,20);
@ -308,7 +308,7 @@ void LP_instantdex_proofcheck(char *coinaddr,cJSON *proof,int32_t num)
LP_instantdex_creditcalc(coin,1,jbits256i(proof,i),othersmartaddr); LP_instantdex_creditcalc(coin,1,jbits256i(proof,i),othersmartaddr);
ap->didinstantdex = 1; ap->didinstantdex = 1;
printf("validated instantdex %s.[%d] proof.(%s)\n",othersmartaddr,num,jprint(proof,0)); printf("validated instantdex %s.[%d] proof.(%s)\n",othersmartaddr,num,jprint(proof,0));
} } 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);
} }
} }

2
iguana/exchanges/LP_nativeDEX.c

@ -17,9 +17,7 @@
// LP_nativeDEX.c // LP_nativeDEX.c
// marketmaker // marketmaker
// //
// optimize electrum swap
// big BTC swaps // big BTC swaps
// electrum dynamic trust over 1000 tx
// https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki for signing BCH/BTG // https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki for signing BCH/BTG
// //
// cancel bid/ask // cancel bid/ask

2
iguana/exchanges/LP_ordermatch.c

@ -1195,6 +1195,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
bestprice = LP_bob_competition(&counter,aliceid,qprice,1000); bestprice = LP_bob_competition(&counter,aliceid,qprice,1000);
if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 ) if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 )
{ {
printf("CONNECTED.(%s)\n",jprint(argjson,0));
if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 ) if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 )
LP_instantdex_proofcheck(Q.coinaddr,proof,num); LP_instantdex_proofcheck(Q.coinaddr,proof,num);
if ( Qtrades == 0 ) if ( Qtrades == 0 )
@ -1227,6 +1228,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
else if ( strcmp(method,"connect") == 0 ) else if ( strcmp(method,"connect") == 0 )
{ {
LP_bob_competition(&counter,aliceid,qprice,1000); LP_bob_competition(&counter,aliceid,qprice,1000);
printf("CONNECT.(%s)\n",jprint(argjson,0));
if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 ) if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 )
LP_instantdex_proofcheck(Q.coinaddr,proof,num); LP_instantdex_proofcheck(Q.coinaddr,proof,num);
if ( Qtrades == 0 ) if ( Qtrades == 0 )

Loading…
Cancel
Save