OSDN Git Service

refactor: change asset.Definition encoding (#250)
authorHAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
Mon, 8 Jul 2019 07:11:37 +0000 (15:11 +0800)
committerPaladz <yzhu101@uottawa.ca>
Mon, 8 Jul 2019 07:11:37 +0000 (15:11 +0800)
federation/database/orm/asset.go
federation/synchron/mainchain_keeper.go

index f1fbb05..1672ce9 100644 (file)
@@ -5,11 +5,11 @@ import (
 )
 
 type Asset struct {
-       ID                uint64          `gorm:"primary_key;foreignkey:ID" json:"-"`
-       AssetID           string          `json:"asset_id"`
-       IssuanceProgram   string          `json:"-"`
-       VMVersion         uint64          `json:"-"`
-       RawDefinitionByte string          `json:"-"`
-       CreatedAt         types.Timestamp `json:"-"`
-       UpdatedAt         types.Timestamp `json:"-"`
+       ID              uint64          `gorm:"primary_key;foreignkey:ID" json:"-"`
+       AssetID         string          `json:"asset_id"`
+       IssuanceProgram string          `json:"-"`
+       VMVersion       uint64          `json:"-"`
+       Definition      string          `json:"-"`
+       CreatedAt       types.Timestamp `json:"-"`
+       UpdatedAt       types.Timestamp `json:"-"`
 }
index aeae20a..e3ea7a3 100644 (file)
@@ -314,10 +314,10 @@ func (m *mainchainKeeper) processIssuing(txs []*types.Tx) error {
                                }
 
                                m.assetStore.Add(&orm.Asset{
-                                       AssetID:           assetID.String(),
-                                       IssuanceProgram:   hex.EncodeToString(inp.IssuanceProgram),
-                                       VMVersion:         inp.VMVersion,
-                                       RawDefinitionByte: hex.EncodeToString(inp.AssetDefinition),
+                                       AssetID:         assetID.String(),
+                                       IssuanceProgram: hex.EncodeToString(inp.IssuanceProgram),
+                                       VMVersion:       inp.VMVersion,
+                                       Definition:      string(inp.AssetDefinition),
                                })
                        }
                }