TransWikia.com

The principle of geth checking whether a block has the highest total difficulty

Ethereum Asked by XLeo on August 26, 2021

How and when does geth check whether there is any block not with the highest total difficulty in chain and rollback? What is the principle of it?
If the location of source code for it could be provided,so much the better.
Thanks.

One Answer

Unsure about the exact mechanics of how that works, but the Rollback() function can be found in blockchain.go. (There's also a version for the "light" client, here.)

// Rollback is designed to remove a chain of links from the database that aren't
// certain enough to be valid.
func (bc *BlockChain) Rollback(chain []common.Hash) {
...

Answered by Richard Horrocks on August 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP