@ -36,6 +36,10 @@ func (db *LDBDatabase) Get(key []byte) ([]byte, error) {
return db.db.Get(key, nil)
}
func (db *LDBDatabase) Delete(key []byte) error {
return db.db.Delete(key, nil)
func (db *LDBDatabase) LastKnownTD() []byte {
data, _ := db.db.Get([]byte("LastKnownTotalDifficulty"), nil)
@ -26,6 +26,12 @@ 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() {
for key, val := range db.db {
fmt.Printf("%x(%d): ", key, len(key))
@ -4,6 +4,7 @@ package ethutil
type Database interface {
Put(key []byte, value []byte)
Get(key []byte) ([]byte, error)
Delete(key []byte) error
LastKnownTD() []byte
Close()
Print()