diff options
Diffstat (limited to 'core/types/block.go')
-rw-r--r-- | core/types/block.go | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/core/types/block.go b/core/types/block.go index 1a55121..f13d868 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -70,6 +70,7 @@ type Block struct { Height uint64 `json:"height"` Timestamps map[ValidatorID]time.Time `json:"timestamps"` Acks map[common.Hash]struct{} `json:"acks"` + Payloads [][]byte `json:"payloads"` Signature crypto.Signature `json:"signature"` CRSSignature crypto.Signature `json:"crs_signature"` @@ -77,29 +78,6 @@ type Block struct { Notary Notary `json:"notary"` } -// Block implements BlockConverter interface. -func (b *Block) Block() *Block { - return b -} - -// Payloads impelmemnts BlockConverter interface. -func (b *Block) Payloads() [][]byte { - return [][]byte{} -} - -// SetBlock implments BlockConverter interface. -func (b *Block) SetBlock(block *Block) { - *b = *block -} - -// BlockConverter interface define the interface for extracting block -// information from an existing object. -type BlockConverter interface { - Block() *Block - Payloads() [][]byte - SetBlock(block *Block) -} - func (b *Block) String() string { return fmt.Sprintf("Block(%v)", b.Hash.String()[:6]) } @@ -130,6 +108,11 @@ func (b *Block) Clone() (bcopy *Block) { for k, v := range b.Acks { bcopy.Acks[k] = v } + bcopy.Payloads = make([][]byte, len(b.Payloads)) + for k, v := range b.Payloads { + bcopy.Payloads[k] = make([]byte, len(v)) + copy(bcopy.Payloads[k], v) + } return } |