mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-25 22:14:15 +00:00
setaccount should return if an invalid address is provided.
This prevents setaccount from creating new accounts which do not have any addresses.
This commit is contained in:
parent
f36b494aeb
commit
279ab5e62f
6
rpc.cpp
6
rpc.cpp
@ -381,6 +381,12 @@ Value setaccount(const Array& params, bool fHelp)
|
|||||||
"Sets the account associated with the given address.");
|
"Sets the account associated with the given address.");
|
||||||
|
|
||||||
string strAddress = params[0].get_str();
|
string strAddress = params[0].get_str();
|
||||||
|
uint160 hash160;
|
||||||
|
bool isValid = AddressToHash160(strAddress, hash160);
|
||||||
|
if (!isValid)
|
||||||
|
throw runtime_error("provided address is not valid");
|
||||||
|
|
||||||
|
|
||||||
string strAccount;
|
string strAccount;
|
||||||
if (params.size() > 1)
|
if (params.size() > 1)
|
||||||
strAccount = AccountFromValue(params[1]);
|
strAccount = AccountFromValue(params[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user