Browse Source

Test

etomic
jl777 8 years ago
parent
commit
3efa457f7d
  1. 2
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk_bitcoin.c
  3. 21
      basilisk/jumblr.c
  4. 2
      iguana/exchanges/bittrex.c
  5. 15
      iguana/main.c
  6. 4
      iguana/wp

2
basilisk/basilisk.c

@ -1294,7 +1294,7 @@ HASH_ARRAY_STRING(basilisk,rawtx,hash,vals,hexstr)
STRING_ARG(jumblr,setpassphrase,passphrase)
{
cJSON *retjson; char KMDaddr[64],BTCaddr[64],wifstr[64]; bits256 privkey; struct iguana_info *coinbtc;
if ( passphrase == 0 || passphrase[0] == 0 || (coin= iguana_coinfind("KMD")) == 0 || coin->FULLNODE >= 0 )
if ( passphrase == 0 || passphrase[0] == 0 || (coin= iguana_coinfind("KMD")) == 0 )//|| coin->FULLNODE >= 0 )
return(clonestr("{\"error\":\"no passphrase or no native komodod\"}"));
else
{

2
basilisk/basilisk_bitcoin.c

@ -594,7 +594,7 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
for (i=0; i<duplicates; i++)
bitcoin_txoutput(txobj,script,spendlen,satoshis);
rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,satoshis * duplicates,changeaddr,txfee,addresses,0,0,0,0,"127.0.0.1",0,1);
if ( cJSON_GetArraySize(vins) > duplicates/4 )
if ( cJSON_GetArraySize(vins) > duplicates/2 )
{
free(rawtx);
rawtx = 0;

21
basilisk/jumblr.c

@ -364,14 +364,17 @@ void jumblr_opidsupdate(struct supernet_info *myinfo,struct iguana_info *coin)
}
}
bits256 jumblr_privkey(struct supernet_info *myinfo,char *BTCaddr,uint8_t pubtype,char *KMDaddr,char *prefix)
bits256 jumblr_privkey(struct supernet_info *myinfo,char *coinaddr,uint8_t pubtype,char *KMDaddr,char *prefix)
{
bits256 privkey,pubkey; uint8_t pubkey33[33]; char passphrase[sizeof(myinfo->jumblr_passphrase) + 64];
sprintf(passphrase,"%s%s",prefix,myinfo->jumblr_passphrase);
if ( myinfo->jumblr_passphrase[0] == 0 )
strcpy(myinfo->jumblr_passphrase,"password");
conv_NXTpassword(privkey.bytes,pubkey.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase));
bitcoin_pubkey33(myinfo->ctx,pubkey33,privkey);
bitcoin_address(BTCaddr,pubtype,pubkey33,33);
bitcoin_address(coinaddr,pubtype,pubkey33,33);
bitcoin_address(KMDaddr,60,pubkey33,33);
printf("(%s) -> (%s %s)\n",passphrase,coinaddr,KMDaddr);
return(privkey);
}
@ -567,6 +570,7 @@ void jumblr_utxoupdate(struct supernet_info *myinfo,struct iguana_info *coin,dou
char *retstr; cJSON *array,*item; int32_t i,n,vout; bits256 txid,splittxid; uint64_t value;
if ( (retstr= _dex_listunspent(myinfo,coin->symbol,coinaddr)) != 0 )
{
printf("%s.(%s)\n",coin->symbol,retstr);
if ( (array= cJSON_Parse(retstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
@ -601,16 +605,21 @@ void jumblr_DEXupdate(struct supernet_info *myinfo,struct iguana_info *coin,char
safecopy(ptr->symbol,symbol,sizeof(ptr->symbol));
safecopy(ptr->CMCname,CMCname,sizeof(ptr->CMCname));
}
if ( ptr->depositaddr[0] == 0 )
//if ( ptr->depositaddr[0] == 0 )
{
if ( strcmp("KMD",symbol) == 0 )
ptr->deposit_privkey = jumblr_privkey(myinfo,ptr->depositaddr,0,ptr->KMDdepositaddr,JUMBLR_DEPOSITPREFIX);
else ptr->deposit_privkey = jumblr_privkey(myinfo,ptr->depositaddr,ptr->coin->chain->pubtype,ptr->KMDdepositaddr,JUMBLR_DEPOSITPREFIX);
}
if ( ptr->jumblraddr[0] == 0 )
ptr->jumblr_privkey = jumblr_privkey(myinfo,ptr->jumblraddr,ptr->coin->chain->pubtype,ptr->KMDjumblraddr,"");
//if ( ptr->jumblraddr[0] == 0 )
{
if ( strcmp("KMD",symbol) == 0 )
ptr->jumblr_privkey = jumblr_privkey(myinfo,ptr->jumblraddr,0,ptr->KMDjumblraddr,"");
else ptr->jumblr_privkey = jumblr_privkey(myinfo,ptr->jumblraddr,ptr->coin->chain->pubtype,ptr->KMDjumblraddr,"");
}
ptr->avail = dstr(jumblr_balance(myinfo,ptr->coin,ptr->depositaddr));
ptr->btcprice = get_theoretical(&avebid,&aveask,&highbid,&lowask,&CMC_average,changes,CMCname,symbol,"BTC",&ptr->USD_average);
printf("%s avail %.8f btcprice %.8f deposit.(%s %s) -> jumblr.(%s %s)\n",symbol,ptr->avail,ptr->btcprice,ptr->depositaddr,ptr->KMDdepositaddr,ptr->jumblraddr,ptr->KMDjumblraddr);
if ( strcmp("KMD",symbol) == 0 )
{
ptr->BTC2KMD = ptr->btcprice;
@ -627,7 +636,7 @@ void jumblr_DEXupdate(struct supernet_info *myinfo,struct iguana_info *coin,char
jumblr_utxoupdate(myinfo,ptr->coin,ptr->kmdprice,ptr->depositaddr);
}
ptr->lasttime = (uint32_t)time(NULL);
}
} else printf("skip\n");
}
void jumblr_CMCname(char *CMCname,char *symbol)

2
iguana/exchanges/bittrex.c

@ -169,7 +169,7 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha
if ( //CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 &&
(json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,payload,payload)) != 0 )
{
if ( *retstrp != 0 )
if ( 0 && *retstrp != 0 )
printf("SIGNPOST returned.(%s) %s\n",*retstrp,jprint(json,0));
if ( is_cJSON_True(cJSON_GetObjectItem(json,"success")) != 0 && (resultobj= cJSON_GetObjectItem(json,"result")) != 0 )
{

15
iguana/main.c

@ -753,17 +753,20 @@ void jumblr_loop(void *ptr)
printf("JUMBLR loop\n");
while ( 1 )
{
if ( myinfo->jumblr_passphrase[0] != 0 && (coin= iguana_coinfind("KMD")) != 0 && coin->FULLNODE < 0 )
if ( (coin= iguana_coinfind("KMD")) != 0 )
{
// if BTC has arrived in destination address, invoke DEX -> BTC
jumblr_DEXcheck(myinfo,coin);
t = (uint32_t)time(NULL);
if ( (t % (120 * mult)) < 60 )
if ( myinfo->jumblr_passphrase[0] != 0 && coin->FULLNODE < 0 )
{
// if BTC has arrived in deposit address, invoke DEX -> KMD
jumblr_iteration(myinfo,coin,(t % (360 * mult)) / (120 * mult),t % (120 * mult));
t = (uint32_t)time(NULL);
if ( (t % (120 * mult)) < 60 )
{
// if BTC has arrived in deposit address, invoke DEX -> KMD
jumblr_iteration(myinfo,coin,(t % (360 * mult)) / (120 * mult),t % (120 * mult));
}
//printf("t.%u %p.%d %s\n",t,coin,coin!=0?coin->FULLNODE:0,myinfo->jumblr_passphrase);
}
//printf("t.%u %p.%d %s\n",t,coin,coin!=0?coin->FULLNODE:0,myinfo->jumblr_passphrase);
}
sleep(55);
}

4
iguana/wp

@ -0,0 +1,4 @@
#!/bin/bash
#curl --url "http://127.0.0.1:7778" --data "{\"method\":\"walletpassphrase\",\"params\":[\"test\", 600]}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"walletpassphrase\",\"password\":\"3809853923098test\",\"timeout\":86444}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"jumblr\",\"method\":\"setpassphrase\",\"passphrase\":\"jumblr 3809853923098test\"}"
Loading…
Cancel
Save