From c590b505ed92957baf2ab4baa1788c6b0ec862cc Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 20 Jun 2015 20:31:11 +0200 Subject: core, ethdb, trie: validate database errors --- trie/cache.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'trie') diff --git a/trie/cache.go b/trie/cache.go index 2143785fa..4c76c6cba 100644 --- a/trie/cache.go +++ b/trie/cache.go @@ -1,8 +1,10 @@ package trie +import "github.com/ethereum/go-ethereum/logger/glog" + type Backend interface { Get([]byte) ([]byte, error) - Put([]byte, []byte) + Put([]byte, []byte) error } type Cache struct { @@ -29,7 +31,9 @@ func (self *Cache) Put(key []byte, data []byte) { func (self *Cache) Flush() { for k, v := range self.store { - self.backend.Put([]byte(k), v) + if err := self.backend.Put([]byte(k), v); err != nil { + glog.Fatal("db write err:", err) + } } // This will eventually grow too large. We'd could -- cgit