diff options
author | Felix Lange <fjl@twurst.com> | 2015-07-06 07:19:16 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-09-15 05:36:30 +0800 |
commit | d581dfee5fbd46f3e6c54e3fab2717105e6bd510 (patch) | |
tree | d887358ad157d19f76dd71d4ff894daf27eb8585 /ethdb | |
parent | 8b32f10f16f19c0b8985399fafdfe31af29493a1 (diff) | |
download | go-tangerine-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar go-tangerine-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.gz go-tangerine-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.bz2 go-tangerine-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.lz go-tangerine-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.xz go-tangerine-d581dfee5fbd46f3e6c54e3fab2717105e6bd510.tar.zst go-tangerine-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.go | 3 |
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 } |