neo-go/pkg/core/util_test.go
Roman Khimov 0a09a20900 transaction: drop Register transaction type
And everything associated like SystemFee configuration.
2020-06-05 19:20:16 +03:00

44 lines
1.4 KiB
Go

package core
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/config"
"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", config.ModeMainNet)
require.NoError(t, err)
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
require.NoError(t, err)
//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"
expect := "d2e6d56c734f24c294a74785023af23f20347d97ef92e7bff1b337e37acbf2dd"
assert.Equal(t, expect, block.Hash().StringLE())
}
func TestGetConsensusAddressMainNet(t *testing.T) {
var (
consensusAddr = "ASEhJHr51ZMQUqmUbPC5uiuJwwvedwC48F"
consensusScript = "72c3d9b3bbf776698694cd2c73fa597a10c31294"
)
cfg, err := config.Load("../../config", config.ModeMainNet)
require.NoError(t, err)
validators, err := getValidators(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))
}