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
|
|
|
|
|
|
|
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
|
|
|
|
2020-07-29 16:57:38 +00:00
|
|
|
expect := "ecaee33262f1bc7c7c28f2b25b54a5d61d50670871f45c0c6fe755a40cbde4a8"
|
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 (
|
2020-07-13 10:39:36 +00:00
|
|
|
consensusAddr = "NiVihDFvZacZhujTWkBhRz32UDuNRp416f"
|
|
|
|
consensusScript = "f7b4d00143932f3b6243cfc06cb4a68f22c739e2"
|
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
|
|
|
}
|