// saveExternalAssetDefinition save external and local assets definition,
// when query ,query local first and if have no then query external
// details see getAliasDefinition
-func saveExternalAssetDefinition(b *types.Block, store WalletStorer) {
+func saveExternalAssetDefinition(b *types.Block, store WalletStorer) error {
store.InitBatch()
defer store.CommitBatch()
for _, orig := range tx.Inputs {
if cci, ok := orig.TypedInput.(*types.CrossChainInput); ok {
assetID := cci.AssetId
- if assetExist := store.GetAssetDefinition(assetID); assetExist == nil {
+ assetExist, err := store.GetAssetDefinition(assetID)
+ if err != nil {
+ return err
+ }
+ if assetExist == nil {
store.SetAssetDefinition(assetID, cci.AssetDefinition)
}
}
}
}
+ return nil
}
// Summary is the struct of transaction's input and output summary
var hash [32]byte
sha3pool.Sum256(hash[:], v.ControlProgram())
- if bytes := w.store.GetRawProgram(hash); bytes != nil {
+ cp, err := w.store.GetControlProgram(hash)
+ if err != nil {
+ log.WithFields(log.Fields{"module": logModule, "err": err, "hash": string(hash[:])}).Error("filterAccountTxs fail.")
+ continue
+ }
+ if cp != nil {
annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))
continue transactionLoop
}