sitetest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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 sitetest builds bweb's transactions for tests: real keys, real signatures, each transaction mined 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 Alone

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

Alone is tx's BEEF with its own proof.

func Coin

Coin is an input from nowhere: admission never reads a fee input.

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 Spend

Spend is an input spending parent's output vout.

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
	Owner, Server, Auditor Party
	Tree                   *transaction.Transaction
	Site                   [32]byte
}

Rig is one site: its owner, a server, an auditor, the owner's site chain tree and the site id its first output names.

func NewRig

func NewRig(t testing.TB) *Rig

NewRig is a site whose chain tree is mined.

func (*Rig) Ad

func (r *Rig) Ad(now time.Time) *siterec.Advertisement

Ad is an advertisement of the rig's server for the rig's site, expiring in a day from now.

func (*Rig) AdTx

AdTx mints the server's advertisements in one transaction, spending the inputs given.

func (*Rig) Host

func (r *Rig) Host() siterec.Host

Host is admission's view of the rig's site.

func (*Rig) Outcome

func (r *Rig) Outcome() *siterec.Outcome

Outcome is a passing outcome by the rig's auditor.

func (*Rig) OutcomeTx

func (r *Rig) OutcomeTx(o *siterec.Outcome) []byte

OutcomeTx mints an outcome carrier by the auditor and its BEEF.

func (*Rig) SiteRecord

func (r *Rig) SiteRecord(seq uint64, prev [32]byte) *siterec.Site

SiteRecord is a site record of the rig's site at seq.

func (*Rig) Terms

func (r *Rig) Terms() *siterec.Terms

Terms is terms of the rig's site.

func (*Rig) TermsTx

func (r *Rig) TermsTx(tm *siterec.Terms, hostingKey Party) (*transaction.Transaction, []byte)

TermsTx mints terms beside a hosting output under hostingKey.

func (*Rig) Token

func (r *Rig) Token(s *siterec.Site, parent *transaction.Transaction, vout uint32) (*transaction.Transaction, []byte)

Token mints a site token spending parent's output vout: the transaction and its token BEEF.

Jump to

Keyboard shortcuts

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