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 ¶
- func Alone(t testing.TB, tx *transaction.Transaction) []byte
- func Coin(b byte) *transaction.TransactionInput
- func Lock(t testing.TB, p Party, d pushdrop.Derivation, fields [][]byte, sign bool) *script.Script
- func Spend(parent *transaction.Transaction, vout uint32) *transaction.TransactionInput
- type Chain
- type Party
- type Rig
- func (r *Rig) Ad(now time.Time) *siterec.Advertisement
- func (r *Rig) AdTx(inputs []*transaction.TransactionInput, ads ...*siterec.Advertisement) (*transaction.Transaction, []byte)
- func (r *Rig) Host() siterec.Host
- func (r *Rig) Outcome() *siterec.Outcome
- func (r *Rig) OutcomeTx(o *siterec.Outcome) []byte
- func (r *Rig) SiteRecord(seq uint64, prev [32]byte) *siterec.Site
- func (r *Rig) Terms() *siterec.Terms
- func (r *Rig) TermsTx(tm *siterec.Terms, hostingKey Party) (*transaction.Transaction, []byte)
- func (r *Rig) Token(s *siterec.Site, parent *transaction.Transaction, vout uint32) (*transaction.Transaction, []byte)
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 ¶
func Coin(b byte) *transaction.TransactionInput
Coin is an input from nowhere: admission never reads a fee input.
func Spend ¶
func Spend(parent *transaction.Transaction, vout uint32) *transaction.TransactionInput
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 ¶
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
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 (*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 ¶
func (r *Rig) AdTx(inputs []*transaction.TransactionInput, ads ...*siterec.Advertisement) (*transaction.Transaction, []byte)
AdTx mints the server's advertisements in one transaction, spending the inputs given.
func (*Rig) SiteRecord ¶
SiteRecord is a site record of the rig's site at seq.
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.