Skip to content

Commit db2b705

Browse files
committed
Switch-case used in 'performEthereumTransactionWithProofs'.
1 parent 2278dd8 commit db2b705

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/state/transaction_performer.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,17 @@ func (tp *transactionPerformer) performEthereumTransactionWithProofs(transaction
359359
if !ok {
360360
return errors.New("failed to convert interface to EthereumTransaction transaction")
361361
}
362-
_, isEthInvokeScript := ethTx.TxKind.(*proto.EthereumInvokeScriptTxKind)
363-
_, isEthInvokeExpression := ethTx.TxKind.(*proto.EthereumInvokeExpressionTxKind)
364-
if !(isEthInvokeScript || isEthInvokeExpression) {
365-
return errors.New("performing transaction was called, but the transaction is not InvokeScript or InvokeExpression")
362+
switch t := ethTx.TxKind.(type) {
363+
case *proto.EthereumInvokeScriptTxKind, *proto.EthereumInvokeExpressionTxKind:
364+
// ok
365+
default:
366+
// nothing to do for proto.EthereumTransferWavesTxKind and proto.EthereumTransferAssetsErc20TxKind
367+
return errors.Errorf("performing transaction was called, but the transaction is not InvokeScript or InvokeExpression, kind=(%T)", t)
366368
}
367369
err := tp.stor.commitUncertain(info.blockID)
368370
if err != nil {
369371
return errors.Wrap(err, "failed to commit invoke changes")
370372
}
371-
// nothing to do for proto.EthereumTransferWavesTxKind and proto.EthereumTransferAssetsErc20TxKind
372373
return nil
373374
}
374375

0 commit comments

Comments
 (0)