aboutsummaryrefslogtreecommitdiffstats
path: root/block_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-02 03:18:09 +0800
committerobscuren <geffobscura@gmail.com>2014-12-02 03:18:09 +0800
commit6dc46d3341dc5fa25bd005f9606de258874139be (patch)
tree39b5d7dad5a943de4e187f99c93da5aa7fc9f2b8 /block_pool.go
parenta3559c5e1b469890bb8d71e9992175febaae31c7 (diff)
downloaddexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.gz
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.zst
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.zip
Changed the way transactions are being added to the transaction pool
Diffstat (limited to 'block_pool.go')
-rw-r--r--block_pool.go38
1 files changed, 31 insertions, 7 deletions
diff --git a/block_pool.go b/block_pool.go
index 090871fd3..69c7a54de 100644
--- a/block_pool.go
+++ b/block_pool.go
@@ -314,11 +314,10 @@ out:
// sm.eth.EventMux().Post(NewBlockEvent{block})
// otherwise process and don't emit anything
if len(blocks) > 0 {
- chainManager := self.eth.ChainManager()
- // Test and import
- bchain := chain.NewChain(blocks)
- _, err := chainManager.TestChain(bchain)
- if err != nil && !chain.IsTDError(err) {
+ chainman := self.eth.ChainManager()
+
+ err := chainman.InsertChain(blocks)
+ if err != nil {
poollogger.Debugln(err)
self.Reset()
@@ -332,12 +331,37 @@ out:
self.peer.StopWithReason(DiscBadPeer)
self.td = ethutil.Big0
self.peer = nil
- } else {
- chainManager.InsertChain(bchain)
+
for _, block := range blocks {
self.Remove(block.Hash())
}
}
+
+ /*
+ // Test and import
+ bchain := chain.NewChain(blocks)
+ _, err := chainManager.TestChain(bchain)
+ if err != nil && !chain.IsTDError(err) {
+ poollogger.Debugln(err)
+
+ self.Reset()
+
+ if self.peer != nil && self.peer.conn != nil {
+ poollogger.Debugf("Punishing peer for supplying bad chain (%v)\n", self.peer.conn.RemoteAddr())
+ }
+
+ // This peer gave us bad hashes and made us fetch a bad chain, therefor he shall be punished.
+ self.eth.BlacklistPeer(self.peer)
+ self.peer.StopWithReason(DiscBadPeer)
+ self.td = ethutil.Big0
+ self.peer = nil
+ } else {
+ chainManager.InsertChain(bchain)
+ for _, block := range blocks {
+ self.Remove(block.Hash())
+ }
+ }
+ */
}
}
}