OSDN Git Service

d25a0aaa00b77ff603b68dc92408e1fce6c35ee8
[bytom/vapor.git] / consensus / consensus / vote_type.go
1 package consensus
2
3 import (
4         "github.com/vapor/crypto/ed25519/chainkd"
5         chainjson "github.com/vapor/encoding/json"
6 )
7
8 // serflag variables for input types.
9 const (
10         DelegateInfoType uint8 = iota
11         RegisterType
12         VoteType
13         CancelVoteType
14 )
15
16 type TypedData interface {
17         DataType() uint8
18 }
19
20 // DELEGATE_IDS PUBKEY SIG(block.time)
21 type DelegateInfoList struct {
22         Delegate DelegateInfo
23         Xpub     chainkd.XPub
24         SigTime  []chainjson.HexBytes `json:"sig_time"`
25 }
26
27 func (d *DelegateInfoList) DataType() uint8 { return DelegateInfoType }
28
29 type RegisterForgerData struct {
30         Name string `json:"name"`
31 }
32
33 func (d *RegisterForgerData) DataType() uint8 { return RegisterType }
34
35 type VoteForgerData struct {
36         Forgers []string `json:"Forgers"`
37 }
38
39 func (d *VoteForgerData) DataType() uint8 { return VoteType }
40
41 type CancelVoteForgerData struct {
42         Forgers []string `json:"Forgers"`
43 }
44
45 func (d *CancelVoteForgerData) DataType() uint8 { return CancelVoteType }