Browse Source

Test

etomic
jl777 7 years ago
parent
commit
f08b7700ed
  1. 1
      etomic_build/run
  2. 43
      iguana/exchanges/LP_etomic.c
  3. 12
      iguana/exchanges/LP_privkey.c

1
etomic_build/run

@ -1,4 +1,5 @@
#!/bin/bash
source passphrase
source coins
./stop
$1 iguana/exchanges/marketmaker "{\"netid\":9999,\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" &

43
iguana/exchanges/LP_etomic.c

@ -58,3 +58,46 @@ char *LP_etomicalice_start(struct basilisk_swap *swap)
}
return(0);
}
int32_t LP_etomic_priv2addr(char *coinaddr,bits256 privkey)
{
char str[65],*addrstr;
bits256_str(str,privkey);
if ( (addrstr= privKey2Addr(str)) != 0 )
{
strcpy(coinaddr,addrstr);
free(addrstr);
return(0);
}
return(-1);
}
int32_t LP_etomic_priv2pub(uint8_t *pub33,bits256 privkey)
{
char *pubstr,str[65]; int32_t retval = -1;
bits256_str(str,privkey);
if ( (pubstr= getPubKeyFromPriv(str)) != 0 )
{
if ( strlen(pubstr) == 35 && pubstr[0] == '0' && pubstr[1] == 'x' )
{
decode_hex(pub33,33,pubstr+2);
retval = 33;
}
free(pubstr);
}
return(retval);
}
int32_t LP_etomic_pub2addr(char *coinaddr,uint8_t pub33[33])
{
char pubkeystr[72],*addrstr;
strcpy(pubkeystr,"0x");
init_hexbytes_noT(pubkeystr+2,pub33,33);
if ( (addrstr= pubKey2Addr(pubkeystr+2)) != 0 )
{
strcpy(coinaddr,addrstr);
free(addrstr);
return((int32_t)strlen(coinaddr));
}
return(-1);
}

12
iguana/exchanges/LP_privkey.c

@ -294,6 +294,18 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan
RS_encode(G.LP_NXTaddr,nxtaddr);
}
bitcoin_priv2pub(ctx,coin->symbol,coin->pubkey33,coin->smartaddr,privkey,coin->taddr,coin->pubtype);
{
uint8_t check33[33]; char checkaddr[64];
if ( LP_etomic_priv2pub(check33,privkey) > 0 )
{
if ( memcmp(check33,coin->pubkey33) == 0 )
{
printf("pubkey33 matches!\n");
if ( LP_etomic_pub2addr(checkaddr,check33) > 0 )
printf("addr is (%s)\n",checkaddr);
} else printf("pubkey 33 mismatch\n");
}
}
if ( coin->counter == 0 )
{
coin->counter++;

Loading…
Cancel
Save