Documentation
¶
Overview ¶
Package testutil builds BEEF objects and a stand-in for overlay-bridge's header read API, for the host's tests.
The header API stand-in serves the bridge's NATIVE shape exactly (GET /v1/tip -> {hash,height,known}, GET /v1/root/{h} -> {height,merkleRoot,known}, 404 for a height it does not hold), so the host's real tracker client (overlay-bridge headers/chainclient) is what the tests exercise.
Index ¶
- Constants
- func BEEF(t testing.TB, tx *transaction.Transaction) []byte
- type Fixture
- func (f *Fixture) Carrier(t testing.TB, vout uint32) *transaction.Transaction
- func (f *Fixture) Chain(t testing.TB, vout uint32, depth int) *transaction.Transaction
- func (f *Fixture) Root() chainhash.Hash
- func (f *Fixture) Spend(t testing.TB, vout uint32) *transaction.Transaction
- func (f *Fixture) Unlocker() *p2pkh.P2PKH
- type Headers
Constants ¶
const CarrierLockTime = 4102444800
CarrierLockTime is the committed-record carrier's nLockTime (2100-01-01): non-final by design.
const SourceHeight = 100
SourceHeight is the block the fixture's mined source sits in, alone, so its txid is the block's merkle root.
Variables ¶
This section is empty.
Functions ¶
func BEEF ¶
func BEEF(t testing.TB, tx *transaction.Transaction) []byte
BEEF serializes tx with its ancestry (BRC-62 V1).
Types ¶
type Fixture ¶
type Fixture struct {
Src *transaction.Transaction
// contains filtered or unexported fields
}
Fixture is a mined source paying P2PKH outputs and spends of it.
func NewFixture ¶
NewFixture builds a source whose outputs are distinct per seed, so two fixtures never share a txid.
func (*Fixture) Carrier ¶
func (f *Fixture) Carrier(t testing.TB, vout uint32) *transaction.Transaction
Carrier is a spend made non-final the way committed-record carriers are.
func (*Fixture) Chain ¶
func (f *Fixture) Chain(t testing.TB, vout uint32, depth int) *transaction.Transaction
Chain spends the previous transaction's output 0, depth times, from output vout of the source.
func (*Fixture) Spend ¶
func (f *Fixture) Spend(t testing.TB, vout uint32) *transaction.Transaction
Spend returns a signed child spending the source's output vout, with two outputs.
type Headers ¶
Headers is a stand-in header API.
func NewHeaders ¶
NewHeaders serves roots up to tip.