Compare commits
2 Commits
cd5ea103dc
...
fc17f64d9f
Author | SHA1 | Date | |
---|---|---|---|
fc17f64d9f | |||
f3ad5e6978 |
@ -17,10 +17,12 @@ import (
|
|||||||
|
|
||||||
const LatestBlock uint = 3
|
const LatestBlock uint = 3
|
||||||
|
|
||||||
|
var blocks []*types.Block
|
||||||
|
|
||||||
// LoadBlocks loads fixture blocks up to and including the passed height or the highest available block
|
// LoadBlocks loads fixture blocks up to and including the passed height or the highest available block
|
||||||
func LoadBlocks(upto uint) []*types.Block {
|
func GetBlocks() []*types.Block {
|
||||||
if upto > LatestBlock {
|
if blocks != nil {
|
||||||
upto = LatestBlock
|
return blocks
|
||||||
}
|
}
|
||||||
db := rawdb.NewMemoryDatabase()
|
db := rawdb.NewMemoryDatabase()
|
||||||
genesisBlock := core.DefaultGenesisBlock().MustCommit(db)
|
genesisBlock := core.DefaultGenesisBlock().MustCommit(db)
|
||||||
@ -36,11 +38,11 @@ func LoadBlocks(upto uint) []*types.Block {
|
|||||||
panic("mainnet genesis blocks do not match")
|
panic("mainnet genesis blocks do not match")
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks := make([]*types.Block, upto+1)
|
blocks := make([]*types.Block, LatestBlock+1)
|
||||||
blocks[0] = new(types.Block)
|
blocks[0] = new(types.Block)
|
||||||
rlp.DecodeBytes(block0RLP, blocks[0])
|
rlp.DecodeBytes(block0RLP, blocks[0])
|
||||||
|
|
||||||
for i := uint(1); i <= upto; i++ {
|
for i := uint(1); i <= LatestBlock; i++ {
|
||||||
blockRLP, err := loadBlockRLP(fmt.Sprintf("./block%d_rlp", i))
|
blockRLP, err := loadBlockRLP(fmt.Sprintf("./block%d_rlp", i))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
@ -1,7 +1,7 @@
|
|||||||
package medium
|
package medium
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cerc-io/eth-test-data/fixture/util"
|
"github.com/cerc-io/eth-testing/chaindata/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -1,7 +1,7 @@
|
|||||||
package small
|
package small
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cerc-io/eth-test-data/fixture/util"
|
"github.com/cerc-io/eth-testing/chaindata/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
Loading…
Reference in New Issue
Block a user