zonetest

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package zonetest builds bdns's transactions for tests: real keys, real signatures, each mined transaction in a block of its own against a stub header source. Nothing here is for real use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A

func A(name zonerec.Name, last byte) *zonerec.Leaf

A is a leaf of one address record at name.

func BEEF

func BEEF(t testing.TB, tx *transaction.Transaction) []byte

BEEF is tx's BEEF with what its inputs link.

func Ind

func Ind(l *zonerec.Leaf) *indverify.Leaf

Ind is a leaf as the independent verifier reads it.

func IndProof

func IndProof(p *zonerec.Proof) *indverify.Proof

IndProof is a proof as the independent verifier reads it.

func Leaves

func Leaves(last byte) []*zonerec.Leaf

Leaves are a small zone: the apex, mail and www, in key order.

func Lock

func Lock(t testing.TB, p Party, d pushdrop.Derivation, fields [][]byte, sign bool) *script.Script

Lock is d's PushDrop of fields under p's key.

func PieceParams

func PieceParams(kind zonerec.Chain) carrier.Params

PieceParams are the carrier parameters of a chain's leaves pieces.

func RecordParams added in v0.3.0

func RecordParams(keyID string) carrier.Params

RecordParams are the carrier parameters of attached records (keyID zonerec.KeyIDAttach) or host records (zonerec.KeyIDHost).

func Spend

Spend is an input spending parent's output vout, with parent linked so a BEEF of the spender carries it.

Types

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

Chain is a stub header source: each transaction mined in a block of its own beside a fixed sibling, as bcommon's testchain does.

func (*Chain) CurrentHeight

func (c *Chain) CurrentHeight(context.Context) (uint32, error)

CurrentHeight implements chaintracker.ChainTracker.

func (*Chain) Forget

func (c *Chain) Forget(height uint32)

Forget drops a block's root, so a proof in it no longer verifies.

func (*Chain) IsValidRootForHeight

func (c *Chain) IsValidRootForHeight(_ context.Context, root *chainhash.Hash, h uint32) (bool, error)

IsValidRootForHeight implements chaintracker.ChainTracker.

func (*Chain) Mine

func (c *Chain) Mine(tx *transaction.Transaction)

Mine gives tx a proof in a block of its own at the next height.

type Party

type Party struct {
	W  wallet.Interface
	ID []byte
}

Party is a key and its wallet.

func NewParty

func NewParty(t testing.TB, b byte) Party

NewParty is the key of the scalar b repeated.

type Rig

type Rig struct {
	T            testing.TB
	C            *Chain
	Kind         zonerec.Chain
	Owner, Other Party
	Tree         *transaction.Transaction
	Zone         [32]byte
	// contains filtered or unexported fields
}

Rig is one chain: its owner, a second key, the owner's chain tree and the identifier its first output gives.

func NewRig

func NewRig(t testing.TB, kind zonerec.Chain) *Rig

NewRig is a chain of kind whose chain tree, of two outputs, is mined.

func (*Rig) Carriers

func (r *Rig) Carriers(pieces []*zonerec.Piece, writer Party) []Submission

Carriers mints one carrier for each piece, signed by writer.

func (*Rig) Coin

func (r *Rig) Coin() *transaction.TransactionInput

Coin is an input spending a mined transaction of one output that pays a fee: an unmined token's BEEF carries what every input spends.

func (*Rig) Mine

func (r *Rig) Mine(tx, parent *transaction.Transaction) []byte

Mine mines a token and returns its mined BEEF with parent.

func (*Rig) Mint added in v0.3.0

func (r *Rig) Mint(params carrier.Params, recs [][]byte, writer Party) []Submission

Mint mints one carrier of params for each record, signed by writer and funded by one mined tree of its own.

func (*Rig) Pieces

func (r *Rig) Pieces(st *zonerec.State, object []byte, writer Party) []Submission

Pieces mints the carriers of st's leaves object, written by writer and funded by a mined tree of its own.

func (*Rig) Record added in v0.3.0

func (r *Rig) Record(rec any, writer Party) Submission

Record mints one carrier of an attached record, or of a host record, signed by writer and funded by a mined tree of its own.

func (*Rig) State

func (r *Rig) State(seq uint64, owner Party, leaves []*zonerec.Leaf, lapse uint64, change ...func(*zonerec.RecordSet, *zonerec.Origin)) (*zonerec.State, []byte)

State is the rig's chain at seq with leaves, owned by owner, and its leaves object. Its lapse time is lapse.

func (*Rig) Token

func (r *Rig) Token(st *zonerec.State, parent *transaction.Transaction, vout uint32, signer Party, mined bool) (*transaction.Transaction, []byte)

Token mints st's token spending parent's output vout, signed by signer, who also unlocks that output (the owner before, or at seq 0 the genesis key's chain output): the transaction and its BEEF, mined (the token and its parent) or unmined (the token and what its inputs spend).

func (*Rig) TokenWith

func (r *Rig) TokenWith(lock *script.Script, sats uint64, parent *transaction.Transaction, vout uint32, mined bool) (*transaction.Transaction, []byte)

TokenWith is Token for an output script and value of the caller's, its inputs left unsigned.

type Submission

type Submission struct {
	Tx   *transaction.Transaction
	BEEF []byte
}

Submission is one transaction and the BEEF it is submitted in.

Jump to

Keyboard shortcuts

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