OSDN Git Service

rename unvote to veto (#191)
[bytom/vapor.git] / protocol / bc / types / veto_input.go
1 package types
2
3 import (
4         "github.com/vapor/protocol/bc"
5 )
6
7 // VetoInput satisfies the TypedInput interface and represents a veto transaction.
8 type VetoInput struct {
9         VetoCommitmentSuffix []byte   // The unconsumed suffix of the output commitment
10         Arguments            [][]byte // Witness
11         Vote                 []byte   // voter xpub
12         SpendCommitment
13 }
14
15 // NewVetoInput create a new VetoInput struct.
16 func NewVetoInput(arguments [][]byte, sourceID bc.Hash, assetID bc.AssetID, amount, sourcePos uint64, controlProgram []byte, vote []byte) *TxInput {
17         sc := SpendCommitment{
18                 AssetAmount: bc.AssetAmount{
19                         AssetId: &assetID,
20                         Amount:  amount,
21                 },
22                 SourceID:       sourceID,
23                 SourcePosition: sourcePos,
24                 VMVersion:      1,
25                 ControlProgram: controlProgram,
26         }
27         return &TxInput{
28                 AssetVersion: 1,
29                 TypedInput: &VetoInput{
30                         SpendCommitment: sc,
31                         Arguments:       arguments,
32                         Vote:            vote,
33                 },
34         }
35 }
36
37 // InputType is the interface function for return the input type.
38 func (ui *VetoInput) InputType() uint8 { return VetoInputType }