Browse Source

Test

etomic
jl777 7 years ago
parent
commit
4e168fd9a0
  1. 8
      iguana/exchanges/LP_bitcoin.c
  2. 4
      iguana/exchanges/LP_privkey.c

8
iguana/exchanges/LP_bitcoin.c

@ -2144,7 +2144,13 @@ int32_t bitcoin_wif2priv(uint8_t wiftaddr,uint8_t *addrtypep,bits256 *privkeyp,c
if ( (len= bitcoin_base58decode(buf,wifstr)) >= 4 )
{
// validate with trailing hash, then remove hash
ptr = buf;
if ( len <= 38 )
ptr = buf;
else if ( buf[0] == 0 )
{
ptr = buf+1;
len--;
} else ptr = buf;
hash = bits256_doublesha256(0,ptr,len - 4);
*addrtypep = (wiftaddr == 0) ? *ptr : ptr[1];
memcpy(privkeyp,ptr+offset,32);

4
iguana/exchanges/LP_privkey.c

@ -382,10 +382,10 @@ void LP_privkey_tests()
privkey = rand256(0);
bitcoin_priv2wif(0,wifstr,privkey,0);
bitcoin_wif2priv(0,&tmptype,&checkkey,wifstr);
//if ( bits256_cmp(privkey,checkkey) != 0 )
if ( bits256_cmp(privkey,checkkey) != 0 )
{
printf("i.%d: %s vs %s\n",i,bits256_str(str,privkey),bits256_str(str2,checkkey));
//exit(-1);
exit(-1);
}
if ( (i % 1000000) == 0 )
fprintf(stderr,"%.1f%% ",100.*(double)i/10000000);

Loading…
Cancel
Save