go-ethereum
go-ethereum copied to clipboard
all: remove forkchoicer and reorgNeeded
This PR changes how we view sidechains. Before the merge it was possible to import a chain with lower td and not set it as canonical in InsertChain. After the merge, we expect every chain that we get via InsertChain to be canonical, non-canonical blocks can still be inserted with InsertBlockWIthoutSetHead.
If during the InsertChain, the existing chain is not canonical anymore, we mark it as a sidechain and send the SideChainEvents normally.
I commented out all the ethereum/tests
that we're failing with this PR due to them expecting us to not import a sidechain with lower td. There is one test in core/blockchain_test.go
that I didn't know how to make work, I added a comment with my thoughts about it. Would be nice if someone smarter could take a look
core/blockchain_insert.go:174:27: func (*insertIterator).first
is unused (unused)
Please fix the lint