From 05053f2502d25c857593df66c1697fb3b672197f Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 20 Dec 2017 20:54:11 +0700 Subject: [PATCH] Test --- iguana/exchanges/LP_bitcoin.c | 15 --------------- iguana/exchanges/LP_privkey.c | 11 +++++++---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index f4518ded8..7592976b5 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -2144,21 +2144,6 @@ 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 - /*if ( len < 38 ) - { - memset(pbuf,0,sizeof(pbuf)); - n = 1 + (wiftaddr!=0); - memcpy(pbuf,buf,n); - for (i=0; i 38\n",len); - } else*/ - //if ( len < 38 ) - // len = 38; ptr = buf; hash = bits256_doublesha256(0,ptr,len - 4); *addrtypep = (wiftaddr == 0) ? *ptr : ptr[1]; diff --git a/iguana/exchanges/LP_privkey.c b/iguana/exchanges/LP_privkey.c index d0d1e65d6..68be330ad 100644 --- a/iguana/exchanges/LP_privkey.c +++ b/iguana/exchanges/LP_privkey.c @@ -204,18 +204,21 @@ char *LP_secretaddresses(void *ctx,char *prefix,char *passphrase,int32_t n,uint8 int32_t LP_wifstr_valid(char *wifstr) { - bits256 privkey; uint8_t wiftype; char cmpstr[128]; int32_t iter; + bits256 privkey,cmpkey; uint8_t wiftype; char cmpstr[128]; int32_t iter; for (iter=0; iter<2; iter++) { 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); return(1); - } else printf("invalid wifstr.(%s) wiftype.%d cmpstr.%s\n",wifstr,wiftype,cmpstr); + } + else + { + bitcoin_wif2priv(0,&wiftype,&cmpkey,cmpstr); + char str[65],str2[65]; printf("invalid wifstr %s -> %s -> %s %s\n",wifstr,bits256_str(str,privkey),cmpstr,bits256_str(str2,cmpkey)); + } } return(0); }