mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 09:33:36 +00:00
5326fc587a
Part of #918
45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
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)
|
|
|
|
//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 := "94e61af2441145cc251752707a58107850328a48bb095fd175ca2f8513ab5676"
|
|
assert.Equal(t, expect, block.Hash().StringLE())
|
|
}
|
|
|
|
func TestGetConsensusAddressMainNet(t *testing.T) {
|
|
var (
|
|
consensusAddr = "NiVihDFvZacZhujTWkBhRz32UDuNRp416f"
|
|
consensusScript = "f7b4d00143932f3b6243cfc06cb4a68f22c739e2"
|
|
)
|
|
|
|
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))
|
|
}
|