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.
This commit is contained in:
Felix Lange 2015-07-06 01:19:16 +02:00
parent 8b32f10f16
commit d581dfee5f

@ -36,8 +36,7 @@ func NewMemDatabase() (*MemDatabase, error) {
} }
func (db *MemDatabase) Put(key []byte, value []byte) error { func (db *MemDatabase) Put(key []byte, value []byte) error {
db.db[string(key)] = value db.db[string(key)] = common.CopyBytes(value)
return nil return nil
} }