Skip to content

Commit

Permalink
Add IsImplicit method
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Jun 23, 2022
1 parent 0ee775d commit 41b38f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/api/handlers/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func GetOperationDiff() gin.HandlerFunc {
var result Operation
result.FromModel(operation)

if len(operation.DeffatedStorage) > 0 && (operation.IsCall() || operation.IsOrigination()) && operation.IsApplied() {
if len(operation.DeffatedStorage) > 0 && (operation.IsCall() || operation.IsOrigination() || operation.IsImplicit()) && operation.IsApplied() {
proto, err := ctx.Cache.ProtocolByID(operation.ProtocolID)
if handleError(c, ctx.Storage, err, 0) {
return
Expand Down Expand Up @@ -340,7 +340,7 @@ func prepareOperation(ctx *config.Context, operation operation.Operation, bmd []
if err != nil {
return op, err
}
if len(operation.DeffatedStorage) > 0 && (operation.IsCall() || operation.IsOrigination() || operation.Hash == "") && operation.IsApplied() {
if len(operation.DeffatedStorage) > 0 && (operation.IsCall() || operation.IsOrigination() || operation.IsImplicit()) && operation.IsApplied() {
if err := setStorageDiff(ctx, operation.DestinationID, operation.DeffatedStorage, &op, bmd, storageType); err != nil {
return op, err
}
Expand Down
5 changes: 5 additions & 0 deletions internal/models/operation/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ func (o *Operation) IsTransaction() bool {
return o.Kind == types.OperationKindTransaction
}

// IsImplicit -
func (o *Operation) IsImplicit() bool {
return o.Hash == ""
}

// IsApplied -
func (o *Operation) IsApplied() bool {
return o.Status == types.OperationStatusApplied
Expand Down

0 comments on commit 41b38f8

Please sign in to comment.