Browse Source

Test

etomic
jl777 8 years ago
parent
commit
166c94cc76
  1. 4
      .gitignore
  2. 2
      basilisk/basilisk_swap.c
  3. 14
      basilisk/smartaddress.c
  4. 8
      iguana/iguana_wallet.c
  5. 2
      iguana/tests/DEXratio

4
.gitignore

@ -403,3 +403,7 @@ iguana/DB/SWAPS/3213598586-2281632307
iguana/DB/SWAPS/2686675855-3655454671 iguana/DB/SWAPS/2686675855-3655454671
iguana/DB/SWAPS/1878868608-154367763 iguana/DB/SWAPS/1878868608-154367763
iguana/DB/SWAPS/1306454711-1938980379
iguana/DB/SWAPS/912783809-2523701920

2
basilisk/basilisk_swap.c

@ -2731,7 +2731,7 @@ cJSON *basilisk_swapjson(struct supernet_info *myinfo,struct basilisk_swap *swap
struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,bits256 privkey,struct basilisk_request *rp,uint32_t statebits,int32_t optionduration,int32_t reinit) struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,bits256 privkey,struct basilisk_request *rp,uint32_t statebits,int32_t optionduration,int32_t reinit)
{ {
int32_t i,m,n,iter; uint8_t pubkey33[33],data[64]; bits256 pubkey25519; uint32_t channel,starttime; cJSON *retarray,*item,*msgobj; struct iguana_info *coin; double pending=0.; struct basilisk_swap *swap = 0; int32_t i,m,n,iter; uint8_t pubkey33[33]; bits256 pubkey25519; uint32_t channel,starttime; cJSON *retarray,*item,*msgobj; struct iguana_info *coin; double pending=0.; struct basilisk_swap *swap = 0;
// statebits 1 -> client, 0 -> LP // statebits 1 -> client, 0 -> LP
if ( myinfo->numswaps > 0 ) if ( myinfo->numswaps > 0 )
{ {

14
basilisk/smartaddress.c

@ -62,9 +62,13 @@ cJSON *smartaddress_extrajson(struct smartaddress *ap)
cJSON *smartaddress_json(struct smartaddress *ap) cJSON *smartaddress_json(struct smartaddress *ap)
{ {
char coinaddr[64]; int32_t j,n; struct iguana_info *coin; cJSON *array,*item,*retjson; char coinaddr[64],symbol[64]; uint8_t desttype,tmp,rmd160[20]; int32_t j,n; struct iguana_info *coin,*dest; cJSON *array,*item,*retjson;
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
jaddstr(retjson,"type",ap->typestr); jaddstr(retjson,"type",ap->typestr);
strcpy(symbol,ap->typestr), touppercase(symbol);
if ( (dest= iguana_coinfind(symbol)) != 0 )
desttype = dest->chain->pubtype;
else desttype = 60;
if ( (n= ap->numsymbols) > 0 ) if ( (n= ap->numsymbols) > 0 )
{ {
array = cJSON_CreateArray(); array = cJSON_CreateArray();
@ -76,6 +80,12 @@ cJSON *smartaddress_json(struct smartaddress *ap)
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddstr(item,"coin",coin->symbol); jaddstr(item,"coin",coin->symbol);
jaddstr(item,"address",coinaddr); jaddstr(item,"address",coinaddr);
if ( dest != 0 )
{
bitcoin_addr2rmd160(&tmp,rmd160,coinaddr);
bitcoin_address(coinaddr,desttype,rmd160,20);
jaddstr(item,"dest",coinaddr);
}
jaddnum(item,"maxbid",ap->symbols[j].maxbid); jaddnum(item,"maxbid",ap->symbols[j].maxbid);
jaddnum(item,"minask",ap->symbols[j].minask); jaddnum(item,"minask",ap->symbols[j].minask);
jadd(item,"extra",smartaddress_extrajson(ap)); jadd(item,"extra",smartaddress_extrajson(ap));
@ -99,7 +109,7 @@ void smartaddress_symboladd(struct smartaddress *ap,char *symbol,double maxbid,d
safecopy(sp->symbol,symbol,sizeof(sp->symbol)); safecopy(sp->symbol,symbol,sizeof(sp->symbol));
sp->maxbid = maxbid; sp->maxbid = maxbid;
sp->minask = minask; sp->minask = minask;
printf("symboladd (%s) <- (%s %f %f)\n",ap->typestr,symbol,maxbid,minask); printf("symboladd.%d (%s) <- (%s %f %f)\n",ap->numsymbols,ap->typestr,symbol,maxbid,minask);
} }
} }

8
iguana/iguana_wallet.c

@ -1373,12 +1373,14 @@ TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout)
} }
if ( bits256_nonz(myinfo->persistent_priv) != 0 ) if ( bits256_nonz(myinfo->persistent_priv) != 0 )
{ {
char *jumblrstr,jumblr_passphrase[1024]; char *jumblrstr,jumblr_passphrase[1024],coinaddr[64],KMDaddr[64]; bits256 privkey;
sprintf(jumblr_passphrase,"jumblr %s",password); sprintf(jumblr_passphrase,"jumblr %s",password);
if ( (jumblrstr= jumblr_setpassphrase(myinfo,0,0,0,jumblr_passphrase)) != 0 ) if ( (jumblrstr= jumblr_setpassphrase(myinfo,0,0,0,jumblr_passphrase)) != 0 )
free(jumblrstr); free(jumblrstr);
smartaddress_add(myinfo,myinfo->persistent_priv,"kmd","BTC",0.,0.); privkey = jumblr_privkey(myinfo,coinaddr,0,KMDaddr,"kmd ");
smartaddress_add(myinfo,myinfo->persistent_priv,"btc","KMD",0.,0.); smartaddress_add(myinfo,privkey,"kmd","BTC",0.,0.);
privkey = jumblr_privkey(myinfo,coinaddr,0,KMDaddr,"btc ");
smartaddress_add(myinfo,privkey,"btc","KMD",0.,0.);
} }
//basilisk_unspents_update(myinfo,coin); //basilisk_unspents_update(myinfo,coin);
return(retstr); return(retstr);

2
iguana/tests/DEXratio

@ -0,0 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"ratio\":0.97,\"agent\":\"InstantDEX\",\"method\":\"DEXratio\"}"
Loading…
Cancel
Save