Documentation
¶
Overview ¶
Package send is beefcat's near end: it cuts a stream of bytes into carriers, each spending one mined funding output of the home's, and writes them as frames.
Sending asks nothing of the chain. The funding trees were mined ahead (beefcat fund), each kept with its Merkle path, and every carrier carries the tree it spends from and that path, so the far end verifies with nothing but its own block headers.
A funding output is marked spent in the home's state before its carrier is signed: a run that stops part way never signs a second carrier on the same output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoPostage = errors.New("out of postage: no mined funding output is left (run `beefcat fund`)")
ErrNoPostage is a home with no mined funding output left.
Functions ¶
Types ¶
type Sender ¶
type Sender struct {
Wallet wallet.Interface
Originator string
Identity [33]byte
State *home.State
// Chunk is the most data one carrier holds; zero is wire.MaxData.
Chunk int
// Lines sends each line of input as it arrives, one carrier a line,
// and closes the stream with an empty last carrier.
Lines bool
// Workers is how many carriers are signed at once; zero is one per
// core, at most 16.
Workers int
// MinHeight, when not zero, spends only funding trees mined at that
// height or above: postage a far end that limits its age still takes.
MinHeight uint32
// contains filtered or unexported fields
}
Sender sends streams from one home.
func (*Sender) Stream ¶
Stream reads r to its end and writes it to w as one stream of carriers.
Input is cut into chunks in order, each given its sequence number and a funding output as it is read. No carrier depends on another's bytes, so they are signed on several cores, and written in the order they were read.