Browse Source

Test

etomic
jl777 7 years ago
parent
commit
0c0cd829a1
  1. 9
      iguana/exchanges/LP_bitcoin.c

9
iguana/exchanges/LP_bitcoin.c

@ -2150,16 +2150,17 @@ int32_t bitcoin_wif2priv(uint8_t wiftaddr,uint8_t *addrtypep,bits256 *privkeyp,c
printf("wif %s -> buf too short len.%d\n",wifstr,len);
return(-1);
}
ptr = buf;
if ( len < 38 )
{
memset(pbuf,0,sizeof(pbuf));
/*memset(pbuf,0,sizeof(pbuf));
memcpy(pbuf+(38-len),buf,len);
ptr = pbuf;
int32_t i; for (i=0; i<38; i++)
printf("%02x ",pbuf[i]);
printf("pbuf from %d\n",len);
len += (38-len);
} else ptr = buf;
len += (38-len);*/
}
hash = bits256_doublesha256(0,ptr,len - 4);
*addrtypep = (wiftaddr == 0) ? *ptr : ptr[1];
if ( (ptr[len - 4]&0xff) == hash.bytes[31] && (ptr[len - 3]&0xff) == hash.bytes[30] &&(ptr[len - 2]&0xff) == hash.bytes[29] && (ptr[len - 1]&0xff) == hash.bytes[28] )
@ -2173,7 +2174,7 @@ int32_t bitcoin_wif2priv(uint8_t wiftaddr,uint8_t *addrtypep,bits256 *privkeyp,c
else
{
int32_t i; for (i=0; i<len; i++)
printf("%02x ",ptr[i]);
printf("%02x ",buf[i]);
printf(" buf, hash.%02x %02x %02x %02x len.%d\n",hash.bytes[28],hash.bytes[29],hash.bytes[30],hash.bytes[31],len);
}
}

Loading…
Cancel
Save