Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove repeated validation of transaction #2552

Merged
merged 3 commits into from Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions code/go/0chain.net/chaincore/transaction/handler.go
Expand Up @@ -29,12 +29,6 @@ func PutTransaction(ctx context.Context, entity datastore.Entity) (interface{},
return nil, fmt.Errorf("invalid request %T", entity)
}

err := txn.Validate(ctx)
if err != nil {
logging.Logger.Error("put transaction error", zap.String("txn", txn.Hash), zap.Error(err))
return nil, err
}

if txn.DebugTxn() {
logging.Logger.Info("put transaction", zap.Any("txn", txn))
} else {
Expand All @@ -46,7 +40,7 @@ func PutTransaction(ctx context.Context, entity datastore.Entity) (interface{},
return txn, nil
}

err = entity.GetEntityMetadata().GetStore().Write(ctx, txn)
err := entity.GetEntityMetadata().GetStore().Write(ctx, txn)
if err != nil {
logging.Logger.Error("put transaction", zap.Error(err), zap.String("txn", txn.Hash), zap.String("txn_obj", datastore.ToJSON(txn).String()))
return nil, err
Expand Down