aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go
index 760646e10..b45af229b 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/blockdb/memory.go
@@ -124,6 +124,10 @@ func (m *MemBackedBlockDB) Put(block types.Block) error {
// Update updates a block in the database.
func (m *MemBackedBlockDB) Update(block types.Block) error {
+ if !m.Has(block.Hash) {
+ return ErrBlockDoesNotExist
+ }
+
m.blocksMutex.Lock()
defer m.blocksMutex.Unlock()