Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions contracts/RLP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,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.
Expand Down Expand Up @@ -411,4 +407,4 @@ library RLP {
return false;
return true;
}
}
}