Browse Source

Test

etomic
jl777 7 years ago
parent
commit
d1e955e070
  1. 7
      iguana/exchanges/LP_bitcoin.c
  2. 2
      iguana/exchanges/mm.c

7
iguana/exchanges/LP_bitcoin.c

@ -2196,7 +2196,12 @@ 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) int32_t bitcoin_priv2wif(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8_t addrtype)
{ {
uint8_t data[128]; int32_t offset,len = 32; uint8_t data[128]; int32_t offset,len = 32;
offset = 1 + (wiftaddr != 0); data[0] = wiftaddr;
if ( wiftaddr != 0 )
{
data[1] = addrtype;
offset = 2;
} else offset = 1;
memcpy(data+offset,privkey.bytes,sizeof(privkey)); memcpy(data+offset,privkey.bytes,sizeof(privkey));
data[offset + len++] = 1; data[offset + len++] = 1;
len = base58encode_checkbuf(wiftaddr,addrtype,data,len); len = base58encode_checkbuf(wiftaddr,addrtype,data,len);

2
iguana/exchanges/mm.c

@ -117,7 +117,7 @@ int main(int argc, const char * argv[])
for (i=0; i<1000000000; i++) for (i=0; i<1000000000; i++)
{ {
privkey = rand256(0); privkey = rand256(0);
bitcoin_priv2wif(0xab,wifstr,privkey,0x36); bitcoin_priv2wif(0x36,wifstr,privkey,0xab);
if ( wifstr[4] == 'h' && wifstr[5] == 'u' && wifstr[6] == 's' ) if ( wifstr[4] == 'h' && wifstr[5] == 'u' && wifstr[6] == 's' )
{ {
printf("i.%d %s -> wif.%s\n",i,bits256_str(str,privkey),wifstr); printf("i.%d %s -> wif.%s\n",i,bits256_str(str,privkey),wifstr);

Loading…
Cancel
Save