|
|
@ -321,7 +321,10 @@ cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_i |
|
|
|
{ |
|
|
|
HASH_ITER(hh,subset->waddr,waddr,tmp2) |
|
|
|
{ |
|
|
|
bitcoin_address(coinaddr,coin->chain->pubtype,waddr->rmd160,20); |
|
|
|
if (strcmp(coin->chain->symbol, "HUSH") == 0) |
|
|
|
bitcoin_address_ex(coin->chain->symbol, coinaddr, 0x1c, coin->chain->pubtype, waddr->rmd160, 20); |
|
|
|
else |
|
|
|
bitcoin_address(coinaddr, coin->chain->pubtype, waddr->rmd160, 20); |
|
|
|
printf("%s ",coinaddr); |
|
|
|
jaddistr(array,coinaddr); |
|
|
|
} |
|
|
@ -329,12 +332,20 @@ cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_i |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
bitcoin_address(refaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); |
|
|
|
HASH_ITER(hh,myinfo->wallet,subset,tmp) |
|
|
|
if (strcmp(coin->chain->symbol, "HUSH") == 0) |
|
|
|
bitcoin_address_ex(coin->chain->symbol, refaddr, 0x1c, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); |
|
|
|
else |
|
|
|
bitcoin_address(refaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); |
|
|
|
|
|
|
|
HASH_ITER(hh,myinfo->wallet,subset,tmp) |
|
|
|
{ |
|
|
|
HASH_ITER(hh,subset->waddr,waddr,tmp2) |
|
|
|
{ |
|
|
|
bitcoin_address(coinaddr,coin->chain->pubtype,waddr->rmd160,20); |
|
|
|
if (strcmp(coin->chain->symbol, "HUSH") == 0) |
|
|
|
bitcoin_address_ex(coin->chain->symbol, coinaddr, 0x1c, coin->chain->pubtype, waddr->rmd160, 20); |
|
|
|
else |
|
|
|
bitcoin_address(coinaddr, coin->chain->pubtype, waddr->rmd160, 20); |
|
|
|
|
|
|
|
jaddistr(array,coinaddr); |
|
|
|
if ( strcmp(coinaddr,refaddr) == 0 ) |
|
|
|
refaddr[0] = 0; |
|
|
@ -359,17 +370,36 @@ int32_t iguana_addressvalidate(struct iguana_info *coin,uint8_t *addrtypep,char |
|
|
|
char checkaddr[64]; uint8_t rmd160[20]; |
|
|
|
*addrtypep = 0; |
|
|
|
memset(rmd160,0,sizeof(rmd160)); |
|
|
|
bitcoin_addr2rmd160(addrtypep,rmd160,address); |
|
|
|
|
|
|
|
if (strcmp(coin->symbol, "HUSH") == 0) |
|
|
|
bitcoin_addr2rmd160_ex(coin->symbol, 0x1c, addrtypep, rmd160, address); |
|
|
|
else |
|
|
|
bitcoin_addr2rmd160(addrtypep,rmd160,address); |
|
|
|
|
|
|
|
//int32_t i; for (i=0; i<20; i++)
|
|
|
|
// printf("%02x",rmd160[i]); // 764692cd5473f62ffa8a93e55d876f567623de07
|
|
|
|
//printf(" rmd160 addrtype.%02x\n",*addrtypep);
|
|
|
|
if ( bitcoin_address(checkaddr,*addrtypep,rmd160,20) == checkaddr && strcmp(address,checkaddr) == 0 && (*addrtypep == coin->chain->pubtype || *addrtypep == coin->chain->p2shtype) ) |
|
|
|
return(0); |
|
|
|
else |
|
|
|
{ |
|
|
|
//printf(" checkaddr.(%s) address.(%s) type.%02x vs (%02x %02x)\n",checkaddr,address,*addrtypep,coin->chain->pubtype,coin->chain->p2shtype);
|
|
|
|
return(-1); |
|
|
|
} |
|
|
|
|
|
|
|
if (strcmp(coin->symbol, "HUSH") == 0) |
|
|
|
{ |
|
|
|
if (bitcoin_address_ex(coin->symbol, checkaddr, 0x1c, *addrtypep, rmd160, 20) == checkaddr && strcmp(address, checkaddr) == 0 && (*addrtypep == coin->chain->pubtype || *addrtypep == coin->chain->p2shtype)) |
|
|
|
return(0); |
|
|
|
else |
|
|
|
{ |
|
|
|
//printf(" checkaddr.(%s) address.(%s) type.%02x vs (%02x %02x)\n",checkaddr,address,*addrtypep,coin->chain->pubtype,coin->chain->p2shtype);
|
|
|
|
return(-1); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (bitcoin_address(checkaddr, *addrtypep, rmd160, 20) == checkaddr && strcmp(address, checkaddr) == 0 && (*addrtypep == coin->chain->pubtype || *addrtypep == coin->chain->p2shtype)) |
|
|
|
return(0); |
|
|
|
else |
|
|
|
{ |
|
|
|
//printf(" checkaddr.(%s) address.(%s) type.%02x vs (%02x %02x)\n",checkaddr,address,*addrtypep,coin->chain->pubtype,coin->chain->p2shtype);
|
|
|
|
return(-1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
cJSON *iguana_waddressjson(struct iguana_info *coin,cJSON *item,struct iguana_waddress *waddr) |
|
|
|