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
- type Chain
- type Host
- func (h *Host) Forget(producer []byte, stream string, seq uint64)
- func (h *Host) Holds(producer []byte, stream string, seq uint64) bool
- func (h *Host) HoldsTree(txid string) bool
- func (h *Host) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Host) SetDown(down bool)
- func (h *Host) SetNoTrees(no bool)
- func (h *Host) SetRewrite(f func(class string, beef []byte) []byte)
Constants ¶
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 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 (*Host) SetNoTrees ¶
SetNoTrees sets NoTrees under the host's lock.