forked from TrueCloudLab/neoneo-go
core: export CreateGenesisBlock
Nothing bad with it being public.
This commit is contained in:
parent
d70caf1da1
commit
0055b18a8a
4 changed files with 6 additions and 6 deletions
|
@ -324,7 +324,7 @@ func (bc *Blockchain) init() error {
|
||||||
bc.dao.PutVersion(ver)
|
bc.dao.PutVersion(ver)
|
||||||
bc.dao.Version = ver
|
bc.dao.Version = ver
|
||||||
bc.persistent.Version = ver
|
bc.persistent.Version = ver
|
||||||
genesisBlock, err := createGenesisBlock(bc.config)
|
genesisBlock, err := CreateGenesisBlock(bc.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ func (bc *Blockchain) init() error {
|
||||||
if len(bc.headerHashes) > 0 {
|
if len(bc.headerHashes) > 0 {
|
||||||
targetHash = bc.headerHashes[len(bc.headerHashes)-1]
|
targetHash = bc.headerHashes[len(bc.headerHashes)-1]
|
||||||
} else {
|
} else {
|
||||||
genesisBlock, err := createGenesisBlock(bc.config)
|
genesisBlock, err := CreateGenesisBlock(bc.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ func getSharpTestGenesis(t *testing.T) *block.Block {
|
||||||
|
|
||||||
cfg, err := config.Load(configPath, netmode.MainNet)
|
cfg, err := config.Load(configPath, netmode.MainNet)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
b, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
b, err := CreateGenesisBlock(cfg.ProtocolConfiguration)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||||
)
|
)
|
||||||
|
|
||||||
// createGenesisBlock creates a genesis block based on the given configuration.
|
// CreateGenesisBlock creates a genesis block based on the given configuration.
|
||||||
func createGenesisBlock(cfg config.ProtocolConfiguration) (*block.Block, error) {
|
func CreateGenesisBlock(cfg config.ProtocolConfiguration) (*block.Block, error) {
|
||||||
validators, err := validatorsFromConfig(cfg)
|
validators, err := validatorsFromConfig(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -14,7 +14,7 @@ func TestGenesisBlockMainNet(t *testing.T) {
|
||||||
cfg, err := config.Load("../../config", netmode.MainNet)
|
cfg, err := config.Load("../../config", netmode.MainNet)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
block, err := CreateGenesisBlock(cfg.ProtocolConfiguration)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
expect := "1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15"
|
expect := "1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15"
|
||||||
|
|
Loading…
Reference in a new issue