Files
proto/p/block/standard_block.go
zeekay f480e48e39 run on the native fleet
Adds .hanzo/workflows/cicd.yml calling the canonical pipeline and drops the
GitHub-hosted workflows it replaces. Lands here because this is where the repo
is written — git.hanzo.ai is upstream and github.com is its push mirror, so the
same change made on github.com never reaches the runner fleet.
2026-08-20 20:20:25 -07:00

46 lines
1.1 KiB
Go

// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"time"
"github.com/luxfi/ids"
"github.com/luxfi/proto/p/txs"
)
var _ Block = (*StandardBlock)(nil)
// StandardBlock is the canonical P-Chain standard block. It carries a
// per-block timestamp and an ordered list of decision txs, stored as a u32
// length list + concatenated tx blob in the zap buffer.
type StandardBlock struct {
commonZapBlock
}
// Txs returns the decision txs in wire order.
func (b *StandardBlock) Txs() []*txs.Tx {
list, _ := readTxList(b.msg.Root(), offBlkTxLengths, offBlkTxBlob)
return list
}
func (b *StandardBlock) Visit(v Visitor) error { return v.StandardBlock(b) }
func NewStandardBlock(
timestamp time.Time,
parentID ids.ID,
height uint64,
txs []*txs.Tx,
) (*StandardBlock, error) {
bytes, err := buildBlock(blkStandard, parentID, height, uint64(timestamp.Unix()), txs, nil)
if err != nil {
return nil, err
}
blk := &StandardBlock{}
if err := blk.setID(bytes); err != nil {
return nil, err
}
return blk, nil
}