rpc: Use Equivalent method instead of reflect.DeepEquals.

MultiPart: 2/2
Change-Id: Ia04e4e1aba7eff2ce3226575a566c09eb70bd5f3
diff --git a/profiles/internal/rpc/blessings_cache.go b/profiles/internal/rpc/blessings_cache.go
index c9d19ce..2eca000 100644
--- a/profiles/internal/rpc/blessings_cache.go
+++ b/profiles/internal/rpc/blessings_cache.go
@@ -7,7 +7,6 @@
 import (
 	"crypto/sha256"
 	"fmt"
-	"reflect"
 	"sync"
 
 	"v.io/v23/rpc"
@@ -160,8 +159,7 @@
 	c.Lock()
 	defer c.Unlock()
 	if cached, exists := c.m[req.Key]; exists {
-		// TODO(suharshs): Replace this reflect.DeepEqual() with a less expensive check.
-		if !reflect.DeepEqual(cached, recv) {
+		if !cached.Equivalent(recv) {
 			return security.Blessings{}, fmt.Errorf("client sent invalid Blessings")
 		}
 		return cached, nil
diff --git a/profiles/internal/rpc/discharges.go b/profiles/internal/rpc/discharges.go
index 9a10533..cb832ea 100644
--- a/profiles/internal/rpc/discharges.go
+++ b/profiles/internal/rpc/discharges.go
@@ -5,7 +5,6 @@
 package rpc
 
 import (
-	"reflect"
 	"sort"
 	"strings"
 	"sync"
@@ -263,9 +262,7 @@
 		if keys, ok := dcc.idToKeys[d.ID()]; ok {
 			var newKeys []dischargeCacheKey
 			for _, k := range keys {
-				// TODO(suharshs,ataly,ashankar): Should we have an "Equals" function
-				// defined on "Discharge" and use that instead of reflect.DeepEqual?
-				if cached := dcc.cache[k]; reflect.DeepEqual(cached, d) {
+				if cached := dcc.cache[k]; cached.Equivalent(d) {
 					delete(dcc.cache, k)
 				} else {
 					newKeys = append(newKeys, k)