aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}