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 ¶
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 {
// Now is the host's clock.
Now func() time.Time
// Down answers every request with 503.
Down bool
// Priced refuses the history classes on /lookup.
Priced 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
// Tamper, when set, rewrites every answered BEEF, as a host that edits
// what it serves would.
Tamper func(beef []byte) []byte
// Stale answers every carrier under a proof of its funding tree that
// names another block than the one the chain mined it in: a host whose
// stored proofs a reorganisation left behind.
Stale bool
// HistoryPage, when set, is the most envelopes a history page holds
// here, in place of the class's 64.
HistoryPage int
// Submits counts submissions; Refused counts refusals by reason.
Submits int
Refused map[string]int
// contains filtered or unexported fields
}
Host is a stand-in overlay host carrying bbox offices: /submit runs the engine's SPV and the bbox topic manager (boxrec.Admit) over the topic's previous coins, and /lookup answers the ls_bbox classes by the statuses of spec section 8.2 and the answer window of section 8.3. A refusal is recorded nowhere, so the same transaction offered again is decided afresh. The priced classes are refused on /lookup when Priced is set, as a host that sells them refuses them there. Retention, restore and the evidence cap are the real module's and are not modelled.
type Paid ¶
type Paid struct {
Host *Host
Prices map[string]uint64
// Payments are the payments it accepted: txid, satoshis, the remittance
// and the Atomic BEEF, as a host's payment ledger records them.
Payments []Payment
// Again answers 402 to every priced question, a payment or none: a
// host that keeps asking. FailPaid records a payment and then answers
// 500: a host that took the money and did not answer.
Again bool
FailPaid bool
// OnPayment, when set, runs when a request carrying a payment arrives,
// before anything is done with it.
OnPayment func()
// contains filtered or unexported fields
}
Paid is a stand-in for a host's terms route (spec sections 7.3 and 7.4): the terms document, and lookups over BRC-104 in which a priced class is answered 402 (BRC-105) until a payment pays the price to the key BRC-29 derives for the payee, the prefix it issued, the payer's suffix and the payer, and verifies against the chain. It answers from a Host. Requests are served one at a time.
type Payment ¶
type Payment struct {
Txid string `json:"txid"`
Beef string `json:"beef"`
OutputIndex int `json:"outputIndex"`
Satoshis uint64 `json:"satoshis"`
DerivationPrefix string `json:"derivationPrefix"`
DerivationSuffix string `json:"derivationSuffix"`
SenderIdentityKey string `json:"senderIdentityKey"`
Class string `json:"class"`
}
Payment is one accepted payment, in the host ledger's shape.
type Plane ¶
type Plane struct {
Hosts []http.Handler
// Lost, when set, is asked per host and submission; true loses the
// object on the way to that host.
Lost func(host int, tx []byte) bool
}
Plane stands in for the multicast plane: a facade that delivers each submission to every host subscribed to the topic, answering with the first host's answer. Lookups go to the first host, the facade's own.