1

how does state trie prunning works during syncing? or does pruning only happens on the nodes that is not the state root? since if state root are deleted then there will be errors in the blocks and it will not sync right?

So how does it work with pruning and syncing?

1 Answer 1

1

The state isn't pruned during syncing, it is pruned after. During sync the node downloads accounts incrementally until the whole State is downloaded. After the node is in sync, pruning is activated. Since every account change is represented as a node in the Merkle Trie, to prune an account modification entry all that it takes is to delete the corresponding node from the trie. If your account had 10 modifications, it will have 10 nodes in the trie. Therefore, 9 nodes can be deleted, and the node corresponding to the last modification is kept. geth keeps the account entries in memory for the last 128 blocks, entries older than that are deleted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.