Commit 54486d7a authored by Zahoor Mohamed's avatar Zahoor Mohamed Committed by GitHub

P2 - remove rlp dependency from shed package (#72)

parent 4c75c749
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
package shed package shed
import ( import (
"github.com/ethereum/go-ethereum/rlp" "encoding/json"
"github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb"
) )
...@@ -48,12 +48,12 @@ func (f StructField) Get(val interface{}) (err error) { ...@@ -48,12 +48,12 @@ func (f StructField) Get(val interface{}) (err error) {
if err != nil { if err != nil {
return err return err
} }
return rlp.DecodeBytes(b, val) return json.Unmarshal(b, val)
} }
// Put marshals provided val and saves it to the database. // Put marshals provided val and saves it to the database.
func (f StructField) Put(val interface{}) (err error) { func (f StructField) Put(val interface{}) (err error) {
b, err := rlp.EncodeToBytes(val) b, err := json.Marshal(val)
if err != nil { if err != nil {
return err return err
} }
...@@ -62,7 +62,7 @@ func (f StructField) Put(val interface{}) (err error) { ...@@ -62,7 +62,7 @@ func (f StructField) Put(val interface{}) (err error) {
// PutInBatch marshals provided val and puts it into the batch. // PutInBatch marshals provided val and puts it into the batch.
func (f StructField) PutInBatch(batch *leveldb.Batch, val interface{}) (err error) { func (f StructField) PutInBatch(batch *leveldb.Batch, val interface{}) (err error) {
b, err := rlp.EncodeToBytes(val) b, err := json.Marshal(val)
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment