Documentation
¶
Overview ¶
Package goldentest holds the helpers a package's tests share when they check themselves against a committed test vector: a fixed test key, hex and transaction parsing that fail the test rather than return an error, and a chain tracker that knows only the roots the test hands it.
It carries no vector of its own. Each application keeps its vector, and the code that finds and reads it, in its own tree: a path resolved from this package's source file would point into the module cache once the package is imported from there.
It is a test helper that happens to live outside a _test file so that several packages can share it; no binary should import it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FixedKey ¶
func FixedKey() *ec.PrivateKey
FixedKey is the TEST key vectors are generated from, fixed so that regenerating one reproduces it byte for byte. It must never be used for anything real: it is 32 bytes of 0x42.
func Proven ¶ added in v0.35.0
func Proven(tx *transaction.Transaction, height uint32) *transaction.Transaction
Proven gives tx a proof of its own, a block of that one transaction at height, and returns it. A fixture parent built by hand has no inputs, and from v1.7.2 go-sdk's SPV refuses an unmined transaction without any, so a test marks the parent as mined and verification stops at it, as it does at any proven transaction. Its root is the transaction's own id, which a Tracker is given when a test proves against one.
func Tx ¶
func Tx(t testing.TB, s string) *transaction.Transaction
Tx parses a transaction from hex or fails the test.
Types ¶
type Tracker ¶
Tracker is a chain tracker that knows exactly the roots it was given, so a test proves a BUMP against a root it chose rather than against anything live. Any other height, and a nil root, answers (false, nil), as a header client answers a height it holds no header for: a test of an unproven parent then meets "not proven", not an error that would take a different refusal path.