OSDN Git Service

feat: add cross-chain output (#56)
[bytom/vapor.git] / protocol / bc / crosschain_output.go
1 package bc
2
3 import "io"
4
5 // CrossChainOutput is the result of a transfer of value. The value it contains
6 // can never be accessed on side chain, as it has been transfered back to the
7 // main chain.
8 // CrossChainOutput satisfies the Entry interface.
9 // (Not to be confused with the deprecated type TxOutput.)
10
11 func (CrossChainOutput) typ() string { return "crosschainoutput1" }
12 func (o *CrossChainOutput) writeForHash(w io.Writer) {
13         mustWriteForHash(w, o.Source)
14         mustWriteForHash(w, o.ControlProgram)
15 }
16
17 // NewCrossChainOutput creates a new CrossChainOutput.
18 func NewCrossChainOutput(source *ValueSource, controlProgram *Program, ordinal uint64) *CrossChainOutput {
19         return &CrossChainOutput{
20                 Source:         source,
21                 ControlProgram: controlProgram,
22                 Ordinal:        ordinal,
23         }
24 }