1

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.

0

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) {
...
  • Do you know where the Rollback() function of blockchain.go is invoked? I search with Rollback key word, but can not find the code that invoke this function except testing code. – XLeo Nov 12 '17 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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