Skip to content

Commit

Permalink
shorten lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 25, 2023
1 parent 7c26fb4 commit 6f3e107
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/state/mpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,13 @@ void MPTNode::insert(const Path& path, bytes&& value) // NOLINT(misc-no-recursi
}
}

static bytes shorten(bytes&& b)
{
if (b.size() < 32)
return std::move(b);
return rlp::encode(keccak256(b));
}

bytes MPTNode::encode() const // NOLINT(misc-no-recursion)
{
static constexpr auto shorten = [](bytes&& b) {
return (b.size() < 32) ? std::move(b) : rlp::encode(keccak256(b));
};

switch (m_kind)
{
case Kind::leaf:
Expand Down

0 comments on commit 6f3e107

Please sign in to comment.