testchain

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 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 testchain is the local stand-ins this module's tests run against: the shared chain, and this application's host.

Index

Constants

View Source
const (
	CoinbaseValue = bc.CoinbaseValue
	Maturity      = bc.Maturity
)

CoinbaseValue and Maturity are the chain's.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain = bc.Chain

Chain is the shared local chain.

func New

func New(start uint32) *Chain

New is a chain whose tip is at height start.

type Host

type Host struct {

	// Down answers every request with 503.
	Down bool
	// NoTrees refuses the tree class, as a host that predates it does.
	NoTrees bool
	// Drop, when set, is asked about each submission; true discards it
	// unseen, as a plane that lost the object would.
	Drop func(tx *transaction.Transaction) bool
	// Rewrite, when set, is given the class of each lookup and each
	// answered BEEF, and its result is answered instead: a host that
	// substitutes bytes for what it holds (SetRewrite).
	Rewrite func(class string, beef []byte) []byte
	// Submits counts submissions; Refused counts refusals by reason;
	// Retracted counts carriers retracted.
	Submits   int
	Refused   map[string]int
	Retracted int
	// contains filtered or unexported fields
}

Host is a stand-in overlay host for blogs streams: /submit runs the engine's SPV and the blogs topic manager (logrec.Admit) over the topic's previous coins, and /lookup answers the three ls_log classes, the question validated by logrec.ParseQuery. Refusals the specification says leave no record (anchor-input, unmined) are not recorded, so the same transaction offered again is decided afresh. A mined transaction admitted here that spends the funding output a held carrier spent retracts that carrier: the batch class stops answering it. Restore and the link statuses are the real host module's and are not modelled.

func NewHost

func NewHost(chain *Chain) *Host

NewHost is a host whose engine checks proofs against chain.

func (*Host) Forget

func (h *Host) Forget(producer []byte, stream string, seq uint64)

Forget drops what the host holds for one seq, as a host that missed it.

func (*Host) Holds

func (h *Host) Holds(producer []byte, stream string, seq uint64) bool

Holds reports whether the host answers seq.

func (*Host) HoldsTree

func (h *Host) HoldsTree(txid string) bool

HoldsTree reports whether the host admitted funding outputs of txid.

func (*Host) ServeHTTP

func (h *Host) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Host) SetDown

func (h *Host) SetDown(down bool)

SetDown sets Down under the host's lock.

func (*Host) SetNoTrees

func (h *Host) SetNoTrees(no bool)

SetNoTrees sets NoTrees under the host's lock.

func (*Host) SetRewrite

func (h *Host) SetRewrite(f func(class string, beef []byte) []byte)

SetRewrite sets Rewrite under the host's lock.

Jump to

Keyboard shortcuts

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