OSDN Git Service

Add the implementation for dppos
[bytom/vapor.git] / consensus / consensus / dpos / vote_type.go
similarity index 71%
rename from consensus/consensus/vote_type.go
rename to consensus/consensus/dpos/vote_type.go
index d25a0aa..1dec1fb 100644 (file)
@@ -1,8 +1,9 @@
-package consensus
+package dpos
 
 import (
        "github.com/vapor/crypto/ed25519/chainkd"
        chainjson "github.com/vapor/encoding/json"
 
 import (
        "github.com/vapor/crypto/ed25519/chainkd"
        chainjson "github.com/vapor/encoding/json"
+       "github.com/vapor/protocol/vm"
 )
 
 // serflag variables for input types.
 )
 
 // serflag variables for input types.
@@ -17,11 +18,16 @@ type TypedData interface {
        DataType() uint8
 }
 
        DataType() uint8
 }
 
+type DposMsg struct {
+       Type vm.Op
+       Data []byte
+}
+
 // DELEGATE_IDS PUBKEY SIG(block.time)
 type DelegateInfoList struct {
 // DELEGATE_IDS PUBKEY SIG(block.time)
 type DelegateInfoList struct {
-       Delegate DelegateInfo
-       Xpub     chainkd.XPub
-       SigTime  []chainjson.HexBytes `json:"sig_time"`
+       Delegate DelegateInfo       `json:"delegate"`
+       Xpub     chainkd.XPub       `json:"xpub"`
+       SigTime  chainjson.HexBytes `json:"sig_time"`
 }
 
 func (d *DelegateInfoList) DataType() uint8 { return DelegateInfoType }
 }
 
 func (d *DelegateInfoList) DataType() uint8 { return DelegateInfoType }
@@ -33,13 +39,13 @@ type RegisterForgerData struct {
 func (d *RegisterForgerData) DataType() uint8 { return RegisterType }
 
 type VoteForgerData struct {
 func (d *RegisterForgerData) DataType() uint8 { return RegisterType }
 
 type VoteForgerData struct {
-       Forgers []string `json:"Forgers"`
+       Forgers []string `json:"forgers"`
 }
 
 func (d *VoteForgerData) DataType() uint8 { return VoteType }
 
 type CancelVoteForgerData struct {
 }
 
 func (d *VoteForgerData) DataType() uint8 { return VoteType }
 
 type CancelVoteForgerData struct {
-       Forgers []string `json:"Forgers"`
+       Forgers []string `json:"forgers"`
 }
 
 func (d *CancelVoteForgerData) DataType() uint8 { return CancelVoteType }
 }
 
 func (d *CancelVoteForgerData) DataType() uint8 { return CancelVoteType }