diff options
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go')
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go index f42b70267..b2a8f57f8 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go @@ -24,7 +24,6 @@ import ( "fmt" "io" "sort" - "sync" "time" "github.com/dexon-foundation/dexon/rlp" @@ -47,15 +46,6 @@ const ( VerifyInvalidBlock ) -var ( - // blockPool is the blocks cache to reuse allocated blocks. - blockPool = sync.Pool{ - New: func() interface{} { - return &Block{} - }, - } -) - type rlpTimestamp struct { time.Time } @@ -133,19 +123,6 @@ type Witness struct { Data []byte `json:"data"` } -// RecycleBlock put unused block into cache, which might be reused if -// not garbage collected. -func RecycleBlock(b *Block) { - blockPool.Put(b) -} - -// NewBlock initiate a block. -func NewBlock() (b *Block) { - b = blockPool.Get().(*Block) - b.Acks = b.Acks[:0] - return -} - // Block represents a single event broadcasted on the network. type Block struct { ProposerID NodeID `json:"proposer_id"` @@ -226,7 +203,7 @@ func (b *Block) String() string { // Clone returns a deep copy of a block. func (b *Block) Clone() (bcopy *Block) { - bcopy = NewBlock() + bcopy = &Block{} bcopy.ProposerID = b.ProposerID bcopy.ParentHash = b.ParentHash bcopy.Hash = b.Hash |