Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
This commit is contained in:
Richard Ramos 2022-09-27 18:59:02 -04:00 committed by GitHub
parent bf9abfc350
commit b8fd999b54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 22 deletions

View File

@ -95,9 +95,5 @@ func StringToTopic(s string) (t TopicType) {
}
func TopicTypeToByteArray(t TopicType) []byte {
topic := make([]byte, 4)
for i, b := range t {
topic[i] = b
}
return topic
return t[:4]
}

View File

@ -936,7 +936,7 @@ func (s *MessengerContactRequestSuite) TestLegacyContactRequestNotifications() {
myID := types.EncodeHex(crypto.FromECDSAPub(&s.m.identity.PublicKey))
// Send contact request
resp, err = s.m.SendContactRequest(context.Background(), crRequest)
_, err = s.m.SendContactRequest(context.Background(), crRequest)
s.Require().NoError(err)
paginationResponse, err := theirMessenger.ActivityCenterNotifications("", 10)

View File

@ -66,12 +66,8 @@ func ValidateTags(input []string) bool {
}
}
if len(unique(input)) != len(input) {
// Contains duplicates. Shouldn't have happened
return false
}
return true
// False if contains duplicates. Shouldn't have happened
return len(unique(input)) == len(input)
}
func RemoveUnknownAndDeduplicateTags(input []string) []string {

View File

@ -396,7 +396,7 @@ func challengeMiddleware(ps *PairingServer, next http.Handler) http.HandlerFunc
// Only if we have both a challenge in the session store and in the request header
// do we entertain blocking the client. Because then we know someone is trying to be sneaky.
if bytes.Compare(c, challenge) != 0 {
if !bytes.Equal(c, challenge) {
s.Values[sessionBlocked] = true
err = s.Save(r, w)
if err != nil {

View File

@ -198,7 +198,7 @@ func (pms *PayloadMarshallerSuite) TestPayloadMarshaller_MarshalToProtobuf() {
// Because file-walk will pull files in an unpredictable order from a target dir
// there are 2 potential valid hashes, because there are 2 key files in the test dir
if bytes.Compare(hashA, h.Sum(nil)) != 0 {
if !bytes.Equal(hashA, h.Sum(nil)) {
pms.Require().Exactly(hashB, h.Sum(nil))
}
}

View File

@ -14,9 +14,8 @@ type ServerURLSuite struct {
suite.Suite
TestKeyComponents
server *MediaServer
serverNoPort *MediaServer
pairingServer *PairingServer
server *MediaServer
serverNoPort *MediaServer
}
func (s *ServerURLSuite) SetupSuite() {

View File

@ -312,10 +312,7 @@ func (api *API) generateAccount(
func (api *API) VerifyPassword(password string) bool {
err := api.verifyPassword(password)
if err != nil {
return false
}
return true
return err == nil
}
func (api *API) AddMigratedKeyPair(ctx context.Context, kcUID string, kpName string, keyUID string, accountAddresses []string) error {

View File

@ -118,5 +118,5 @@ func (args SendTxArgs) ToTransactOpts(signerFn bind.SignerFn) *bind.TransactOpts
}
func isNilOrEmpty(bytes types.HexBytes) bool {
return bytes == nil || len(bytes) == 0
return len(bytes) == 0
}