Browse Source

Prevent withdraw to other coin's address

etomic
jl777 7 years ago
parent
commit
09d992d272
  1. 9
      iguana/exchanges/LP_rpc.c

9
iguana/exchanges/LP_rpc.c

@ -301,7 +301,12 @@ cJSON *LP_validateaddress(char *symbol,char *address)
jaddstr(retjson,"address",address); jaddstr(retjson,"address",address);
bitcoin_addr2rmd160(coin->taddr,&addrtype,rmd160,address); bitcoin_addr2rmd160(coin->taddr,&addrtype,rmd160,address);
bitcoin_address(checkaddr,coin->taddr,addrtype,rmd160,20); bitcoin_address(checkaddr,coin->taddr,addrtype,rmd160,20);
jadd(retjson,"isvalid",strcmp(address,checkaddr)==0? cJSON_CreateTrue() : cJSON_CreateFalse()); if ( addrtype != coin->pubtype && addrtype != coin->p2shtype )
{
jadd(retjson,"isvalid",cJSON_CreateFalse());
return(retjson);
}
jadd(retjson,"isvalid",strcmp(address,checkaddr)==0 ? cJSON_CreateTrue() : cJSON_CreateFalse());
if ( addrtype == coin->pubtype ) if ( addrtype == coin->pubtype )
{ {
strcpy(script,"76a914"); strcpy(script,"76a914");
@ -312,7 +317,7 @@ cJSON *LP_validateaddress(char *symbol,char *address)
jaddstr(retjson,"scriptPubKey",script); jaddstr(retjson,"scriptPubKey",script);
} }
bitcoin_address(coinaddr,coin->taddr,coin->pubtype,G.LP_myrmd160,20); bitcoin_address(coinaddr,coin->taddr,coin->pubtype,G.LP_myrmd160,20);
jadd(retjson,"ismine",strcmp(address,coin->smartaddr) == 0 ? cJSON_CreateTrue() : cJSON_CreateFalse()); jadd(retjson,"ismine",strcmp(coinaddr,coin->smartaddr) == 0 ? cJSON_CreateTrue() : cJSON_CreateFalse());
jadd(retjson,"iswatchonly",cJSON_CreateTrue()); jadd(retjson,"iswatchonly",cJSON_CreateTrue());
jadd(retjson,"isscript",addrtype == coin->p2shtype ? cJSON_CreateTrue() : cJSON_CreateFalse()); jadd(retjson,"isscript",addrtype == coin->p2shtype ? cJSON_CreateTrue() : cJSON_CreateFalse());
return(retjson); return(retjson);

Loading…
Cancel
Save