Merge pull request #997 from karalabe/fix-shitty-test-server-issue

eth/downloader: fix #992, where tests may time out on a slow machine
This commit is contained in:
Jeffrey Wilcke 2015-05-15 11:22:51 -07:00
commit cea1723c68

@ -472,6 +472,9 @@ func TestMadeupHashChainAttack(t *testing.T) {
// Tests that if a malicious peer makes up a random block chain, and tried to // Tests that if a malicious peer makes up a random block chain, and tried to
// push indefinitely, it actually gets caught with it. // push indefinitely, it actually gets caught with it.
func TestMadeupBlockChainAttack(t *testing.T) { func TestMadeupBlockChainAttack(t *testing.T) {
defaultBlockTTL := blockTTL
defaultCrossCheckCycle := crossCheckCycle
blockTTL = 100 * time.Millisecond blockTTL = 100 * time.Millisecond
crossCheckCycle = 25 * time.Millisecond crossCheckCycle = 25 * time.Millisecond
@ -490,6 +493,9 @@ func TestMadeupBlockChainAttack(t *testing.T) {
t.Fatalf("synchronisation error mismatch: have %v, want %v", err, ErrCrossCheckFailed) t.Fatalf("synchronisation error mismatch: have %v, want %v", err, ErrCrossCheckFailed)
} }
// Ensure that a valid chain can still pass sync // Ensure that a valid chain can still pass sync
blockTTL = defaultBlockTTL
crossCheckCycle = defaultCrossCheckCycle
tester.hashes = hashes tester.hashes = hashes
tester.newPeer("valid", big.NewInt(20000), hashes[0]) tester.newPeer("valid", big.NewInt(20000), hashes[0])
if _, err := tester.syncTake("valid", hashes[0]); err != nil { if _, err := tester.syncTake("valid", hashes[0]); err != nil {