OSDN Git Service

Coinbase input (#290)
[bytom/bytom.git] / protocol / bc / output.go
1 package bc
2
3 import "io"
4
5 // Output is the result of a transfer of value. The value it contains
6 // may be accessed by a later Spend entry (if that entry can satisfy
7 // the Output's ControlProgram). Output satisfies the Entry interface.
8 //
9 // (Not to be confused with the deprecated type TxOutput.)
10
11 func (Output) typ() string { return "output1" }
12 func (o *Output) writeForHash(w io.Writer) {
13         mustWriteForHash(w, o.Source)
14         mustWriteForHash(w, o.ControlProgram)
15         mustWriteForHash(w, o.Data)
16         mustWriteForHash(w, o.ExtHash)
17 }
18
19 // NewOutput creates a new Output.
20 func NewOutput(source *ValueSource, controlProgram *Program, data *Hash, ordinal uint64) *Output {
21         return &Output{
22                 Source:         source,
23                 ControlProgram: controlProgram,
24                 Data:           data,
25                 Ordinal:        ordinal,
26         }
27 }