2018-03-25 10:45:54 +00:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-03-25 15:30:21 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
2020-06-14 07:34:50 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
2018-03-25 10:45:54 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2020-02-29 15:55:16 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
2018-03-25 10:45:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGenesisBlockMainNet(t *testing.T) {
|
2020-06-14 07:34:50 +00:00
|
|
|
cfg, err := config.Load("../../config", netmode.MainNet)
|
2020-02-29 15:55:16 +00:00
|
|
|
require.NoError(t, err)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
2022-06-08 15:20:34 +00:00
|
|
|
block, err := CreateGenesisBlock(cfg.ProtocolConfiguration)
|
2020-02-29 15:55:16 +00:00
|
|
|
require.NoError(t, err)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
2021-07-14 08:32:54 +00:00
|
|
|
expect := "1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15"
|
2019-11-27 09:23:18 +00:00
|
|
|
assert.Equal(t, expect, block.Hash().StringLE())
|
2018-03-25 10:45:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestGetConsensusAddressMainNet(t *testing.T) {
|
|
|
|
var (
|
2021-05-11 14:13:33 +00:00
|
|
|
consensusAddr = "NVg7LjGcUSrgxgjX3zEgqaksfMaiS8Z6e1"
|
|
|
|
consensusScript = "6b123dd8bec718648852bbc78595e3536a058f9f"
|
2018-03-25 10:45:54 +00:00
|
|
|
)
|
|
|
|
|
2020-06-14 07:34:50 +00:00
|
|
|
cfg, err := config.Load("../../config", netmode.MainNet)
|
2020-02-29 15:55:16 +00:00
|
|
|
require.NoError(t, err)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
2020-06-23 15:15:55 +00:00
|
|
|
validators, err := validatorsFromConfig(cfg.ProtocolConfiguration)
|
2020-02-29 15:55:16 +00:00
|
|
|
require.NoError(t, err)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
|
|
|
script, err := getNextConsensusAddress(validators)
|
2020-02-29 15:55:16 +00:00
|
|
|
require.NoError(t, err)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
|
|
|
assert.Equal(t, consensusScript, script.String())
|
2019-12-25 14:34:18 +00:00
|
|
|
assert.Equal(t, consensusAddr, address.Uint160ToString(script))
|
2018-03-25 10:45:54 +00:00
|
|
|
}
|