Commit facbd5cd authored by George Hotz's avatar George Hotz

fix write from new bug

parent 7c69d530
...@@ -80,7 +80,7 @@ library Lib_MerkleTrie { ...@@ -80,7 +80,7 @@ library Lib_MerkleTrie {
{ {
// Special case when inserting the very first node. // Special case when inserting the very first node.
if (_root == KECCAK256_RLP_NULL_BYTES) { if (_root == KECCAK256_RLP_NULL_BYTES) {
return getSingleNodeRootHash(_key, _value); return getSingleNodeRootHash(_key, _value, trie);
} }
(TrieNode[] memory proof, uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(trie, _key, _root); (TrieNode[] memory proof, uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(trie, _key, _root);
...@@ -147,18 +147,20 @@ library Lib_MerkleTrie { ...@@ -147,18 +147,20 @@ library Lib_MerkleTrie {
*/ */
function getSingleNodeRootHash( function getSingleNodeRootHash(
bytes memory _key, bytes memory _key,
bytes memory _value bytes memory _value,
mapping(bytes32 => bytes) storage trie
) )
internal internal
pure
returns ( returns (
bytes32 _updatedRoot bytes32 _updatedRoot
) )
{ {
return keccak256(_makeLeafNode( bytes memory dat = _makeLeafNode(
Lib_BytesUtils.toNibbles(_key), Lib_BytesUtils.toNibbles(_key),
_value _value).encoded;
).encoded); bytes32 ret = keccak256(dat);
trie[ret] = dat;
return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment