From 6247fe8edf292f8d3101d09fbdee646081f68009 Mon Sep 17 00:00:00 2001 From: laizy Date: Thu, 24 May 2018 11:59:39 +0800 Subject: [PATCH] fix block hash race condition --- core/ledger/block.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/ledger/block.go b/core/ledger/block.go index 34d0cb32..4ede4845 100644 --- a/core/ledger/block.go +++ b/core/ledger/block.go @@ -131,8 +131,8 @@ func (b *Block) GetPrograms() []*program.Program { func (b *Block) Hash() Uint256 { if b.hash == nil { - b.hash = new(Uint256) - *b.hash = b.Blockdata.Hash() + hash = b.Blockdata.Hash() + b.hash = &hash } return *b.hash }