@@ -76,8 +76,19 @@ func NewTxTypeHandler(
7676 return tc , nil
7777}
7878
79+ // ComputeTransactionTypeInEpoch calculates the transaction type based on the provided epoch
80+ func (tth * txTypeHandler ) ComputeTransactionTypeInEpoch (tx data.TransactionHandler , epoch uint32 ) (process.TransactionType , process.TransactionType , bool ) {
81+ return tth .computeTransactionType (tx , epoch )
82+ }
83+
7984// ComputeTransactionType calculates the transaction type
8085func (tth * txTypeHandler ) ComputeTransactionType (tx data.TransactionHandler ) (process.TransactionType , process.TransactionType , bool ) {
86+ currentEpoch := tth .enableEpochsHandler .GetCurrentEpoch ()
87+
88+ return tth .computeTransactionType (tx , currentEpoch )
89+ }
90+
91+ func (tth * txTypeHandler ) computeTransactionType (tx data.TransactionHandler , epoch uint32 ) (process.TransactionType , process.TransactionType , bool ) {
8192 err := tth .checkTxValidity (tx )
8293 if err != nil {
8394 return process .InvalidTransaction , process .InvalidTransaction , false
@@ -99,7 +110,7 @@ func (tth *txTypeHandler) ComputeTransactionType(tx data.TransactionHandler) (pr
99110 funcName , args := tth .getFunctionFromArguments (tx .GetData ())
100111 isBuiltInFunction := tth .isBuiltInFunctionCall (funcName )
101112 if isBuiltInFunction {
102- if tth .isSCCallAfterBuiltIn (funcName , args , tx ) {
113+ if tth .isSCCallAfterBuiltIn (funcName , args , tx , epoch ) {
103114 return process .BuiltInFunctionCall , process .SCInvoking , isRelayedV3
104115 }
105116
@@ -114,11 +125,11 @@ func (tth *txTypeHandler) ComputeTransactionType(tx data.TransactionHandler) (pr
114125 return process .MoveBalance , process .MoveBalance , isRelayedV3
115126 }
116127
117- if tth .isRelayedTransactionV1 (funcName ) {
128+ if tth .isRelayedTransactionV1 (funcName , epoch ) {
118129 return process .RelayedTx , process .RelayedTx , isRelayedV3 // this should never be reached with both relayed v1 and relayed v3
119130 }
120131
121- if tth .isRelayedTransactionV2 (funcName ) {
132+ if tth .isRelayedTransactionV2 (funcName , epoch ) {
122133 return process .RelayedTxV2 , process .RelayedTxV2 , isRelayedV3 // this should never be reached with both relayed v2 and relayed v3
123134 }
124135
@@ -143,8 +154,8 @@ func isCallOfType(tx data.TransactionHandler, callType vm.CallType) bool {
143154 return scr .CallType == callType
144155}
145156
146- func (tth * txTypeHandler ) isSCCallAfterBuiltIn (function string , args [][]byte , tx data.TransactionHandler ) bool {
147- isTransferAndAsyncCallbackFixFlagSet := tth .enableEpochsHandler .IsFlagEnabled (common .ESDTMetadataContinuousCleanupFlag )
157+ func (tth * txTypeHandler ) isSCCallAfterBuiltIn (function string , args [][]byte , tx data.TransactionHandler , epoch uint32 ) bool {
158+ isTransferAndAsyncCallbackFixFlagSet := tth .enableEpochsHandler .IsFlagEnabledInEpoch (common .ESDTMetadataContinuousCleanupFlag , epoch )
148159 if isTransferAndAsyncCallbackFixFlagSet && isCallOfType (tx , vm .AsynchronousCallBack ) {
149160 return true
150161 }
@@ -184,17 +195,17 @@ func (tth *txTypeHandler) isBuiltInFunctionCall(functionName string) bool {
184195 return function .IsActive ()
185196}
186197
187- func (tth * txTypeHandler ) isRelayedTransactionV1 (functionName string ) bool {
188- areRelayedDisabled := tth .enableEpochsHandler .IsFlagEnabled (common .RelayedTransactionsV1V2DisableFlag )
198+ func (tth * txTypeHandler ) isRelayedTransactionV1 (functionName string , epoch uint32 ) bool {
199+ areRelayedDisabled := tth .enableEpochsHandler .IsFlagEnabledInEpoch (common .RelayedTransactionsV1V2DisableFlag , epoch )
189200 if areRelayedDisabled {
190201 return false
191202 }
192203
193204 return functionName == core .RelayedTransaction
194205}
195206
196- func (tth * txTypeHandler ) isRelayedTransactionV2 (functionName string ) bool {
197- areRelayedDisabled := tth .enableEpochsHandler .IsFlagEnabled (common .RelayedTransactionsV1V2DisableFlag )
207+ func (tth * txTypeHandler ) isRelayedTransactionV2 (functionName string , epoch uint32 ) bool {
208+ areRelayedDisabled := tth .enableEpochsHandler .IsFlagEnabledInEpoch (common .RelayedTransactionsV1V2DisableFlag , epoch )
198209 if areRelayedDisabled {
199210 return false
200211 }
0 commit comments