Skip to content

Commit

Permalink
Removed not needed code.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Aug 22, 2024
1 parent fd277df commit c97a67a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
2 changes: 0 additions & 2 deletions server/services/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
var (
transactionVersion = 1
transactionProcessingTypeRelayedV1 = "RelayedTx"
transactionProcessingTypeRelayedV2 = "RelayedTxV2"
transactionProcessingTypeRelayedV3 = "RelayedTxV3"
transactionProcessingTypeBuiltInFunctionCall = "BuiltInFunctionCall"
transactionProcessingTypeMoveBalance = "MoveBalance"
transactionProcessingTypeContractInvoking = "SCInvoking"
Expand Down
1 change: 0 additions & 1 deletion server/services/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,3 @@ func (factory *errFactory) getPrototypeByCode(code errCode) errPrototype {
var errEventNotFound = errors.New("transaction event not found")
var errCannotRecognizeEvent = errors.New("cannot recognize transaction event")
var errCannotParseRelayedV1 = errors.New("cannot parse relayed V1 transaction")
var errCannotParseRelayedV2 = errors.New("cannot parse relayed V2 transaction")
27 changes: 0 additions & 27 deletions server/services/relayedTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,12 @@ type innerTransactionOfRelayedV1 struct {
SenderPubKey []byte `json:"sender"`
}

// innerTransactionOfRelayedV2 is used to parse the inner transaction of a relayed V2 transaction, and holds only the fields handled by Rosetta.
type innerTransactionOfRelayedV2 struct {
ReceiverPubKey []byte `json:"receiver"`
}

func isRelayedV1Transaction(tx *transaction.ApiTransactionResult) bool {
return (tx.Type == string(transaction.TxTypeNormal)) &&
(tx.ProcessingTypeOnSource == transactionProcessingTypeRelayedV1) &&
(tx.ProcessingTypeOnDestination == transactionProcessingTypeRelayedV1)
}

func isRelayedV2Transaction(tx *transaction.ApiTransactionResult) bool {
return (tx.Type == string(transaction.TxTypeNormal)) &&
(tx.ProcessingTypeOnSource == transactionProcessingTypeRelayedV2) &&
(tx.ProcessingTypeOnDestination == transactionProcessingTypeRelayedV2)
}

func parseInnerTxOfRelayedV1(tx *transaction.ApiTransactionResult) (*innerTransactionOfRelayedV1, error) {
subparts := strings.Split(string(tx.Data), argumentsSeparator)
if len(subparts) != 2 {
Expand All @@ -53,19 +42,3 @@ func parseInnerTxOfRelayedV1(tx *transaction.ApiTransactionResult) (*innerTransa

return &innerTx, nil
}

func parseInnerTxOfRelayedV2(tx *transaction.ApiTransactionResult) (*innerTransactionOfRelayedV2, error) {
subparts := strings.Split(string(tx.Data), argumentsSeparator)
if len(subparts) != 5 {
return nil, errCannotParseRelayedV2
}

receiverPubKey, err := hex.DecodeString(subparts[1])
if err != nil {
return nil, err
}

return &innerTransactionOfRelayedV2{
ReceiverPubKey: receiverPubKey,
}, nil
}

0 comments on commit c97a67a

Please sign in to comment.