Browse Source

Test

etomic
jl777 8 years ago
parent
commit
2128529609
  1. 2
      .gitignore
  2. 28
      basilisk/basilisk_swap.c
  3. 14
      basilisk/jumblr.c
  4. 1
      iguana/DB/SWAPS/3448271011-3628813832
  5. 1
      iguana/DB/SWAPS/403615495-1237768524

2
.gitignore

@ -316,3 +316,5 @@ iguana/DB/SWAPS/3193054754-2514575257
iguana/DB/SWAPS/3004995589-1950720855
iguana/3193054754-2514575257
iguana/DB/SWAPS/2912654530-2125064238

28
basilisk/basilisk_swap.c

@ -188,9 +188,9 @@ int32_t basilisk_swap_bobredeemscript(int32_t depositflag,int32_t *secretstartp,
secret160 = secretAm;
secret256 = secretAm256;
}
//for (i=0; i<32; i++)
// printf("%02x",secret256[i]);
//printf(" <- secret256 depositflag.%d\n",depositflag);
for (i=0; i<32; i++)
printf("%02x",secret256[i]);
printf(" <- secret256 depositflag.%d nonz.%d\n",depositflag,bits256_nonz(privkey));
if ( bits256_nonz(cltvpub) == 0 || bits256_nonz(destpub) == 0 )
return(-1);
for (i=0; i<20; i++)
@ -217,17 +217,17 @@ int32_t basilisk_swap_bobredeemscript(int32_t depositflag,int32_t *secretstartp,
uint8_t bufA[20],bufB[20];
revcalc_rmd160_sha256(bufA,privkey);
calc_rmd160_sha256(bufB,privkey.bytes,sizeof(privkey));
/*if ( memcmp(bufA,secret160,sizeof(bufA)) == 0 )
printf("MATCHES BUFA\n");
else if ( memcmp(bufB,secret160,sizeof(bufB)) == 0 )
printf("MATCHES BUFB\n");
else printf("secret160 matches neither\n");
for (i=0; i<20; i++)
printf("%02x",bufA[i]);
printf(" <- revcalc\n");
for (i=0; i<20; i++)
printf("%02x",bufB[i]);
printf(" <- calc\n");*/
if ( memcmp(bufA,secret160,sizeof(bufA)) == 0 )
printf("MATCHES BUFA\n");
else if ( memcmp(bufB,secret160,sizeof(bufB)) == 0 )
printf("MATCHES BUFB\n");
else printf("secret160 matches neither\n");
for (i=0; i<20; i++)
printf("%02x",bufA[i]);
printf(" <- revcalc\n");
for (i=0; i<20; i++)
printf("%02x",bufB[i]);
printf(" <- calc\n");
memcpy(secret160,bufB,20);
}
n = bitcoin_secret160verify(redeemscript,n,secret160);

14
basilisk/jumblr.c

