Files
proto/p/txs/chain_validator_test.go
2026-01-10 01:59:02 -08:00

40 lines
641 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package txs
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
)
func TestChainValidatorVerifyChainID(t *testing.T) {
require := require.New(t)
// Error path
{
vdr := &ChainValidator{
Chain: constants.PrimaryNetworkID,
}
err := vdr.Verify()
require.ErrorIs(err, errBadChainID)
}
// Happy path
{
vdr := &ChainValidator{
Chain: ids.GenerateTestID(),
Validator: Validator{
Wght: 1,
},
}
require.NoError(vdr.Verify())
}
}