Make test TX implement trie.Object
package test
import (
+ "bytes"
"encoding/json"
"math/big"
"sync"
"github.com/icon-project/goloop/common"
"github.com/icon-project/goloop/common/crypto"
+ "github.com/icon-project/goloop/common/db"
+ "github.com/icon-project/goloop/common/merkle"
+ "github.com/icon-project/goloop/common/trie"
"github.com/icon-project/goloop/module"
"github.com/icon-project/goloop/service/contract"
"github.com/icon-project/goloop/service/scoredb"
@@ -224,6 +228,31 @@ func (t *Transaction) IsSkippable() bool {
return false
}
+func (t *Transaction) Reset(s db.Database, k []byte) error {
+ if err := json.Unmarshal(k, &t.json); err != nil {
+ return err
+ }
+ return nil
+}
+
+func (t *Transaction) Flush() error {
+ return nil
+}
+
+func (t *Transaction) Equal(object trie.Object) bool {
+ if tx, ok := object.(*Transaction); ok {
+ return bytes.Equal(tx.ID(), t.ID())
+ }
+ return false
+}
+
+func (t *Transaction) Resolve(builder merkle.Builder) error {
+ return nil
+}
+
+func (t *Transaction) ClearCache() {
+}
+
func checkJSONTX(tx map[string]interface{}) bool {
val, ok := tx["type"]
return ok && val=="test"
