eth, eth/downloader: handle header requests, table driven proto tests

This commit is contained in:
Péter Szilágyi
2015-07-02 19:55:18 +03:00
parent c51e153b5c
commit 42f44dda54
14 changed files with 1213 additions and 258 deletions

View File

@ -39,13 +39,15 @@ import (
const (
eth60 = 60 // Constant to check for old protocol support
eth61 = 61 // Constant to check for new protocol support
eth62 = 62 // Constant to check for experimental protocol support
)
var (
MinHashFetch = 512 // Minimum amount of hashes to not consider a peer stalling
MaxHashFetch = 512 // Amount of hashes to be fetched per retrieval request
MaxBlockFetch = 128 // Amount of blocks to be fetched per retrieval request
MinHashFetch = 512 // Minimum amount of hashes to not consider a peer stalling
MaxHashFetch = 512 // Amount of hashes to be fetched per retrieval request
MaxBlockFetch = 128 // Amount of blocks to be fetched per retrieval request
MaxHeaderFetch = 256 // Amount of block headers to be fetched per retrieval request
MaxStateFetch = 384 // Amount of node state values to allow fetching per request
MaxReceiptsFetch = 384 // Amount of transaction receipts to allow fetching per request
hashTTL = 5 * time.Second // Time it takes for a hash request to time out
blockSoftTTL = 3 * time.Second // Request completion threshold for increasing or decreasing a peer's bandwidth
@ -330,7 +332,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e
if err = d.fetchBlocks60(); err != nil {
return err
}
case eth61, eth62:
case eth61:
// New eth/61, use forward, concurrent hash and block retrieval algorithm
number, err := d.findAncestor(p)
if err != nil {