OSDN Git Service

Tx validate mining (#237)
[bytom/vapor.git] / protocol / bc / types / vote_output.go
1 package types
2
3 import (
4         "github.com/vapor/protocol/bc"
5 )
6
7 // VoteOutput satisfies the TypedOutput interface and represents a vote transaction.
8 type VoteOutput 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: &VoteOutput{
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 *VoteOutput) OutputType() uint8 { return VoteOutputType }