diff --git a/covenant/covenant.go b/covenant/covenant.go index cc1415a..01c1332 100644 --- a/covenant/covenant.go +++ b/covenant/covenant.go @@ -3,8 +3,6 @@ package covenant import ( "encoding/hex" "fmt" - "sort" - "strings" "sync" "time" @@ -229,7 +227,7 @@ func (ce *CovenantEmulator) AddCovenantSignatures(btcDels []*types.Delegation) ( } // 10. submit covenant sigs - res, err := ce.cc.SubmitCovenantSigs(SortCovenantSigs(covenantSigs)) + res, err := ce.cc.SubmitCovenantSigs(covenantSigs) if err != nil { ce.recordMetricsFailedSignDelegations(len(covenantSigs)) return nil, err @@ -592,15 +590,3 @@ func (ce *CovenantEmulator) Stop() error { }) return stopErr } - -// SortCovenantSigs helper function to sort all covenant signatures by the staking tx hash -// Usefull for test checking expected inputs -func SortCovenantSigs(covSigs []*types.CovenantSigs) []*types.CovenantSigs { - sorted := make([]*types.CovenantSigs, len(covSigs)) - copy(sorted, covSigs) - sort.SliceStable(sorted, func(i, j int) bool { - return strings.Compare(sorted[i].StakingTxHash.String(), sorted[j].StakingTxHash.String()) == 1 - }) - - return sorted -} diff --git a/covenant/covenant_test.go b/covenant/covenant_test.go index e12f011..3d206a3 100644 --- a/covenant/covenant_test.go +++ b/covenant/covenant_test.go @@ -194,10 +194,9 @@ func FuzzAddCovenantSig(f *testing.F) { } btcDels = append(btcDels, invalidDelegation) - sortedCovSigs := covenant.SortCovenantSigs(covSigsSet) // check the sigs are expected expectedTxHash := testutil.GenRandomHexStr(r, 32) - mockClientController.EXPECT().SubmitCovenantSigs(sortedCovSigs). + mockClientController.EXPECT().SubmitCovenantSigs(covSigsSet). Return(&types.TxResponse{TxHash: expectedTxHash}, nil).AnyTimes() res, err := ce.AddCovenantSignatures(btcDels) require.NoError(t, err)