aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-06-21 02:31:11 +0800
committerobscuren <geffobscura@gmail.com>2015-06-21 22:59:15 +0800
commitc590b505ed92957baf2ab4baa1788c6b0ec862cc (patch)
tree473ddb052798c30a21c05abef4764bccf4ab4e0a /trie
parent3deded28a50398b8ce108c72f27ea861c1bce178 (diff)
downloadgo-tangerine-c590b505ed92957baf2ab4baa1788c6b0ec862cc.tar.gz
go-tangerine-c590b505ed92957baf2ab4baa1788c6b0ec862cc.tar.zst
go-tangerine-c590b505ed92957baf2ab4baa1788c6b0ec862cc.zip
core, ethdb, trie: validate database errors
Diffstat (limited to 'trie')
-rw-r--r--trie/cache.go8
1 files changed, 6 insertions, 2 deletions
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