Initial block reorganisation code
This commit is contained in:
@ -201,7 +201,6 @@ func (sm *StateManager) ProcessBlock(block *Block, dontReact bool) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sm *StateManager) CalculateTD(block *Block) bool {
|
||||
uncleDiff := new(big.Int)
|
||||
for _, uncle := range block.Uncles {
|
||||
@ -215,6 +214,9 @@ func (sm *StateManager) CalculateTD(block *Block) bool {
|
||||
|
||||
// The new TD will only be accepted if the new difficulty is
|
||||
// is greater than the previous.
|
||||
fmt.Println("new block td:", td)
|
||||
fmt.Println("cur block td:", sm.bc.TD)
|
||||
|
||||
if td.Cmp(sm.bc.TD) > 0 {
|
||||
// Set the new total difficulty back to the block chain
|
||||
sm.bc.SetTotalDifficulty(td)
|
||||
|
Reference in New Issue
Block a user