diff --git a/Testpool.sol b/Testpool.sol index 9c10e58..ea64b5e 100644 --- a/Testpool.sol +++ b/Testpool.sol @@ -819,14 +819,10 @@ library RLP { /// @param self The RLPItem. /// @return The decoded string. function toAddress(RLPItem memory self) internal constant returns (address data) { - if(!isData(self)) - throw; - var (rStartPos, len) = _decode(self); - if (len != 20) + var (, len) = _decode(self); + if (len > 20) throw; - assembly { - data := div(mload(rStartPos), exp(256, 12)) - } + return address(toUint(self)); } // Get the payload offset.