mirror of
https://github.com/luxfi/platformvm.git
synced 2026-10-30 15:22:12 +00:00
- Drop atomic_block.go + legacy *_block_test.go (consolidated) - Add block/v0/ subdir + lift_v0.go for old version handling - Copyright header: 'Lux Industries, Inc.' → 'Lux Industries Inc' (no comma) - block_adapter.go: new adapter layer
61 lines
1.1 KiB
Go
61 lines
1.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package warp
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
|
|
"github.com/luxfi/crypto/bls"
|
|
"github.com/luxfi/crypto/bls/signer/localsigner"
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/utils"
|
|
)
|
|
|
|
const pChainHeight uint64 = 1337
|
|
|
|
var (
|
|
errTest = errors.New("non-nil error")
|
|
testVdrs []*testValidator
|
|
)
|
|
|
|
type testValidator struct {
|
|
nodeID ids.NodeID
|
|
sk *localsigner.LocalSigner
|
|
vdr *Validator
|
|
}
|
|
|
|
func (v *testValidator) Compare(other *testValidator) int {
|
|
return bytes.Compare(v.vdr.PublicKeyBytes, other.vdr.PublicKeyBytes)
|
|
}
|
|
|
|
func newTestValidator() *testValidator {
|
|
sk, err := localsigner.New()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
nodeID := ids.GenerateTestNodeID()
|
|
pk := sk.PublicKey()
|
|
return &testValidator{
|
|
nodeID: nodeID,
|
|
sk: sk,
|
|
vdr: &Validator{
|
|
PublicKey: pk,
|
|
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
|
|
Weight: 3,
|
|
NodeIDs: []ids.NodeID{nodeID},
|
|
},
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
testVdrs = []*testValidator{
|
|
newTestValidator(),
|
|
newTestValidator(),
|
|
newTestValidator(),
|
|
}
|
|
utils.Sort(testVdrs)
|
|
}
|