# Patricia Merkle tree

In the patricia merkle tree, each shortnode represent a key-value mapping which saved in DB.

Key = Hash(Value)

Value = rlp.encode(node)

There is question that if a node been updated and the node's value changed. When the node saved to DB, the key of the node change! But i didn't find any reorgnization tree code.

How does patricia merkle tree work during the node updating?

Actually, the merkle tree in ethereum reorg the tree while update method called. And the subcall of update method is insert function.
That's to say, when we want to update a tree node's value, a new node will be created and insert to the appropriate position with specific key and the old node will be reserved to represent a historical state.