diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index a58fa66ba..a34c60e51 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/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) { 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)); data[offset + len++] = 1; len = base58encode_checkbuf(wiftaddr,addrtype,data,len); diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index f60829a4a..e281a5984 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -117,7 +117,7 @@ int main(int argc, const char * argv[]) for (i=0; i<1000000000; i++) { 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' ) { printf("i.%d %s -> wif.%s\n",i,bits256_str(str,privkey),wifstr);