aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-09 15:12:04 +0800
committerchriseth <chris@ethereum.org>2018-10-12 21:15:02 +0800
commit914668c622b60eab4129d0a6b3776c20d8e614bd (patch)
tree50ae4283d7966b7f63e6ba66c3df2afb96629008 /libdevcore
parent95d3e7feb39e896bf499e816a8cf037b7fdff62d (diff)
downloaddexon-solidity-914668c622b60eab4129d0a6b3776c20d8e614bd.tar.gz
dexon-solidity-914668c622b60eab4129d0a6b3776c20d8e614bd.tar.zst
dexon-solidity-914668c622b60eab4129d0a6b3776c20d8e614bd.zip
Fix checksum check.
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/CommonData.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libdevcore/CommonData.cpp b/libdevcore/CommonData.cpp
index 445d11cd..6d7c74d7 100644
--- a/libdevcore/CommonData.cpp
+++ b/libdevcore/CommonData.cpp
@@ -76,18 +76,18 @@ bytes dev::fromHex(std::string const& _s, WhenError _throw)
bool dev::passesAddressChecksum(string const& _str, bool _strict)
{
- string s = _str.substr(0, 2) == "0x" ? _str.substr(2) : _str;
+ string s = _str.substr(0, 2) == "0x" ? _str : "0x" + _str;
- if (s.length() != 40)
+ if (s.length() != 42)
return false;
if (!_strict && (
- _str.find_first_of("abcdef") == string::npos ||
- _str.find_first_of("ABCDEF") == string::npos
+ s.find_first_of("abcdef") == string::npos ||
+ s.find_first_of("ABCDEF") == string::npos
))
return true;
- return _str == dev::getChecksummedAddress(_str);
+ return s == dev::getChecksummedAddress(s);
}
string dev::getChecksummedAddress(string const& _addr)