lcwire

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const KindLightClientBlockHeaderRequest zapv2.KindByte = 0x50

KindLightClientBlockHeaderRequest is the wire discriminator for LightClientBlockHeaderRequest.

View Source
const OffsetLightClientBlockHeaderRequest_BlockContentHash = 14

OffsetLightClientBlockHeaderRequest_BlockContentHash is the byte offset of the BlockContentHash field.

View Source
const OffsetLightClientBlockHeaderRequest_BlockHeight = 6

OffsetLightClientBlockHeaderRequest_BlockHeight is the byte offset of the BlockHeight field.

View Source
const OffsetLightClientBlockHeaderRequest_CertMinTier = 46

OffsetLightClientBlockHeaderRequest_CertMinTier is the byte offset of the CertMinTier field.

View Source
const OffsetLightClientBlockHeaderRequest_ChainID = 2

OffsetLightClientBlockHeaderRequest_ChainID is the byte offset of the ChainID field.

View Source
const OffsetLightClientBlockHeaderRequest_RequestID = 47

OffsetLightClientBlockHeaderRequest_RequestID is the byte offset of the RequestID field.

View Source
const OffsetLightClientBlockHeaderRequest_Version = 1

OffsetLightClientBlockHeaderRequest_Version is the byte offset of the Version field.

View Source
const SizeLightClientBlockHeaderRequest = 51

SizeLightClientBlockHeaderRequest is the fixed object payload size in bytes.

Variables

LCBlockHeaderReqSchemaFields is the namespace of every scalar field accessor for LightClientBlockHeaderRequest. Use with zapv2.Read / zapv2.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.

Functions

func LightClientBlockHeaderRequestBlockContentHash

func LightClientBlockHeaderRequestBlockContentHash(v zapv2.View[LCBlockHeaderReqSchema]) [32]byte

LightClientBlockHeaderRequestBlockContentHash reads the 32-byte inline BlockContentHash field of LightClientBlockHeaderRequest.

Zero-copy on the read side (v1's Object.BytesFixedSlice returns a sub-slice of the underlying buffer); the returned [32]byte is a value copy so the caller's slot owns the bytes after the View's buffer is freed.

func NewLightClientBlockHeaderRequest

func NewLightClientBlockHeaderRequest(version uint8, chainID uint32, blockHeight uint64, certMinTier uint8, requestID uint32, blockContentHash [32]byte) (zapv2.View[LCBlockHeaderReqSchema], []byte)

NewLightClientBlockHeaderRequest builds a fresh LightClientBlockHeaderRequest in a ZAP buffer.

Hand-rolled fast path: inlines v1 primitives (zap.NewBuilder, [*Builder.StartObject], [*ObjectBuilder.Set*], [*Builder.Finish]) so the entire build expands at the call site. Result: 1 heap alloc (the buffer), zero overhead vs v1.

func WrapLightClientBlockHeaderRequest

func WrapLightClientBlockHeaderRequest(b []byte) (zapv2.View[LCBlockHeaderReqSchema], error)

WrapLightClientBlockHeaderRequest parses a ZAP buffer into a typed [zapv2.View[LightClientBlockHeaderRequest]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv2.SchemaError on kind mismatch.

Hand-rolled fast path: inlines zap.Parse (which is itself inlineable). Zero heap allocs on the happy path; matches v1 hand-rolled performance.

Types

type LCBlockHeaderReqSchema

type LCBlockHeaderReqSchema struct{}

LCBlockHeaderReqSchema is the v2 schema marker for LightClientBlockHeaderRequest. Methods are constant- returning so concrete-typed [zapv2.Wrap[LCBlockHeaderReqSchema]] calls fold to literals at the call site.

func (LCBlockHeaderReqSchema) Kind

func (LCBlockHeaderReqSchema) Name

func (LCBlockHeaderReqSchema) Size

func (LCBlockHeaderReqSchema) Size() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL