diff --git a/common/model/block.pb.go b/common/model/block.pb.go index 26909b7f7..bdd8d6f5a 100644 --- a/common/model/block.pb.go +++ b/common/model/block.pb.go @@ -1,13 +1,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: model/block.proto -package model +package model // import "github.com/zoobc/zoobc-core/common/model" -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -18,46 +16,46 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // Block represent the block data structure stored in the database type Block struct { - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - PreviousBlockHash []byte `protobuf:"bytes,2,opt,name=PreviousBlockHash,proto3" json:"PreviousBlockHash,omitempty"` - Height uint32 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` - Timestamp int64 `protobuf:"varint,4,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` - BlockSeed []byte `protobuf:"bytes,5,opt,name=BlockSeed,proto3" json:"BlockSeed,omitempty"` - BlockSignature []byte `protobuf:"bytes,6,opt,name=BlockSignature,proto3" json:"BlockSignature,omitempty"` - CumulativeDifficulty string `protobuf:"bytes,7,opt,name=CumulativeDifficulty,proto3" json:"CumulativeDifficulty,omitempty"` - SmithScale int64 `protobuf:"varint,8,opt,name=SmithScale,proto3" json:"SmithScale,omitempty"` - BlocksmithPublicKey []byte `protobuf:"bytes,9,opt,name=BlocksmithPublicKey,proto3" json:"BlocksmithPublicKey,omitempty"` - TotalAmount int64 `protobuf:"varint,10,opt,name=TotalAmount,proto3" json:"TotalAmount,omitempty"` - TotalFee int64 `protobuf:"varint,11,opt,name=TotalFee,proto3" json:"TotalFee,omitempty"` - TotalCoinBase int64 `protobuf:"varint,12,opt,name=TotalCoinBase,proto3" json:"TotalCoinBase,omitempty"` - Version uint32 `protobuf:"varint,13,opt,name=Version,proto3" json:"Version,omitempty"` - PayloadLength uint32 `protobuf:"varint,14,opt,name=PayloadLength,proto3" json:"PayloadLength,omitempty"` - PayloadHash []byte `protobuf:"bytes,15,opt,name=PayloadHash,proto3" json:"PayloadHash,omitempty"` - Transactions []*Transaction `protobuf:"bytes,16,rep,name=Transactions,proto3" json:"Transactions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + PreviousBlockHash []byte `protobuf:"bytes,2,opt,name=PreviousBlockHash,proto3" json:"PreviousBlockHash,omitempty"` + Height uint32 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` + Timestamp int64 `protobuf:"varint,4,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` + BlockSeed []byte `protobuf:"bytes,5,opt,name=BlockSeed,proto3" json:"BlockSeed,omitempty"` + BlockSignature []byte `protobuf:"bytes,6,opt,name=BlockSignature,proto3" json:"BlockSignature,omitempty"` + CumulativeDifficulty string `protobuf:"bytes,7,opt,name=CumulativeDifficulty,proto3" json:"CumulativeDifficulty,omitempty"` + SmithScale int64 `protobuf:"varint,8,opt,name=SmithScale,proto3" json:"SmithScale,omitempty"` + BlocksmithPublicKey []byte `protobuf:"bytes,9,opt,name=BlocksmithPublicKey,proto3" json:"BlocksmithPublicKey,omitempty"` + TotalAmount int64 `protobuf:"varint,10,opt,name=TotalAmount,proto3" json:"TotalAmount,omitempty"` + TotalFee int64 `protobuf:"varint,11,opt,name=TotalFee,proto3" json:"TotalFee,omitempty"` + TotalCoinBase int64 `protobuf:"varint,12,opt,name=TotalCoinBase,proto3" json:"TotalCoinBase,omitempty"` + Version uint32 `protobuf:"varint,13,opt,name=Version,proto3" json:"Version,omitempty"` + PayloadLength uint32 `protobuf:"varint,14,opt,name=PayloadLength,proto3" json:"PayloadLength,omitempty"` + PayloadHash []byte `protobuf:"bytes,15,opt,name=PayloadHash,proto3" json:"PayloadHash,omitempty"` + Transactions []*Transaction `protobuf:"bytes,16,rep,name=Transactions,proto3" json:"Transactions,omitempty"` + BlockReceipts []*BlockReceipt `protobuf:"bytes,17,rep,name=BlockReceipts,proto3" json:"BlockReceipts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Block) Reset() { *m = Block{} } func (m *Block) String() string { return proto.CompactTextString(m) } func (*Block) ProtoMessage() {} func (*Block) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{0} + return fileDescriptor_block_27040aed85a8bc82, []int{0} } - func (m *Block) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Block.Unmarshal(m, b) } func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Block.Marshal(b, m, deterministic) } -func (m *Block) XXX_Merge(src proto.Message) { - xxx_messageInfo_Block.Merge(m, src) +func (dst *Block) XXX_Merge(src proto.Message) { + xxx_messageInfo_Block.Merge(dst, src) } func (m *Block) XXX_Size() int { return xxx_messageInfo_Block.Size(m) @@ -180,6 +178,59 @@ func (m *Block) GetTransactions() []*Transaction { return nil } +func (m *Block) GetBlockReceipts() []*BlockReceipt { + if m != nil { + return m.BlockReceipts + } + return nil +} + +type BlockReceipt struct { + Receipt *Receipt `protobuf:"bytes,1,opt,name=Receipt,proto3" json:"Receipt,omitempty"` + IntermediateHashes [][]byte `protobuf:"bytes,2,rep,name=IntermediateHashes,proto3" json:"IntermediateHashes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockReceipt) Reset() { *m = BlockReceipt{} } +func (m *BlockReceipt) String() string { return proto.CompactTextString(m) } +func (*BlockReceipt) ProtoMessage() {} +func (*BlockReceipt) Descriptor() ([]byte, []int) { + return fileDescriptor_block_27040aed85a8bc82, []int{1} +} +func (m *BlockReceipt) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockReceipt.Unmarshal(m, b) +} +func (m *BlockReceipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockReceipt.Marshal(b, m, deterministic) +} +func (dst *BlockReceipt) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockReceipt.Merge(dst, src) +} +func (m *BlockReceipt) XXX_Size() int { + return xxx_messageInfo_BlockReceipt.Size(m) +} +func (m *BlockReceipt) XXX_DiscardUnknown() { + xxx_messageInfo_BlockReceipt.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockReceipt proto.InternalMessageInfo + +func (m *BlockReceipt) GetReceipt() *Receipt { + if m != nil { + return m.Receipt + } + return nil +} + +func (m *BlockReceipt) GetIntermediateHashes() [][]byte { + if m != nil { + return m.IntermediateHashes + } + return nil +} + // BlockExtendedInfo represent the Block data plus part of block data not to be persisted to database type BlockExtendedInfo struct { Block *Block `protobuf:"bytes,1,opt,name=Block,proto3" json:"Block,omitempty"` @@ -196,17 +247,16 @@ func (m *BlockExtendedInfo) Reset() { *m = BlockExtendedInfo{} } func (m *BlockExtendedInfo) String() string { return proto.CompactTextString(m) } func (*BlockExtendedInfo) ProtoMessage() {} func (*BlockExtendedInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{1} + return fileDescriptor_block_27040aed85a8bc82, []int{2} } - func (m *BlockExtendedInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockExtendedInfo.Unmarshal(m, b) } func (m *BlockExtendedInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BlockExtendedInfo.Marshal(b, m, deterministic) } -func (m *BlockExtendedInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockExtendedInfo.Merge(m, src) +func (dst *BlockExtendedInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockExtendedInfo.Merge(dst, src) } func (m *BlockExtendedInfo) XXX_Size() int { return xxx_messageInfo_BlockExtendedInfo.Size(m) @@ -269,17 +319,16 @@ func (m *GetBlockRequest) Reset() { *m = GetBlockRequest{} } func (m *GetBlockRequest) String() string { return proto.CompactTextString(m) } func (*GetBlockRequest) ProtoMessage() {} func (*GetBlockRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{2} + return fileDescriptor_block_27040aed85a8bc82, []int{3} } - func (m *GetBlockRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlockRequest.Unmarshal(m, b) } func (m *GetBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetBlockRequest.Marshal(b, m, deterministic) } -func (m *GetBlockRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetBlockRequest.Merge(m, src) +func (dst *GetBlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBlockRequest.Merge(dst, src) } func (m *GetBlockRequest) XXX_Size() int { return xxx_messageInfo_GetBlockRequest.Size(m) @@ -328,17 +377,16 @@ func (m *GetBlocksRequest) Reset() { *m = GetBlocksRequest{} } func (m *GetBlocksRequest) String() string { return proto.CompactTextString(m) } func (*GetBlocksRequest) ProtoMessage() {} func (*GetBlocksRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{3} + return fileDescriptor_block_27040aed85a8bc82, []int{4} } - func (m *GetBlocksRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlocksRequest.Unmarshal(m, b) } func (m *GetBlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetBlocksRequest.Marshal(b, m, deterministic) } -func (m *GetBlocksRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetBlocksRequest.Merge(m, src) +func (dst *GetBlocksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBlocksRequest.Merge(dst, src) } func (m *GetBlocksRequest) XXX_Size() int { return xxx_messageInfo_GetBlocksRequest.Size(m) @@ -388,17 +436,16 @@ func (m *GetBlocksResponse) Reset() { *m = GetBlocksResponse{} } func (m *GetBlocksResponse) String() string { return proto.CompactTextString(m) } func (*GetBlocksResponse) ProtoMessage() {} func (*GetBlocksResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{4} + return fileDescriptor_block_27040aed85a8bc82, []int{5} } - func (m *GetBlocksResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlocksResponse.Unmarshal(m, b) } func (m *GetBlocksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetBlocksResponse.Marshal(b, m, deterministic) } -func (m *GetBlocksResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetBlocksResponse.Merge(m, src) +func (dst *GetBlocksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBlocksResponse.Merge(dst, src) } func (m *GetBlocksResponse) XXX_Size() int { return xxx_messageInfo_GetBlocksResponse.Size(m) @@ -451,17 +498,16 @@ func (m *GetNextBlockIdsRequest) Reset() { *m = GetNextBlockIdsRequest{} func (m *GetNextBlockIdsRequest) String() string { return proto.CompactTextString(m) } func (*GetNextBlockIdsRequest) ProtoMessage() {} func (*GetNextBlockIdsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{5} + return fileDescriptor_block_27040aed85a8bc82, []int{6} } - func (m *GetNextBlockIdsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetNextBlockIdsRequest.Unmarshal(m, b) } func (m *GetNextBlockIdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetNextBlockIdsRequest.Marshal(b, m, deterministic) } -func (m *GetNextBlockIdsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetNextBlockIdsRequest.Merge(m, src) +func (dst *GetNextBlockIdsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNextBlockIdsRequest.Merge(dst, src) } func (m *GetNextBlockIdsRequest) XXX_Size() int { return xxx_messageInfo_GetNextBlockIdsRequest.Size(m) @@ -504,17 +550,16 @@ func (m *BlockIdsResponse) Reset() { *m = BlockIdsResponse{} } func (m *BlockIdsResponse) String() string { return proto.CompactTextString(m) } func (*BlockIdsResponse) ProtoMessage() {} func (*BlockIdsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{6} + return fileDescriptor_block_27040aed85a8bc82, []int{7} } - func (m *BlockIdsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockIdsResponse.Unmarshal(m, b) } func (m *BlockIdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BlockIdsResponse.Marshal(b, m, deterministic) } -func (m *BlockIdsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockIdsResponse.Merge(m, src) +func (dst *BlockIdsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockIdsResponse.Merge(dst, src) } func (m *BlockIdsResponse) XXX_Size() int { return xxx_messageInfo_BlockIdsResponse.Size(m) @@ -546,17 +591,16 @@ func (m *GetNextBlocksRequest) Reset() { *m = GetNextBlocksRequest{} } func (m *GetNextBlocksRequest) String() string { return proto.CompactTextString(m) } func (*GetNextBlocksRequest) ProtoMessage() {} func (*GetNextBlocksRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{7} + return fileDescriptor_block_27040aed85a8bc82, []int{8} } - func (m *GetNextBlocksRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetNextBlocksRequest.Unmarshal(m, b) } func (m *GetNextBlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetNextBlocksRequest.Marshal(b, m, deterministic) } -func (m *GetNextBlocksRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetNextBlocksRequest.Merge(m, src) +func (dst *GetNextBlocksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNextBlocksRequest.Merge(dst, src) } func (m *GetNextBlocksRequest) XXX_Size() int { return xxx_messageInfo_GetNextBlocksRequest.Size(m) @@ -599,17 +643,16 @@ func (m *BlocksData) Reset() { *m = BlocksData{} } func (m *BlocksData) String() string { return proto.CompactTextString(m) } func (*BlocksData) ProtoMessage() {} func (*BlocksData) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{8} + return fileDescriptor_block_27040aed85a8bc82, []int{9} } - func (m *BlocksData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlocksData.Unmarshal(m, b) } func (m *BlocksData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BlocksData.Marshal(b, m, deterministic) } -func (m *BlocksData) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlocksData.Merge(m, src) +func (dst *BlocksData) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlocksData.Merge(dst, src) } func (m *BlocksData) XXX_Size() int { return xxx_messageInfo_BlocksData.Size(m) @@ -640,17 +683,16 @@ func (m *SendBlockRequest) Reset() { *m = SendBlockRequest{} } func (m *SendBlockRequest) String() string { return proto.CompactTextString(m) } func (*SendBlockRequest) ProtoMessage() {} func (*SendBlockRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_baa78346dbb08dbe, []int{9} + return fileDescriptor_block_27040aed85a8bc82, []int{10} } - func (m *SendBlockRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendBlockRequest.Unmarshal(m, b) } func (m *SendBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SendBlockRequest.Marshal(b, m, deterministic) } -func (m *SendBlockRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendBlockRequest.Merge(m, src) +func (dst *SendBlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendBlockRequest.Merge(dst, src) } func (m *SendBlockRequest) XXX_Size() int { return xxx_messageInfo_SendBlockRequest.Size(m) @@ -684,6 +726,7 @@ func (m *SendBlockRequest) GetSenderPublicKey() []byte { func init() { proto.RegisterType((*Block)(nil), "model.Block") + proto.RegisterType((*BlockReceipt)(nil), "model.BlockReceipt") proto.RegisterType((*BlockExtendedInfo)(nil), "model.BlockExtendedInfo") proto.RegisterType((*GetBlockRequest)(nil), "model.GetBlockRequest") proto.RegisterType((*GetBlocksRequest)(nil), "model.GetBlocksRequest") @@ -695,53 +738,58 @@ func init() { proto.RegisterType((*SendBlockRequest)(nil), "model.SendBlockRequest") } -func init() { proto.RegisterFile("model/block.proto", fileDescriptor_baa78346dbb08dbe) } - -var fileDescriptor_baa78346dbb08dbe = []byte{ - // 720 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0xda, 0x4a, - 0x10, 0x96, 0x21, 0x90, 0x30, 0x40, 0x02, 0xfb, 0xa2, 0xbc, 0xd5, 0x53, 0x14, 0x59, 0x56, 0x14, - 0x59, 0x4f, 0x29, 0x44, 0x54, 0xea, 0x21, 0xb7, 0x00, 0x6d, 0x82, 0x1a, 0x55, 0xc8, 0xa0, 0x1c, - 0x5a, 0xa9, 0xd2, 0x62, 0x4f, 0x60, 0x5b, 0xdb, 0x4b, 0xed, 0x75, 0x14, 0x7a, 0xe8, 0x7f, 0xe8, - 0x0f, 0xec, 0xb9, 0x7f, 0xa3, 0x62, 0x6d, 0x63, 0x43, 0x83, 0x9a, 0x43, 0x2f, 0x91, 0xe7, 0xfb, - 0x26, 0xf3, 0xcd, 0xec, 0x7e, 0xb3, 0x40, 0xd3, 0x13, 0x0e, 0xba, 0xed, 0x89, 0x2b, 0xec, 0xcf, - 0xad, 0x79, 0x20, 0xa4,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 0x7d, 0xce, 0x22, 0xae, 0xcd, 0x53, 0xd8, - 0x9c, 0xc7, 0x84, 0x83, 0x65, 0x55, 0x0c, 0xb2, 0x87, 0xb1, 0xa8, 0x9e, 0x8f, 0x4d, 0xb8, 0xfb, - 0xff, 0x7b, 0x73, 0xca, 0xe5, 0x2c, 0x9a, 0xb4, 0x6c, 0xe1, 0xb5, 0xbf, 0x0a, 0x31, 0xb1, 0xe3, - 0xbf, 0x2f, 0x6c, 0x11, 0x60, 0xdb, 0x16, 0x9e, 0x27, 0xfc, 0xb6, 0x6a, 0x60, 0x52, 0x56, 0xbf, - 0x4e, 0x2f, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x72, 0x28, 0x7d, 0x70, 0xd2, 0x06, 0x00, 0x00, +func init() { proto.RegisterFile("model/block.proto", fileDescriptor_block_27040aed85a8bc82) } + +var fileDescriptor_block_27040aed85a8bc82 = []byte{ + // 786 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5d, 0x6b, 0xe3, 0x46, + 0x14, 0x45, 0xd2, 0x3a, 0x89, 0xaf, 0xed, 0x24, 0x9e, 0x84, 0xed, 0xb0, 0x2c, 0x8b, 0x10, 0xcb, + 0x22, 0xca, 0xd6, 0x09, 0x29, 0x14, 0xba, 0x6f, 0x89, 0xd3, 0xee, 0x9a, 0x2e, 0x25, 0x28, 0x66, + 0x1f, 0x5a, 0x28, 0x8c, 0xa5, 0x1b, 0x6b, 0x5a, 0x49, 0xe3, 0x6a, 0x46, 0xcb, 0xba, 0x0f, 0xfd, + 0x0f, 0x7d, 0xeb, 0x3f, 0xec, 0xdf, 0x28, 0x1e, 0x8d, 0xbe, 0x5c, 0x9b, 0xe6, 0x61, 0x5f, 0x8c, + 0xe6, 0x9c, 0x3b, 0xf7, 0xdc, 0x3b, 0x73, 0xcf, 0x18, 0xc6, 0xa9, 0x88, 0x30, 0xb9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0x91, 0x9d, 0x3f, 0x87, 0x43, 0xb3, 0xa1, 0x75, 0xb8, 0x15, 0xd4, 0x9c, 0x8b, 0xd3, + 0x3a, 0x17, 0xef, 0x0a, 0x4e, 0x1b, 0x11, 0xd3, 0xfd, 0x0b, 0x38, 0xaa, 0x30, 0x6a, 0xb9, 0x4e, + 0xf5, 0x86, 0x54, 0x98, 0x97, 0xc3, 0x79, 0xbb, 0xbe, 0xcf, 0x52, 0x5d, 0x5b, 0xd3, 0xd9, 0xa1, + 0xf9, 0x06, 0xa0, 0x14, 0xbb, 0x65, 0x8a, 0x91, 0xd7, 0x00, 0x8d, 0xbc, 0xae, 0x71, 0xdb, 0x4b, + 0x2d, 0xde, 0xfb, 0x13, 0x4e, 0xef, 0x31, 0x8b, 0x3a, 0x13, 0xfa, 0x18, 0x23, 0x76, 0xfa, 0xb1, + 0xb7, 0xfb, 0xf1, 0xe1, 0x64, 0x93, 0x15, 0xf3, 0xe6, 0xf5, 0x76, 0xf4, 0x1b, 0xb7, 0x0d, 0xdf, + 0x7c, 0xf9, 0x93, 0xbf, 0xe4, 0x2a, 0x2e, 0x16, 0x93, 0x50, 0xa4, 0x17, 0x7f, 0x08, 0xb1, 0x08, + 0xcb, 0xdf, 0xaf, 0x42, 0x91, 0xe3, 0x45, 0x28, 0xd2, 0x54, 0x64, 0x17, 0xba, 0x80, 0xc5, 0x81, + 0xfe, 0x0b, 0xfd, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xb2, 0x04, 0x6f, 0x8c, 0x07, + 0x00, 0x00, } diff --git a/common/schema b/common/schema index a39ae5f79..eb85b77ea 160000 --- a/common/schema +++ b/common/schema @@ -1 +1 @@ -Subproject commit a39ae5f79f6d911514b42667d148c9fef0e26a5d +Subproject commit eb85b77ea8ea9284ef488c69d2b20ced4c95f91e diff --git a/core/service/blockCoreService.go b/core/service/blockCoreService.go index 483ef4ef8..ead6352d2 100644 --- a/core/service/blockCoreService.go +++ b/core/service/blockCoreService.go @@ -31,11 +31,12 @@ type ( VerifySeed(seed, score *big.Int, previousBlock *model.Block, timestamp int64) bool NewBlock(version uint32, previousBlockHash []byte, blockSeed, blockSmithPublicKey []byte, hash string, previousBlockHeight uint32, timestamp int64, totalAmount int64, totalFee int64, totalCoinBase int64, - transactions []*model.Transaction, payloadHash []byte, payloadLength uint32, secretPhrase string) *model.Block + transactions []*model.Transaction, blockReceipts []*model.BlockReceipt, payloadHash []byte, payloadLength uint32, + secretPhrase string) *model.Block NewGenesisBlock(version uint32, previousBlockHash []byte, blockSeed, blockSmithPublicKey []byte, hash string, previousBlockHeight uint32, timestamp int64, totalAmount int64, totalFee int64, totalCoinBase int64, - transactions []*model.Transaction, payloadHash []byte, payloadLength uint32, smithScale int64, cumulativeDifficulty *big.Int, - genesisSignature []byte) *model.Block + transactions []*model.Transaction, blockReceipts []*model.BlockReceipt, payloadHash []byte, payloadLength uint32, smithScale int64, + cumulativeDifficulty *big.Int, genesisSignature []byte) *model.Block GenerateBlock( previousBlock *model.Block, secretPhrase string, @@ -128,6 +129,7 @@ func (bs *BlockService) NewBlock( totalFee, totalCoinBase int64, transactions []*model.Transaction, + blockReceipts []*model.BlockReceipt, payloadHash []byte, payloadLength uint32, secretPhrase string, @@ -143,6 +145,7 @@ func (bs *BlockService) NewBlock( TotalFee: totalFee, TotalCoinBase: totalCoinBase, Transactions: transactions, + BlockReceipts: blockReceipts, PayloadHash: payloadHash, PayloadLength: payloadLength, } @@ -174,6 +177,7 @@ func (bs *BlockService) NewGenesisBlock( previousBlockHeight uint32, timestamp, totalAmount, totalFee, totalCoinBase int64, transactions []*model.Transaction, + blockReceipts []*model.BlockReceipt, payloadHash []byte, payloadLength uint32, smithScale int64, @@ -191,6 +195,7 @@ func (bs *BlockService) NewGenesisBlock( TotalFee: totalFee, TotalCoinBase: totalCoinBase, Transactions: transactions, + BlockReceipts: blockReceipts, PayloadLength: payloadLength, PayloadHash: payloadHash, SmithScale: smithScale, @@ -332,6 +337,7 @@ func (bs *BlockService) PushBlock(previousBlock, block *model.Block, needLock, b } } } + // todo: save receipts of block to network_receipt table err = bs.QueryExecutor.CommitTx() if err != nil { // commit automatically unlock executor and close tx return err @@ -525,6 +531,7 @@ func (bs *BlockService) GenerateBlock( payloadLength uint32 // only for mainchain sortedTx []*model.Transaction + blockReceipts []*model.BlockReceipt payloadHash []byte digest = sha3.New256() blockSmithPublicKey = util.GetPublicKeyFromSeed(secretPhrase) @@ -550,6 +557,7 @@ func (bs *BlockService) GenerateBlock( totalFee += tx.Fee payloadLength += txType.GetSize() } + // todo: select receipts here to publish & hash the receipts in payload hash payloadHash = digest.Sum([]byte{}) } @@ -580,6 +588,7 @@ func (bs *BlockService) GenerateBlock( totalFee, totalCoinbase, sortedTx, + blockReceipts, payloadHash, payloadLength, secretPhrase, @@ -621,6 +630,7 @@ func (bs *BlockService) AddGenesis() error { totalFee, totalCoinBase, blockTransactions, + []*model.BlockReceipt{}, payloadHash, payloadLength, constant.InitialSmithScale, diff --git a/core/service/blockCoreService_test.go b/core/service/blockCoreService_test.go index f55154c12..bfc4b5b1c 100644 --- a/core/service/blockCoreService_test.go +++ b/core/service/blockCoreService_test.go @@ -363,6 +363,7 @@ func TestBlockService_NewBlock(t *testing.T) { totalFee int64 totalCoinBase int64 transactions []*model.Transaction + blockReceipts []*model.BlockReceipt payloadHash []byte payloadLength uint32 secretPhrase string @@ -391,6 +392,7 @@ func TestBlockService_NewBlock(t *testing.T) { totalFee: 0, totalCoinBase: 0, transactions: []*model.Transaction{}, + blockReceipts: []*model.BlockReceipt{}, payloadHash: []byte{}, payloadLength: 0, secretPhrase: "secretphrase", @@ -405,6 +407,7 @@ func TestBlockService_NewBlock(t *testing.T) { TotalFee: 0, TotalCoinBase: 0, Transactions: []*model.Transaction{}, + BlockReceipts: []*model.BlockReceipt{}, PayloadHash: []byte{}, PayloadLength: 0, BlockSignature: []byte{}, @@ -434,6 +437,7 @@ func TestBlockService_NewBlock(t *testing.T) { tt.args.totalFee, tt.args.totalCoinBase, tt.args.transactions, + tt.args.blockReceipts, tt.args.payloadHash, tt.args.payloadLength, tt.args.secretPhrase, @@ -466,6 +470,7 @@ func TestBlockService_NewGenesisBlock(t *testing.T) { totalFee int64 totalCoinBase int64 transactions []*model.Transaction + blockReceipts []*model.BlockReceipt payloadHash []byte payloadLength uint32 smithScale int64 @@ -496,6 +501,7 @@ func TestBlockService_NewGenesisBlock(t *testing.T) { totalFee: 0, totalCoinBase: 0, transactions: []*model.Transaction{}, + blockReceipts: []*model.BlockReceipt{}, payloadHash: []byte{}, payloadLength: 8, smithScale: 0, @@ -512,6 +518,7 @@ func TestBlockService_NewGenesisBlock(t *testing.T) { TotalFee: 0, TotalCoinBase: 0, Transactions: []*model.Transaction{}, + BlockReceipts: []*model.BlockReceipt{}, PayloadHash: []byte{}, PayloadLength: 8, SmithScale: 0, @@ -543,6 +550,7 @@ func TestBlockService_NewGenesisBlock(t *testing.T) { tt.args.totalFee, tt.args.totalCoinBase, tt.args.transactions, + tt.args.blockReceipts, tt.args.payloadHash, tt.args.payloadLength, tt.args.smithScale,