aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_manager_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-06-16 18:41:50 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-06-30 00:51:47 +0800
commit1d42888d3047dabfb352c94a2051e7af14d2a509 (patch)
tree8ca68ca98bd697f26f2033a5480e78ccbf064162 /core/chain_manager_test.go
parent654564e164b3b6f7f4ba1e8bbd6fcd64776068fa (diff)
downloadgo-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.gz
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.bz2
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.lz
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.xz
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.zst
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.zip
core/types: make blocks immutable
Diffstat (limited to 'core/chain_manager_test.go')
-rw-r--r--core/chain_manager_test.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go
index c56a3b3e1..afec1d0f1 100644
--- a/core/chain_manager_test.go
+++ b/core/chain_manager_test.go
@@ -117,7 +117,7 @@ func testChain(chainB types.Blocks, bman *BlockProcessor) (*big.Int, error) {
}
func loadChain(fn string, t *testing.T) (types.Blocks, error) {
- fh, err := os.OpenFile(filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "_data", fn), os.O_RDONLY, os.ModePerm)
+ fh, err := os.OpenFile(filepath.Join("..", "_data", fn), os.O_RDONLY, os.ModePerm)
if err != nil {
return nil, err
}
@@ -265,7 +265,7 @@ func TestBrokenChain(t *testing.T) {
}
func TestChainInsertions(t *testing.T) {
- t.Skip() // travil fails.
+ t.Skip("Skipped: outdated test files")
db, _ := ethdb.NewMemDatabase()
@@ -303,7 +303,7 @@ func TestChainInsertions(t *testing.T) {
}
func TestChainMultipleInsertions(t *testing.T) {
- t.Skip() // travil fails.
+ t.Skip("Skipped: outdated test files")
db, _ := ethdb.NewMemDatabase()
@@ -346,8 +346,8 @@ func TestChainMultipleInsertions(t *testing.T) {
}
}
-func TestGetAncestors(t *testing.T) {
- t.Skip() // travil fails.
+func TestGetBlocksFromHash(t *testing.T) {
+ t.Skip("Skipped: outdated test files")
db, _ := ethdb.NewMemDatabase()
chainMan := theChainManager(db, t)
@@ -361,8 +361,8 @@ func TestGetAncestors(t *testing.T) {
chainMan.write(block)
}
- ancestors := chainMan.GetAncestors(chain[len(chain)-1], 4)
- fmt.Println(ancestors)
+ blocks := chainMan.GetBlocksFromHash(chain[len(chain)-1].Hash(), 4)
+ fmt.Println(blocks)
}
type bproc struct{}
@@ -372,15 +372,17 @@ func (bproc) Process(*types.Block) (state.Logs, error) { return nil, nil }
func makeChainWithDiff(genesis *types.Block, d []int, seed byte) []*types.Block {
var chain []*types.Block
for i, difficulty := range d {
- header := &types.Header{Number: big.NewInt(int64(i + 1)), Difficulty: big.NewInt(int64(difficulty))}
- block := types.NewBlockWithHeader(header)
- copy(block.HeaderHash[:2], []byte{byte(i + 1), seed})
+ header := &types.Header{
+ Coinbase: common.Address{seed},
+ Number: big.NewInt(int64(i + 1)),
+ Difficulty: big.NewInt(int64(difficulty)),
+ }
if i == 0 {
- block.ParentHeaderHash = genesis.Hash()
+ header.ParentHash = genesis.Hash()
} else {
- copy(block.ParentHeaderHash[:2], []byte{byte(i), seed})
+ header.ParentHash = chain[i-1].Hash()
}
-
+ block := types.NewBlockWithHeader(header)
chain = append(chain, block)
}
return chain
@@ -399,7 +401,6 @@ func chm(genesis *types.Block, db common.Database) *ChainManager {
}
func TestReorgLongest(t *testing.T) {
- t.Skip("skipped while cache is removed")
db, _ := ethdb.NewMemDatabase()
genesis := GenesisBlock(0, db)
bc := chm(genesis, db)
@@ -419,7 +420,6 @@ func TestReorgLongest(t *testing.T) {
}
func TestReorgShortest(t *testing.T) {
- t.Skip("skipped while cache is removed")
db, _ := ethdb.NewMemDatabase()
genesis := GenesisBlock(0, db)
bc := chm(genesis, db)