Browse Source

Test

etomic
jl777 7 years ago
parent
commit
4409e88574
  1. 5
      iguana/exchanges/LP_bitcoin.c
  2. 2
      iguana/exchanges/LP_privkey.c

5
iguana/exchanges/LP_bitcoin.c

@ -2195,12 +2195,15 @@ int32_t bitcoin_wif2addr(void *ctx,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtyp
int32_t bitcoin_priv2wif(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8_t addrtype)
{
uint8_t data[128]; int32_t offset,len = 32;
memcpy(data+1,privkey.bytes,sizeof(privkey));
offset = 1 + (wiftaddr != 0);
memcpy(data+offset,privkey.bytes,sizeof(privkey));
data[offset + len++] = 1;
len = base58encode_checkbuf(wiftaddr,addrtype,data,len);
if ( bitcoin_base58encode(wifstr,data,len) == 0 )
{
char str[65]; printf("error making wif from %s\n",bits256_str(str,privkey));
return(-1);
}
if ( 1 )
{
uint8_t checktype; bits256 checkpriv; char str[65],str2[65];

2
iguana/exchanges/LP_privkey.c

@ -209,6 +209,8 @@ int32_t LP_wifstr_valid(char *wifstr)
{
bitcoin_wif2priv(0,&wiftype,&privkey,wifstr);
bitcoin_priv2wif(0,cmpstr,privkey,wiftype);
char str[65]; printf("%s -> %s -> %s\n",wifstr,bits256_str(str,privkey),cmpstr);
return(1);
if ( strcmp(cmpstr,wifstr) == 0 )
{
//printf("%s is valid wif\n",wifstr);

Loading…
Cancel
Save