OSDN Git Service

fix the lock bug (#316)
[bytom/vapor.git] / asset / annotate.go
index 514166e..723e0bb 100644 (file)
@@ -5,22 +5,15 @@ import (
 
        "github.com/vapor/blockchain/query"
        chainjson "github.com/vapor/encoding/json"
-       "github.com/vapor/protocol/vm/vmutil"
 )
 
-func isValidJSON(b []byte) bool {
-       var v interface{}
-       err := json.Unmarshal(b, &v)
-       return err == nil
-}
-
 //Annotated annotate the asset
 func Annotated(a *Asset) (*query.AnnotatedAsset, error) {
        jsonDefinition := json.RawMessage(`{}`)
 
        // a.RawDefinitionByte is the asset definition as it appears on the
        // blockchain, so it's untrusted and may not be valid json.
-       if isValidJSON(a.RawDefinitionByte) {
+       if chainjson.IsValidJSON(a.RawDefinitionByte) {
                jsonDefinition = json.RawMessage(a.RawDefinitionByte)
        }
 
@@ -30,18 +23,7 @@ func Annotated(a *Asset) (*query.AnnotatedAsset, error) {
                VMVersion:         a.VMVersion,
                RawDefinitionByte: a.RawDefinitionByte,
                Definition:        &jsonDefinition,
-               IssuanceProgram:   chainjson.HexBytes(a.IssuanceProgram),
        }
 
-       annotatedAsset.LimitHeight = vmutil.GetIssuanceProgramRestrictHeight(a.IssuanceProgram)
-       if a.Signer != nil {
-               annotatedAsset.AnnotatedSigner = query.AnnotatedSigner{
-                       Type:       a.Signer.Type,
-                       XPubs:      a.Signer.XPubs,
-                       Quorum:     a.Signer.Quorum,
-                       KeyIndex:   a.Signer.KeyIndex,
-                       DeriveRule: a.Signer.DeriveRule,
-               }
-       }
        return annotatedAsset, nil
 }