aboutsummaryrefslogtreecommitdiffstats
path: root/ethdb
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-07-06 07:19:16 +0800
committerFelix Lange <fjl@twurst.com>2015-09-15 05:36:30 +0800
commitd581dfee5fbd46f3e6c54e3fab2717105e6bd510 (patch)
treed887358ad157d19f76dd71d4ff894daf27eb8585 /ethdb
parent8b32f10f16f19c0b8985399fafdfe31af29493a1 (diff)
downloaddexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar
dexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.gz
dexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.bz2
dexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.lz
dexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.xz
dexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.zst
dexon-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.zip
ethdb: copy stored memdb values
Storing a value in LevelDB copies the bytes, modifying the value afterwards does not affect the content of the database. This commit ensures that MemDatabase satisfies the same property.
Diffstat (limited to 'ethdb')
-rw-r--r--ethdb/memory_database.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/ethdb/memory_database.go b/ethdb/memory_database.go
index 4fcce1812..fd5663fec 100644
--- a/ethdb/memory_database.go
+++ b/ethdb/memory_database.go
@@ -36,8 +36,7 @@ func NewMemDatabase() (*MemDatabase, error) {
}
func (db *MemDatabase) Put(key []byte, value []byte) error {
- db.db[string(key)] = value
-
+ db.db[string(key)] = common.CopyBytes(value)
return nil
}