eth, eth/downloader: don't require td on downloader. Fixed tests

This commit is contained in:
obscuren
2015-04-24 15:04:58 +02:00
parent b86e7526e1
commit 31f82eb334
4 changed files with 22 additions and 25 deletions

View File

@ -39,7 +39,6 @@ var (
type hashCheckFn func(common.Hash) bool
type chainInsertFn func(types.Blocks) error
type hashIterFn func() (common.Hash, error)
type currentTdFn func() *big.Int
type blockPack struct {
peerId string
@ -61,7 +60,6 @@ type Downloader struct {
// Callbacks
hasBlock hashCheckFn
insertChain chainInsertFn
currentTd currentTdFn
// Status
fetchingHashes int32
@ -76,13 +74,12 @@ type Downloader struct {
quit chan struct{}
}
func New(hasBlock hashCheckFn, insertChain chainInsertFn, currentTd currentTdFn) *Downloader {
func New(hasBlock hashCheckFn, insertChain chainInsertFn) *Downloader {
downloader := &Downloader{
queue: newqueue(),
peers: make(peers),
hasBlock: hasBlock,
insertChain: insertChain,
currentTd: currentTd,
newPeerCh: make(chan *peer, 1),
syncCh: make(chan syncPack, 1),
hashCh: make(chan []common.Hash, 1),