Skip to content

Commit

Permalink
Switch-case used in 'performEthereumTransactionWithProofs'.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeskov committed Feb 8, 2022
1 parent 2278dd8 commit db2b705
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/state/transaction_performer.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,17 @@ func (tp *transactionPerformer) performEthereumTransactionWithProofs(transaction
if !ok {
return errors.New("failed to convert interface to EthereumTransaction transaction")
}
_, isEthInvokeScript := ethTx.TxKind.(*proto.EthereumInvokeScriptTxKind)
_, isEthInvokeExpression := ethTx.TxKind.(*proto.EthereumInvokeExpressionTxKind)
if !(isEthInvokeScript || isEthInvokeExpression) {
return errors.New("performing transaction was called, but the transaction is not InvokeScript or InvokeExpression")
switch t := ethTx.TxKind.(type) {
case *proto.EthereumInvokeScriptTxKind, *proto.EthereumInvokeExpressionTxKind:
// ok
default:
// nothing to do for proto.EthereumTransferWavesTxKind and proto.EthereumTransferAssetsErc20TxKind
return errors.Errorf("performing transaction was called, but the transaction is not InvokeScript or InvokeExpression, kind=(%T)", t)
}
err := tp.stor.commitUncertain(info.blockID)
if err != nil {
return errors.Wrap(err, "failed to commit invoke changes")
}
// nothing to do for proto.EthereumTransferWavesTxKind and proto.EthereumTransferAssetsErc20TxKind
return nil
}

Expand Down

0 comments on commit db2b705

Please sign in to comment.