diff --git a/process/factory/sovereignTxNotarizationChecker.go b/process/factory/sovereignTxNotarizationChecker.go index c61c78da..9712861e 100644 --- a/process/factory/sovereignTxNotarizationChecker.go +++ b/process/factory/sovereignTxNotarizationChecker.go @@ -11,7 +11,7 @@ func NewSovereignTxNotarizationChecker() *sovereignTxNotarizationChecker { return &sovereignTxNotarizationChecker{} } -// IsNotarized returns if tx is notarized +// IsNotarized returns true func (stnc *sovereignTxNotarizationChecker) IsNotarized(_ transaction.ApiTransactionResult) bool { return true } diff --git a/process/factory/txNotarizationChecker_test.go b/process/factory/txNotarizationChecker_test.go index 7e26136f..928e03fa 100644 --- a/process/factory/txNotarizationChecker_test.go +++ b/process/factory/txNotarizationChecker_test.go @@ -17,11 +17,18 @@ func TestTxNotarizationChecker(t *testing.T) { func TestTxNotarizationChecker_IsNotarized(t *testing.T) { t.Parallel() - tnc := NewTxNotarizationChecker() - tx := transaction.ApiTransactionResult{ - NotarizedAtSourceInMetaNonce: 1, - NotarizedAtDestinationInMetaNonce: 1, - } - isNotarized := tnc.IsNotarized(tx) - require.True(t, isNotarized) + t.Run("tx is notarized, should work", func(t *testing.T) { + tnc := NewTxNotarizationChecker() + tx := transaction.ApiTransactionResult{ + NotarizedAtSourceInMetaNonce: 1, + NotarizedAtDestinationInMetaNonce: 1, + } + isNotarized := tnc.IsNotarized(tx) + require.True(t, isNotarized) + }) + t.Run("tx is not notarized, should work", func(t *testing.T) { + tnc := NewTxNotarizationChecker() + isNotarized := tnc.IsNotarized(transaction.ApiTransactionResult{}) + require.False(t, isNotarized) + }) } diff --git a/process/interface.go b/process/interface.go index 602e62bd..7e5681f2 100644 --- a/process/interface.go +++ b/process/interface.go @@ -7,6 +7,7 @@ import ( "github.com/multiversx/mx-chain-core-go/data/transaction" "github.com/multiversx/mx-chain-core-go/data/vm" crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-chain-proxy-go/common" "github.com/multiversx/mx-chain-proxy-go/data" "github.com/multiversx/mx-chain-proxy-go/observer" @@ -86,7 +87,7 @@ type HttpClient interface { Do(req *http.Request) (*http.Response, error) } -// TxNotarizationCheckerHandler defines a TxNotarizationCheckerHandler behavior +// TxNotarizationCheckerHandler defines what tx notarization checked should do type TxNotarizationCheckerHandler interface { IsNotarized(tx transaction.ApiTransactionResult) bool IsInterfaceNil() bool diff --git a/process/transactionProcessor.go b/process/transactionProcessor.go index be586473..4c854b7d 100644 --- a/process/transactionProcessor.go +++ b/process/transactionProcessor.go @@ -588,8 +588,7 @@ func checkIfCompleted(logs []*transaction.ApiLogs) bool { } func (tp *TransactionProcessor) checkIfMoveBalanceNotarized(tx *transaction.ApiTransactionResult) bool { - isNotarized := tp.txNotarizationChecker.IsNotarized(*tx) - if !isNotarized { + if !tp.txNotarizationChecker.IsNotarized(*tx) { return false } isMoveBalance := tx.ProcessingTypeOnSource == moveBalanceDescriptor && tx.ProcessingTypeOnDestination == moveBalanceDescriptor