diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-20 06:53:15 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-20 18:41:40 +0800 |
commit | 391e89d70a43b4a2153db8acac9a6af7a4f76adf (patch) | |
tree | a2412ea8fcac7f7d52e727675f7cf3a0daa4fc4c /blockpool/config_test.go | |
parent | 50661f0e683b4975894a0e8fe16024724adef72d (diff) | |
download | dexon-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar dexon-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.gz dexon-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.bz2 dexon-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.lz dexon-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.xz dexon-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.zst dexon-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 'blockpool/config_test.go')
-rw-r--r-- | blockpool/config_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/blockpool/config_test.go b/blockpool/config_test.go index 8eeaceb51..2cb93769e 100644 --- a/blockpool/config_test.go +++ b/blockpool/config_test.go @@ -5,11 +5,12 @@ import ( "time" "github.com/ethereum/go-ethereum/blockpool/test" + "github.com/ethereum/go-ethereum/event" ) func TestBlockPoolConfig(t *testing.T) { test.LogInit() - blockPool := &BlockPool{Config: &Config{}} + blockPool := &BlockPool{Config: &Config{}, chainEvents: &event.TypeMux{}} blockPool.Start() c := blockPool.Config test.CheckInt("BlockHashesBatchSize", c.BlockHashesBatchSize, blockHashesBatchSize, t) @@ -26,7 +27,7 @@ func TestBlockPoolConfig(t *testing.T) { func TestBlockPoolOverrideConfig(t *testing.T) { test.LogInit() - blockPool := &BlockPool{Config: &Config{}} + blockPool := &BlockPool{Config: &Config{}, chainEvents: &event.TypeMux{}} c := &Config{128, 32, 1, 0, 300 * time.Millisecond, 100 * time.Millisecond, 90 * time.Second, 0, 30 * time.Second, 30 * time.Second} blockPool.Config = c |