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-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) {
|
|
|
|
cfg, err := config.Load("../../config", config.ModeMainNet)
|
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-04-10 10:41:49 +00:00
|
|
|
//TODO: After we added Nonce field to transaction.Transaction, goveringTockenTx and UtilityTockenTx hashes
|
|
|
|
// have been changed. Consequently, hash of the genesis block has been changed.
|
|
|
|
// Update expected genesis block hash for better times.
|
|
|
|
// Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
2020-06-04 19:21:12 +00:00
|
|
|
expect := "d2e6d56c734f24c294a74785023af23f20347d97ef92e7bff1b337e37acbf2dd"
|
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-05-07 10:23:05 +00:00
|
|
|
consensusAddr = "ASEhJHr51ZMQUqmUbPC5uiuJwwvedwC48F"
|
|
|
|
consensusScript = "72c3d9b3bbf776698694cd2c73fa597a10c31294"
|
2018-03-25 10:45:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cfg, err := config.Load("../../config", config.ModeMainNet)
|
2020-02-29 15:55:16 +00:00
|
|
|
require.NoError(t, err)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
|
|
|
validators, err := getValidators(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
|
|
|
}
|