mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
fixed bypass unittest
This commit is contained in:
parent
6adee64867
commit
10694b2c6f
1 changed files with 7 additions and 17 deletions
|
|
@ -519,24 +519,14 @@ func testInsertNonceError(t *testing.T, full bool) {
|
||||||
failRes int
|
failRes int
|
||||||
failNum uint64
|
failNum uint64
|
||||||
)
|
)
|
||||||
if full {
|
headers := makeHeaderChain(blockchain.CurrentHeader(), i, ethash.NewFaker(), db, 0)
|
||||||
blocks := makeBlockChain(blockchain.CurrentBlock(), i, ethash.NewFaker(), db, 0)
|
|
||||||
|
|
||||||
failAt = rand.Int() % len(blocks)
|
failAt = rand.Int() % len(headers)
|
||||||
failNum = blocks[failAt].NumberU64()
|
failNum = headers[failAt].Number.Uint64()
|
||||||
|
|
||||||
blockchain.engine = ethash.NewFakeFailer(failNum)
|
blockchain.engine = ethash.NewFakeFailer(failNum)
|
||||||
failRes, err = blockchain.InsertChain(blocks)
|
blockchain.hc.engine = blockchain.engine
|
||||||
} else {
|
failRes, err = blockchain.InsertHeaderChain(headers, 1)
|
||||||
headers := makeHeaderChain(blockchain.CurrentHeader(), i, ethash.NewFaker(), db, 0)
|
|
||||||
|
|
||||||
failAt = rand.Int() % len(headers)
|
|
||||||
failNum = headers[failAt].Number.Uint64()
|
|
||||||
|
|
||||||
blockchain.engine = ethash.NewFakeFailer(failNum)
|
|
||||||
blockchain.hc.engine = blockchain.engine
|
|
||||||
failRes, err = blockchain.InsertHeaderChain(headers, 1)
|
|
||||||
}
|
|
||||||
// Check that the returned error indicates the failure.
|
// Check that the returned error indicates the failure.
|
||||||
if failRes != failAt {
|
if failRes != failAt {
|
||||||
t.Errorf("test %d: failure index mismatch: have %d, want %d", i, failRes, failAt)
|
t.Errorf("test %d: failure index mismatch: have %d, want %d", i, failRes, failAt)
|
||||||
|
|
@ -1330,4 +1320,4 @@ func TestLargeReorgTrieGC(t *testing.T) {
|
||||||
t.Fatalf("competitor %d: competing chain state missing", i)
|
t.Fatalf("competitor %d: competing chain state missing", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue