OSDN Git Service

Peer add announces new block message num limit
[bytom/vapor.git] / asset / annotate.go
index 4156202..723e0bb 100644 (file)
@@ -4,21 +4,16 @@ import (
        "encoding/json"
 
        "github.com/vapor/blockchain/query"
+       chainjson "github.com/vapor/encoding/json"
 )
 
-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)
        }