diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-15 06:41:00 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-15 06:41:00 +0800 |
commit | 266d21209478bdb8c89e1ffb95d7f0de34635968 (patch) | |
tree | ab5075cda6492eee554ad234e4c36734767d2534 /tests/helper/trie.go | |
parent | 3d177be73e127b08a52988fde308eed29eac4699 (diff) | |
download | go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.gz go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.bz2 go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.lz go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.xz go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.zst go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.zip |
Working on test suite
Diffstat (limited to 'tests/helper/trie.go')
-rw-r--r-- | tests/helper/trie.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/helper/trie.go b/tests/helper/trie.go new file mode 100644 index 000000000..af828685c --- /dev/null +++ b/tests/helper/trie.go @@ -0,0 +1,31 @@ +package helper + +import "github.com/ethereum/eth-go/ethtrie" + +type MemDatabase struct { + db map[string][]byte +} + +func NewMemDatabase() (*MemDatabase, error) { + db := &MemDatabase{db: make(map[string][]byte)} + return db, nil +} +func (db *MemDatabase) Put(key []byte, value []byte) { + db.db[string(key)] = value +} +func (db *MemDatabase) Get(key []byte) ([]byte, error) { + return db.db[string(key)], nil +} +func (db *MemDatabase) Delete(key []byte) error { + delete(db.db, string(key)) + return nil +} +func (db *MemDatabase) Print() {} +func (db *MemDatabase) Close() {} +func (db *MemDatabase) LastKnownTD() []byte { return nil } + +func NewTrie() *ethtrie.Trie { + db, _ := NewMemDatabase() + + return ethtrie.New(db, "") +} |