diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-11 13:28:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 13:28:44 +0800 |
commit | 582a491aa0bcb784ac7b65ebbfb42139945ea703 (patch) | |
tree | 8589bad986f512455717728012c3d9edf3b68c4f /core/types | |
parent | 2439f49063d8498eadf26d4fa1220c5eac8412a8 (diff) | |
download | dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.gz dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.bz2 dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.lz dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.xz dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.zst dexon-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.zip |
core: timestamp (#98)
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/block.go | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/core/types/block.go b/core/types/block.go index f02b1a0..3585a97 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -52,24 +52,19 @@ func NewBlock() (b *Block) { delete(b.Acks, k) } } - if b.Timestamps != nil { - for k := range b.Timestamps { - delete(b.Timestamps, k) - } - } return } // Block represents a single event broadcasted on the network. type Block struct { - ProposerID ValidatorID `json:"proposer_id"` - ParentHash common.Hash `json:"parent_hash"` - Hash common.Hash `json:"hash"` - Position Position `json:"position"` - Timestamps map[ValidatorID]time.Time `json:"timestamps"` - Acks map[common.Hash]struct{} `json:"acks"` - Payloads [][]byte `json:"payloads"` - Signature crypto.Signature `json:"signature"` + ProposerID ValidatorID `json:"proposer_id"` + ParentHash common.Hash `json:"parent_hash"` + Hash common.Hash `json:"hash"` + Position Position `json:"position"` + Timestamp 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"` @@ -94,13 +89,7 @@ func (b *Block) Clone() (bcopy *Block) { bcopy.CRSSignature = b.CRSSignature.Clone() bcopy.Notary.Timestamp = b.Notary.Timestamp bcopy.Notary.Height = b.Notary.Height - if bcopy.Timestamps == nil { - bcopy.Timestamps = make( - map[ValidatorID]time.Time, len(b.Timestamps)) - } - for k, v := range b.Timestamps { - bcopy.Timestamps[k] = v - } + bcopy.Timestamp = b.Timestamp if bcopy.Acks == nil { bcopy.Acks = make(map[common.Hash]struct{}, len(b.Acks)) } |