Browse Source

Test

etomic
jl777 7 years ago
parent
commit
4a89d15097
  1. 5
      iguana/exchanges/LP_etomic.c
  2. 7
      iguana/exchanges/LP_privkey.c

5
iguana/exchanges/LP_etomic.c

@ -65,7 +65,6 @@ int32_t LP_etomic_priv2addr(char *coinaddr,bits256 privkey)
bits256_str(str,privkey);
if ( (addrstr= privKey2Addr(str)) != 0 )
{
printf("priv2addr got %s\n",addrstr);
strcpy(coinaddr,addrstr);
free(addrstr);
return(0);
@ -82,7 +81,7 @@ int32_t LP_etomic_priv2pub(uint8_t *pub64,bits256 privkey)
if ( strlen(pubstr) == 130 && pubstr[0] == '0' && pubstr[1] == 'x' )
{
decode_hex(pub64,64,pubstr+2);
retval = 64;
retval = 0;
}
free(pubstr);
}
@ -98,7 +97,7 @@ int32_t LP_etomic_pub2addr(char *coinaddr,uint8_t pub64[64])
{
strcpy(coinaddr,addrstr);
free(addrstr);
return((int32_t)strlen(coinaddr));
return(0);
}
return(-1);
}

7
iguana/exchanges/LP_privkey.c

@ -296,15 +296,14 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan
bitcoin_priv2pub(ctx,coin->symbol,coin->pubkey33,coin->smartaddr,privkey,coin->taddr,coin->pubtype);
{
uint8_t check64[64]; char checkaddr[64],checkaddr2[64];
if ( LP_etomic_priv2pub(check64,privkey) > 0 )
if ( LP_etomic_priv2pub(check64,privkey) == 0 )
{
if ( memcmp(check64,coin->pubkey33+1,32) == 0 )
{
if ( LP_etomic_priv2addr(checkaddr2,privkey) > 0 && LP_etomic_pub2addr(checkaddr,check64) > 0 && strcmp(checkaddr2,checkaddr) == 0 )
if ( LP_etomic_priv2addr(checkaddr,privkey) == 0 && LP_etomic_pub2addr(checkaddr2,check64) == 0 && strcmp(checkaddr,checkaddr2) == 0 )
{
printf("addr is (%s)\n",checkaddr);
}
else printf("error getting addr\n");
} else printf("error getting addr (%s) != (%s)\n",checkaddr,checkaddr2);
} else printf("pubkey 64 mismatch\n");
} else printf("error creating pubkey\n");
}

Loading…
Cancel
Save