laconicd/state/test_utils.go

38 lines
512 B
Go
Raw Normal View History

package state
import (
2018-08-15 22:27:30 +00:00
"fmt"
"math/rand"
"time"
ethcmn "github.com/ethereum/go-ethereum/common"
2018-08-15 22:27:30 +00:00
dbm "github.com/tendermint/tendermint/libs/db"
)
type (
kvPair struct {
key, value []byte
}
code struct {
hash ethcmn.Hash
blob []byte
}
)
func init() {
rand.Seed(time.Now().UnixNano())
}
2018-08-15 22:27:30 +00:00
func newTestDatabase() *Database {
memDB := dbm.NewMemDB()
testDB, err := NewDatabase(memDB, memDB, 100)
if err != nil {
panic(fmt.Sprintf("failed to create database: %v", err))
}
return testDB
}