From 8d26894841d7b5897b7c6f126f6ea1b8293ab5a2 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 24 Oct 2017 11:01:56 +0100 Subject: Show checksummed address always (prepend with 0) --- libsolidity/ast/AST.cpp | 7 +++++-- 1 file 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); } -- cgit v1.2.3