Files
zeekay ede37547f6 refactor(platformvm): consolidate block code, drop atomic_block, add v0 lift
- 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
2026-06-01 15:22:27 -07:00

43 lines
871 B
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"github.com/luxfi/ids"
hash "github.com/luxfi/crypto/hash"
)
// CommonBlock contains fields and methods common to all blocks in this VM.
type CommonBlock struct {
// parent's ID
PrntID ids.ID `serialize:"true" json:"parentID"`
// This block's height. The genesis block is at height 0.
Hght uint64 `serialize:"true" json:"height"`
BlockID ids.ID `json:"id"`
bytes []byte
}
func (b *CommonBlock) initialize(bytes []byte) {
b.BlockID = hash.ComputeHash256Array(bytes)
b.bytes = bytes
}
func (b *CommonBlock) ID() ids.ID {
return b.BlockID
}
func (b *CommonBlock) Parent() ids.ID {
return b.PrntID
}
func (b *CommonBlock) Bytes() []byte {
return b.bytes
}
func (b *CommonBlock) Height() uint64 {
return b.Hght
}