neo-go/pkg/core/util_test.go

42 lines
1.1 KiB
Go
Raw Normal View History

package core
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/config"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGenesisBlockMainNet(t *testing.T) {
cfg, err := config.Load("../../config", netmode.MainNet)
require.NoError(t, err)
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
require.NoError(t, err)
expect := "c3db4ba50ede4f9e749bd97e1499953ae17e65a415c6bf9e38c01cf92b03d156"
2019-11-27 09:23:18 +00:00
assert.Equal(t, expect, block.Hash().StringLE())
}
func TestGetConsensusAddressMainNet(t *testing.T) {
var (
consensusAddr = "NVg7LjGcUSrgxgjX3zEgqaksfMaiS8Z6e1"
consensusScript = "6b123dd8bec718648852bbc78595e3536a058f9f"
)
cfg, err := config.Load("../../config", netmode.MainNet)
require.NoError(t, err)
validators, err := validatorsFromConfig(cfg.ProtocolConfiguration)
require.NoError(t, err)
script, err := getNextConsensusAddress(validators)
require.NoError(t, err)
assert.Equal(t, consensusScript, script.String())
assert.Equal(t, consensusAddr, address.Uint160ToString(script))
}