mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 13:38:35 +00:00
a4294f4b5f
Both are very useful outside of the core, this change also makes respective transactions initialize with the package as they don't depend on any kind of input and it makes no sense recreating them again and again on every use.
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package core
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/CityOfZion/neo-go/config"
|
|
"github.com/CityOfZion/neo-go/pkg/encoding/address"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGenesisBlockMainNet(t *testing.T) {
|
|
cfg, err := config.Load("../../config", config.ModeMainNet)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
expect := "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
|
assert.Equal(t, expect, block.Hash().StringLE())
|
|
}
|
|
|
|
func TestGetConsensusAddressMainNet(t *testing.T) {
|
|
var (
|
|
consensusAddr = "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR"
|
|
consensusScript = "59e75d652b5d3827bf04c165bbe9ef95cca4bf55"
|
|
)
|
|
|
|
cfg, err := config.Load("../../config", config.ModeMainNet)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
validators, err := getValidators(cfg.ProtocolConfiguration)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
script, err := getNextConsensusAddress(validators)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
assert.Equal(t, consensusScript, script.String())
|
|
assert.Equal(t, consensusAddr, address.Uint160ToString(script))
|
|
}
|
|
|
|
func TestUtilityTokenTX(t *testing.T) {
|
|
expect := "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7"
|
|
assert.Equal(t, expect, UtilityTokenID().StringLE())
|
|
}
|
|
|
|
func TestGoverningTokenTX(t *testing.T) {
|
|
expect := "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"
|
|
assert.Equal(t, expect, GoverningTokenID().StringLE())
|
|
}
|