@ -714,11 +714,13 @@ void jumblr_CMCname(char *CMCname,char *symbol)
void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin,int32_t toKMD)
{
double vol,avail; struct iguana_info *kmdcoin,*coinbtc = 0;
kmdcoin = iguana_coinfind("KMD");
coinbtc = iguana_coinfind("BTC");
printf("jumblr_DEXcheck numswaps.%d notary.%d IAMLP.%d %p %p %f\n",myinfo->numswaps,myinfo->IAMNOTARY,myinfo->IAMLP,kmdcoin,coinbtc,kmdcoin->DEXinfo.btcprice);
if ( myinfo->IAMNOTARY != 0 || myinfo->IAMLP != 0 )
return;
if ( (kmdcoin= iguana_coinfind("KMD")) == 0 || (coinbtc= iguana_coinfind("BTC")) == 0 )
if ( kmdcoin == 0 || coinbtc == 0 )
return;
//printf("jumblr_DEXcheck\n");
jumblr_DEXupdate(myinfo,kmdcoin,"KMD","komodo",0.,0.);
if ( strcmp(coin->symbol,"KMD") != 0 && kmdcoin->DEXinfo.btcprice > 0. )
{
@ -749,7 +751,7 @@ void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin,int32
jaddstr(vals,"source","BTC");
jaddstr(vals,"dest","KMD");
jaddnum(vals,"amount",vol);
jaddnum(vals,"minprice",1./(1.03 * kmdcoin->DEXinfo.btcprice));
jaddnum(vals,"minprice",1./(1.05 * kmdcoin->DEXinfo.btcprice));
jaddnum(vals,"usejumblr",1);
jaddnum(vals,"DEXselector",1);
memset(hash.bytes,0,sizeof(hash));
@ -781,7 +783,7 @@ void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin,int32
jaddstr(vals,"dest","BTC");
jaddnum(vals,"amount",vol);
//jaddnum(vals,"destamount",JUMBLR_INCR*kmdcoin->DEXinfo.btcprice);
jaddnum(vals,"minprice",kmdcoin->DEXinfo.btcprice/1.03);
jaddnum(vals,"minprice",kmdcoin->DEXinfo.btcprice/1.05);
jaddnum(vals,"usejumblr",1);
memset(hash.bytes,0,sizeof(hash));
kmdcoin->DEXinfo.KMDpending += vol;
@ -793,8 +795,8 @@ void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin,int32
}
free_json(vals);
}
} //else printf("btcavail %.8f pending %.8f\n",btcavail,pending);
} //else printf("notlp.%d kmdprice %.8f\n",myinfo->IAMLP,kmdcoin->DEXinfo.btcprice);
} else printf("btcavail %.8f pending %.8f\n",btcavail,kmdcoin->DEXinfo.KMDpending);
} else printf("notlp.%d kmdprice %.8f\n",myinfo->IAMLP,kmdcoin->DEXinfo.btcprice);
}
void jumblr_iteration(struct supernet_info *myinfo,struct iguana_info *coin,int32_t selector,int32_t modval)

1
iguana/DB/SWAPS/3448271011-3628813832

@ -0,0 +1 @@
{"src":"BTC","srcamount":0.01438678,"dest":"KMD","destamount":117.03798516,"requestid":3448271011,"quoteid":3628813832,"iambob":0,"state":eff,"otherstate":31bf,"expiration":1492020667,"dlocktime":1492020684,"plocktime":1492012884,"Bdeposit":"1a520ea71ab9ba336fb0f856584a821bad1e18e4c38903239c48767661d88b8a","Bpayment":"94f89299746bd5f922bf1b2e4b2ed6ff20f283097404b222b974ec3817102ee3","Apayment":"a19713d5af24960cb46291a6c6299c55f09fa0234eb4b5d3c1bf19f582db1beb","myfee":"04c03c66e57abdbee650d76c82f1b0ca18cbacd722d201e445f47843041a3ecf","dest33":"0231a71ac00aed93b79f5b751d6b498cb1151314a18607328d5e79aec71deac205"}

1
iguana/DB/SWAPS/403615495-1237768524

@ -0,0 +1 @@
{"src":"BTC","srcamount":0.01410523,"dest":"KMD","destamount":118.62156235,"requestid":403615495,"quoteid":1237768524,"iambob":0,"state":eff,"otherstate":31bf,"expiration":1492019879,"dlocktime":1492019880,"plocktime":1492012080,"Bdeposit":"8d2a84a5f6acfaeee96fad7e9a613a08768f0b1455acd50912447361dd94c90b","Bpayment":"2ea1d52713cf4871047406d2a6cbbdbf783b8a3a457cb8fe03ad224382742ff5","Apayment":"acced616731fe15ddd3cd219b0f33a41ec382825ed968905e25cff555f74c660","myfee":"1de9e50a8758b032be8eb47cdea688e326bf9fa174eb92bce8e0ebf5faba4ebe","dest33":"0231a71ac00aed93b79f5b751d6b498cb1151314a18607328d5e79aec71deac205"}
Loading…
Cancel
Save