OSDN Git Service

fix reorganize vote result (#151)
[bytom/vapor.git] / wallet / indexer.go
index 2afcfa4..f3b7d57 100644 (file)
@@ -88,12 +88,10 @@ func saveExternalAssetDefinition(b *types.Block, walletDB dbm.DB) {
 
        for _, tx := range b.Transactions {
                for _, orig := range tx.Inputs {
-                       if ii, ok := orig.TypedInput.(*types.IssuanceInput); ok {
-                               if isValidJSON(ii.AssetDefinition) {
-                                       assetID := ii.AssetID()
-                                       if assetExist := walletDB.Get(asset.ExtAssetKey(&assetID)); assetExist == nil {
-                                               storeBatch.Set(asset.ExtAssetKey(&assetID), ii.AssetDefinition)
-                                       }
+                       if cci, ok := orig.TypedInput.(*types.CrossChainInput); ok {
+                               assetID := cci.AssetId
+                               if assetExist := walletDB.Get(asset.ExtAssetKey(assetID)); assetExist == nil {
+                                       storeBatch.Set(asset.ExtAssetKey(assetID), cci.AssetDefinition)
                                }
                        }
                }
@@ -160,7 +158,7 @@ transactionLoop:
                statusFail, _ := txStatus.GetStatus(pos)
                for _, v := range tx.Outputs {
                        var hash [32]byte
-                       sha3pool.Sum256(hash[:], v.ControlProgram)
+                       sha3pool.Sum256(hash[:], v.ControlProgram())
 
                        if bytes := w.DB.Get(account.ContractKey(hash)); bytes != nil {
                                annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))