OSDN Git Service

fix(cross_chain): add asset_id check in cross_chain_in request (#177)
[bytom/vapor.git] / protocol / bc / types / vote_txoutput.go
1 package types
2
3 import (
4         "github.com/vapor/protocol/bc"
5 )
6
7 // VoteTxOutput satisfies the TypedOutput interface and represents a vote transaction.
8 type VoteTxOutput struct {
9         OutputCommitment
10         // Unconsumed suffixes of the commitment and witness extensible strings.
11         CommitmentSuffix []byte
12         Vote             []byte
13 }
14
15 // NewVoteOutput create a new output struct
16 func NewVoteOutput(assetID bc.AssetID, amount uint64, controlProgram []byte, vote []byte) *TxOutput {
17         return &TxOutput{
18                 AssetVersion: 1,
19                 TypedOutput: &VoteTxOutput{
20                         OutputCommitment: OutputCommitment{
21                                 AssetAmount: bc.AssetAmount{
22                                         AssetId: &assetID,
23                                         Amount:  amount,
24                                 },
25                                 VMVersion:      1,
26                                 ControlProgram: controlProgram,
27                         },
28                         Vote: vote,
29                 },
30         }
31 }
32
33 func (it *VoteTxOutput) OutputType() uint8 { return VoteOutputType }