diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-04 22:35:21 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-04 22:35:21 +0800 |
commit | 73123bf257934e95e08311d4af9b3382f3dcdb39 (patch) | |
tree | 7d80fe620903b4c08393002bb40261642e33f005 | |
parent | 73c4ca3a6fcf948f4bc637f5c1b55277cf64c06f (diff) | |
download | dexon-73123bf257934e95e08311d4af9b3382f3dcdb39.tar.gz dexon-73123bf257934e95e08311d4af9b3382f3dcdb39.tar.zst dexon-73123bf257934e95e08311d4af9b3382f3dcdb39.zip |
Only set TD if it's actually higher
-rw-r--r-- | core/chain_manager.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 7acd171ec..7d4aeaab6 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -267,7 +267,10 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error { } self.add(block) - self.SetTotalDifficulty(td) + if td.Cmp(self.TD) > 0 { + self.SetTotalDifficulty(td) + } + self.eventMux.Post(NewBlockEvent{block}) self.eventMux.Post(messages) } |