jl777 7 years ago
parent
commit
bfea97b1e9
  1. 8
      iguana/exchanges/LP_bitcoin.c
  2. 4
      iguana/exchanges/LP_nativeDEX.c

8
iguana/exchanges/LP_bitcoin.c

@ -2020,7 +2020,7 @@ char *bitcoind_passthrut(char *coinstr,char *serverport,char *userpass,char *met
int32_t bitcoin_addr2rmd160(char *symbol,uint8_t taddr,uint8_t *addrtypep,uint8_t rmd160[20],char *coinaddr)
{
bits256 hash; uint8_t *buf,_buf[26],data5[128]; char prefixaddr[64],hrp[64]; int32_t len,len5,offset;
bits256 hash; uint8_t *buf,_buf[26],data5[128],rmd21[21]; char prefixaddr[64],hrp[64]; int32_t len,len5,offset;
if ( strcmp(symbol,"BCH") == 0 && strlen(coinaddr) == 42 )
{
strcpy(prefixaddr,"bitcoincash:");
@ -2030,6 +2030,12 @@ int32_t bitcoin_addr2rmd160(char *symbol,uint8_t taddr,uint8_t *addrtypep,uint8_
printf("bitcoin_addr2rmd160 bech32_decode error.(%s)\n",coinaddr);
return(0);
}
len = 0;
if ( bech32_convert_bits(rmd21,&len,8,data5,len5,5,0) == 0 )
printf("error converting data5\n");
*addrtypep = rmd21[0] == 0 ? 0 : 5;
memcpy(rmd160,&rmd21[1],20);
return(20);
}
else if ( strcmp(symbol,"GRS") == 0 )
{

4
iguana/exchanges/LP_nativeDEX.c

@ -745,6 +745,10 @@ void bech32_tests()
}
else
{
bitcoin_addr2rmd160("BCH",0,&addrtype,rmd160,"qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy");
for (i=0; i<20; i++)
printf("%02x",rmd160[i]);
printf("addr2rmd160 %d\n",addrtype);
data_len2 = 0;
if ( bech32_convert_bits(data2,&data_len2,8,data,data_len,5,0) == 0 )
printf("error converting data5\n");

Loading…
Cancel
Save