aboutsummaryrefslogtreecommitdiffstats
path: root/blockpool/blockpool_util_test.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 /blockpool/blockpool_util_test.go
parent50661f0e683b4975894a0e8fe16024724adef72d (diff)
downloadgo-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar
go-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.gz
go-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.bz2
go-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.lz
go-tangerine-391e89d70a43b4a2153db8acac9a6af7a4f76adf.tar.xz
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 'blockpool/blockpool_util_test.go')
-rw-r--r--blockpool/blockpool_util_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/blockpool/blockpool_util_test.go b/blockpool/blockpool_util_test.go
index 5ba92066c..a17bc584e 100644
--- a/blockpool/blockpool_util_test.go
+++ b/blockpool/blockpool_util_test.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/errs"
+ "github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/pow"
)
@@ -38,6 +39,7 @@ type blockPoolTester struct {
blockChain blockChain
blockPool *BlockPool
t *testing.T
+ chainEvents *event.TypeMux
}
func newTestBlockPool(t *testing.T) (hashPool *test.TestHashPool, blockPool *BlockPool, b *blockPoolTester) {
@@ -48,8 +50,9 @@ func newTestBlockPool(t *testing.T) (hashPool *test.TestHashPool, blockPool *Blo
blockChain: make(blockChain),
refBlockChain: make(blockChain),
blocksRequestsMap: make(map[int]bool),
+ chainEvents: &event.TypeMux{},
}
- b.blockPool = New(b.hasBlock, b.insertChain, b.verifyPoW)
+ b.blockPool = New(b.hasBlock, b.insertChain, b.verifyPoW, b.chainEvents, common.Big0)
blockPool = b.blockPool
blockPool.Config.BlockHashesRequestInterval = testBlockHashesRequestInterval
blockPool.Config.BlocksRequestInterval = testBlocksRequestInterval