[storage] Simplify accumulator append
[storage] Simplify accumulator append

Make the accumulator append operation create frozen nodes in perfect
post order.  This generates all leaf nodes before their parents and
all parents as soon as they are immediately frozen.  The idea is
simply to walk up the tree while there the current node is a right
child, and then reconstruct the hash at the end.

Code simplification suggestions appreciated; I didn't like having
almost the same loop twice.  Unfortunately, more functional methods
like `left_children.pop().map_or_else(|| self.reader.get(key)?, ...`
fail because the error result can't be returned to the main body
from the closure.  So a match is used instead.

Updated: I tried both ways, not sure which is cleaner.  Comments
welcome.

Closes: #1047
Approved by: zamsden

libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core