core: add nativenames.All list

It's useful to keep the ordered set of native contract names.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2024-04-18 16:46:21 +03:00
parent 4ca2686583
commit 36e128516b
2 changed files with 28 additions and 0 deletions

View file

@ -2480,3 +2480,17 @@ func TestBlockchain_GenesisTransactionExtension(t *testing.T) {
require.Equal(t, int64(amount), actualNeo.Int64())
require.Equal(t, 0, int(lub))
}
// TestNativenames ensures that nativenames.All contains all expected native contract names
// in the right order.
func TestNativenames(t *testing.T) {
bc, _ := chain.NewSingleWithCustomConfig(t, func(cfg *config.Blockchain) {
cfg.Hardforks = map[string]uint32{}
cfg.P2PSigExtensions = true
})
natives := bc.GetNatives()
require.Equal(t, len(natives), len(nativenames.All))
for i, cs := range natives {
require.Equal(t, cs.Manifest.Name, nativenames.All[i], i)
}
}