modify staking proto

pull/402/head
Minh Doan 6 years ago
parent 55b6f3be2c
commit 0fb2a43315
  1. 70
      api/proto/message/message.pb.go
  2. 6
      api/proto/message/message.proto
  3. 7
      api/service/staking/service.go
  4. 2
      cmd/harmony.go

@ -64,7 +64,6 @@ func (MessageType) EnumDescriptor() ([]byte, []int) {
// The request field will be either one of the structure corresponding to the MessageType type.
type Message struct {
Type MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=message.MessageType" json:"type,omitempty"`
Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
// Types that are valid to be assigned to Request:
// *Message_Staking
Request isMessage_Request `protobuf_oneof:"request"`
@ -105,13 +104,6 @@ func (m *Message) GetType() MessageType {
return MessageType_UNKNOWN
}
func (m *Message) GetSignature() string {
if m != nil {
return m.Signature
}
return ""
}
type isMessage_Request interface {
isMessage_Request()
}
@ -209,9 +201,8 @@ var xxx_messageInfo_BootNodeNewNodeRequest proto.InternalMessageInfo
// Staking Request from new node to beacon node.
type StakingRequest struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
PublicKey string `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
Transaction []byte `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
NodeId string `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -242,23 +233,16 @@ func (m *StakingRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_StakingRequest proto.InternalMessageInfo
func (m *StakingRequest) GetAddress() string {
func (m *StakingRequest) GetTransaction() []byte {
if m != nil {
return m.Address
return m.Transaction
}
return ""
}
func (m *StakingRequest) GetAmount() int64 {
if m != nil {
return m.Amount
}
return 0
return nil
}
func (m *StakingRequest) GetPublicKey() string {
func (m *StakingRequest) GetNodeId() string {
if m != nil {
return m.PublicKey
return m.NodeId
}
return ""
}
@ -274,25 +258,23 @@ func init() {
func init() { proto.RegisterFile("message.proto", fileDescriptor_33c57e4bae7b9afd) }
var fileDescriptor_33c57e4bae7b9afd = []byte{
// 307 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x51, 0x6b, 0xc2, 0x30,
0x14, 0x85, 0x8d, 0x3a, 0x4b, 0xaf, 0x4c, 0xca, 0x45, 0x5c, 0x19, 0x1b, 0x88, 0x4f, 0x65, 0x0f,
0x3e, 0xe8, 0x2f, 0xd0, 0x4d, 0xb6, 0x21, 0x4b, 0x21, 0x3a, 0x7c, 0x2c, 0x75, 0x5e, 0x44, 0x9c,
0xa6, 0x6b, 0x52, 0x46, 0xff, 0xc2, 0xde, 0xf6, 0x8f, 0x47, 0x9b, 0x46, 0xe7, 0x53, 0xcf, 0xf9,
0xce, 0xe9, 0x25, 0x37, 0x81, 0xeb, 0x03, 0x29, 0x15, 0x6f, 0x69, 0x98, 0xa4, 0x52, 0x4b, 0x74,
0x2a, 0x3b, 0xf8, 0x65, 0xe0, 0xbc, 0x19, 0x8d, 0x01, 0x34, 0x75, 0x9e, 0x90, 0xcf, 0xfa, 0x2c,
0xe8, 0x8c, 0xba, 0x43, 0xfb, 0x4b, 0x95, 0x2f, 0xf3, 0x84, 0x44, 0xd9, 0xc0, 0x3b, 0x70, 0xd5,
0x6e, 0x7b, 0x8c, 0x75, 0x96, 0x92, 0x5f, 0xef, 0xb3, 0xc0, 0x15, 0x67, 0x80, 0x63, 0x70, 0x94,
0x8e, 0xf7, 0xbb, 0xe3, 0xd6, 0x6f, 0xf4, 0x59, 0xd0, 0x1e, 0xdd, 0x9c, 0x46, 0x2d, 0x0c, 0x17,
0xf4, 0x95, 0x91, 0xd2, 0x2f, 0x35, 0x61, 0x9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0x03, 0x23,
0x03, 0x3a, 0x03, 0xc2, 0x82, 0x03, 0x8b, 0x9e, 0x82, 0xc4, 0x8f, 0xa2, 0xb8, 0x1e, 0x08, 0xaa,
0xa9, 0x49, 0x49, 0x57, 0x93, 0x21, 0xa5, 0x60, 0xf7, 0x6e, 0xb0, 0x7d, 0x8c, 0x18, 0x19, 0xd5,
0xac, 0x9d, 0x7b, 0x6f, 0x4c, 0xef, 0x61, 0x7e, 0xed, 0x25, 0xfb, 0x78, 0x1b, 0xee, 0xd8, 0x33,
0xb9, 0x79, 0x9f, 0x34, 0x5f, 0xb2, 0xf9, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xd6, 0xe4, 0x08,
0xa3, 0x01, 0x00, 0x00,
}

@ -17,7 +17,6 @@ enum MessageType {
// The request field will be either one of the structure corresponding to the MessageType type.
message Message {
MessageType type = 1;
string signature = 2;
oneof request {
StakingRequest staking = 3;
}
@ -33,7 +32,6 @@ message BootNodeNewNodeRequest {
// Staking Request from new node to beacon node.
message StakingRequest {
string address = 1;
int64 amount = 2;
string public_key = 4;
bytes transaction = 1;
string node_id = 2;
}

@ -4,7 +4,6 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/harmony-one/harmony/api/proto/message"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/internal/utils/contract"
"github.com/harmony-one/harmony/p2p"
)
@ -66,12 +65,10 @@ func (s *Service) createStakingMessage() *message.Message {
// To add public we need to assign a fake account to new node initially.
return &message.Message{
Type: message.MessageType_NEWNODE_BEACON_STAKING,
Signature: "",
Request: &message.Message_Staking{
Staking: &message.StakingRequest{
Address: contract.FakeAccounts[0].Address,
Amount: 1000,
PublicKey: "",
Transaction: []byte{},
NodeId: "",
},
},
}

@ -246,7 +246,7 @@ func main() {
if consensus.IsLeader {
currentNode.State = node.NodeLeader
} else {
go currentNode.JoinShard(leader)
// go currentNode.JoinShard(leader)
}
}

Loading…
Cancel
Save