aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-20 06:53:15 +0800
committerzelig <viktor.tron@gmail.com>2015-03-20 18:41:40 +0800
commit391e89d70a43b4a2153db8acac9a6af7a4f76adf (patch)
treea2412ea8fcac7f7d52e727675f7cf3a0daa4fc4c /eth/backend.go
parent50661f0e683b4975894a0e8fe16024724adef72d (diff)
downloadgo-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.gz
go-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.zst
go-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.zip
use own total difficulty to limit best peer
- update blockpool td by subscribing to ChainHeadEvent - if ahead of best peer, demote it - addPeer now take own td as current td - removePeer now take own td as current td - add relevant tests to peers_test - eth: backend now calls blockpool with eth.eventMux and chainManager.Td
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/eth/backend.go b/eth/backend.go
index afe314d74..141c6c605 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -195,7 +195,8 @@ func New(config *Config) (*Ethereum, error) {
hasBlock := eth.chainManager.HasBlock
insertChain := eth.chainManager.InsertChain
- eth.blockPool = blockpool.New(hasBlock, insertChain, eth.pow.Verify)
+ td := eth.chainManager.Td()
+ eth.blockPool = blockpool.New(hasBlock, insertChain, eth.pow.Verify, eth.EventMux(), td)
netprv, err := config.nodeKey()
if err != nil {