aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast/AST.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-10-24 18:01:56 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-11-17 08:46:45 +0800
commit8d26894841d7b5897b7c6f126f6ea1b8293ab5a2 (patch)
tree4c4dd42dee9d0770b9dbe27cb44cd4090deeef0b /libsolidity/ast/AST.cpp
parent1d5dd909b4ed8625330e9ec859e02dfd067f4006 (diff)
downloaddexon-solidity-8d26894841d7b5897b7c6f126f6ea1b8293ab5a2.tar.gz
dexon-solidity-8d26894841d7b5897b7c6f126f6ea1b8293ab5a2.tar.zst
dexon-solidity-8d26894841d7b5897b7c6f126f6ea1b8293ab5a2.zip
Show checksummed address always (prepend with 0)
Diffstat (limited to 'libsolidity/ast/AST.cpp')
-rw-r--r--libsolidity/ast/AST.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index 62507093..8da6964e 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -587,7 +587,10 @@ bool Literal::passesAddressChecksum() const
std::string Literal::getChecksummedAddress() const
{
solAssert(isHexNumber(), "Expected hex number");
- if (value().length != 42)
+ /// Pad literal to be a proper hex address.
+ string address = value().substr(2);
+ if (address.length() > 40)
return string();
- return dev::getChecksummedAddress(value());
+ address.insert(address.begin(), 40 - address.size(), '0');
+ return dev::getChecksummedAddress(address);
}