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 ¶
- func A(name zonerec.Name, last byte) *zonerec.Leaf
- func BEEF(t testing.TB, tx *transaction.Transaction) []byte
- func Ind(l *zonerec.Leaf) *indverify.Leaf
- func IndProof(p *zonerec.Proof) *indverify.Proof
- func Leaves(last byte) []*zonerec.Leaf
- func Lock(t testing.TB, p Party, d pushdrop.Derivation, fields [][]byte, sign bool) *script.Script
- func PieceParams(kind zonerec.Chain) carrier.Params
- func RecordParams(keyID string) carrier.Params
- func Spend(parent *transaction.Transaction, vout uint32) *transaction.TransactionInput
- type Chain
- type Party
- type Rig
- func (r *Rig) Carriers(pieces []*zonerec.Piece, writer Party) []Submission
- func (r *Rig) Coin() *transaction.TransactionInput
- func (r *Rig) Mine(tx, parent *transaction.Transaction) []byte
- func (r *Rig) Mint(params carrier.Params, recs [][]byte, writer Party) []Submission
- func (r *Rig) Pieces(st *zonerec.State, object []byte, writer Party) []Submission
- func (r *Rig) Record(rec any, writer Party) Submission
- func (r *Rig) State(seq uint64, owner Party, leaves []*zonerec.Leaf, lapse uint64, ...) (*zonerec.State, []byte)
- func (r *Rig) Token(st *zonerec.State, parent *transaction.Transaction, vout uint32, signer Party, ...) (*transaction.Transaction, []byte)
- func (r *Rig) TokenWith(lock *script.Script, sats uint64, parent *transaction.Transaction, vout uint32, ...) (*transaction.Transaction, []byte)
- type Submission
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BEEF ¶
func BEEF(t testing.TB, tx *transaction.Transaction) []byte
BEEF is tx's BEEF with what its inputs link.
func PieceParams ¶
PieceParams are the carrier parameters of a chain's leaves pieces.
func RecordParams ¶ added in v0.3.0
RecordParams are the carrier parameters of attached records (keyID zonerec.KeyIDAttach) or host records (zonerec.KeyIDHost).
func Spend ¶
func Spend(parent *transaction.Transaction, vout uint32) *transaction.TransactionInput
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 ¶
CurrentHeight implements chaintracker.ChainTracker.
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 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 (*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
Mint mints one carrier of params for each record, signed by writer and funded by one mined tree of its own.
func (*Rig) Pieces ¶
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.