From b7e3a51f35ca2e97088328b00f9bafbace1b79cd Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 20 Dec 2017 21:11:14 +0700 Subject: [PATCH] Test --- iguana/exchanges/LP_privkey.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/iguana/exchanges/LP_privkey.c b/iguana/exchanges/LP_privkey.c index 50011779d..b52d7107c 100644 --- a/iguana/exchanges/LP_privkey.c +++ b/iguana/exchanges/LP_privkey.c @@ -243,11 +243,23 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan //vcalc_sha256(0,checkkey.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase)); //printf("SHA256.(%s) ",bits256_str(pstr,checkkey)); //printf("privkey.(%s)\n",bits256_str(pstr,privkey)); + bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,coin->wiftype); + bitcoin_wif2priv(coin->wiftaddr,&tmptype,&checkkey,tmpstr); + if ( bits256_cmp(privkey,checkkey) != 0 ) + { + char str[65],str2[65]; printf("mismatched privkeys from wif conversion: %s -> %s -> %s\n",bits256_str(str,privkey),tmpstr,bits256_str(str2,checkkey)); + exit(1); + } } else { bitcoin_wif2priv(coin->wiftaddr,&tmptype,&privkey,wifstr); bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,tmptype); + if ( strcmp(tmpstr,wifstr) != 0 ) + { + printf("error reproducing the wifstr, likely edge case like non-supported uncompressed pubkey\n"); + exit(1); + } tmpkey = privkey; nxtaddr = conv_NXTpassword(tmpkey.bytes,pubkeyp->bytes,0,0); RS_encode(G.LP_NXTaddr,nxtaddr);