Browse Source

Test

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

6
iguana/exchanges/LP_instantdex.c

@ -307,11 +307,12 @@ void LP_instantdex_proofcheck(char *coinaddr,cJSON *proof,int32_t num)
for (i=0; i<num; i++)
LP_instantdex_creditcalc(coin,1,jbits256i(proof,i),othersmartaddr);
ap->didinstantdex = 1;
printf("validated instantdex %s.[%d] proof.(%s)\n",othersmartaddr,num,jprint(proof,0));
printf("validated instantdex %s.[%d] proof.(%s) credits %.8f\n",othersmartaddr,num,jprint(proof,0),dstr(ap->instantdex_credits));
} 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);
}
}
#ifdef bruteforce
void LP_instantdex_deposits(struct iguana_info *coin)
{
static int dispflag = 1;
@ -341,6 +342,7 @@ void LP_instantdex_deposits(struct iguana_info *coin)
}
dispflag = 0;
}
#endif
int64_t LP_dynamictrust(bits256 pubkey,int64_t kmdvalue)
{
@ -360,7 +362,7 @@ int64_t LP_dynamictrust(bits256 pubkey,int64_t kmdvalue)
if ( (sp= ptr->swap) != 0 && sp->finished == 0 && sp->expired == 0 )
swaps_kmdvalue += LP_kmdvalue(sp->Q.destcoin,sp->Q.destsatoshis);
}
//printf("%s instantdex_credits %.8f vs (%.8f + current %.8f)\n",coinaddr,dstr(ap->instantdex_credits),dstr(swaps_kmdvalue),dstr(kmdvalue));
printf("%s instantdex_credits %.8f vs (%.8f + current %.8f)\n",coinaddr,dstr(ap->instantdex_credits),dstr(swaps_kmdvalue),dstr(kmdvalue));
//if ( ap->instantdex_credits > swaps_kmdvalue+kmdvalue )
return(ap->instantdex_credits - (swaps_kmdvalue+kmdvalue));
}

4
iguana/exchanges/LP_nativeDEX.c

@ -658,11 +658,13 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{
now = (uint32_t)time(NULL);
if ( 0 && coin->inactive == 0 && coin->electrum == 0 && didinstantdex == 0 && strcmp("KMD",coin->symbol) == 0 )
#ifdef bruteforce
if ( IAMLP != 0 && coin->inactive == 0 && coin->electrum == 0 && didinstantdex == 0 && strcmp("KMD",coin->symbol) == 0 )
{
LP_instantdex_deposits(coin);
didinstantdex = now;
}
#endif
if ( (coin->addr_listunspent_requested != 0 && now > coin->lastpushtime+LP_ORDERBOOK_DURATION*.5) || now > coin->lastpushtime+LP_ORDERBOOK_DURATION*5 )
{
//printf("PUSH addr_listunspent_requested %u\n",coin->addr_listunspent_requested);

2
iguana/exchanges/LP_ordermatch.c

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

Loading…
Cancel
Save