aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-04 22:35:21 +0800
committerobscuren <geffobscura@gmail.com>2014-12-04 22:35:21 +0800
commit73123bf257934e95e08311d4af9b3382f3dcdb39 (patch)
tree7d80fe620903b4c08393002bb40261642e33f005 /core
parent73c4ca3a6fcf948f4bc637f5c1b55277cf64c06f (diff)
downloaddexon-73123bf257934e95e08311d4af9b3382f3dcdb39.tar.gz
dexon-73123bf257934e95e08311d4af9b3382f3dcdb39.tar.zst
dexon-73123bf257934e95e08311d4af9b3382f3dcdb39.zip
Only set TD if it's actually higher
Diffstat (limited to 'core')
-rw-r--r--core/chain_manager.go5
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)
}