From c62ecd6f710bb2cfc76dc688062c9c145fdffbc1 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Mon, 1 Nov 2021 14:09:46 -0700 Subject: [PATCH] Use length variable, Comment deprecation of GetOnion --- model/group.go | 4 ++-- peer/cwtch_peer.go | 3 +++ storage/v1/profile_store_test.go | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/model/group.go b/model/group.go index 51b38d3..ff01c4f 100644 --- a/model/group.go +++ b/model/group.go @@ -143,10 +143,10 @@ func (g *Group) GetMessage(index int) (bool, Message, int) { length := len(g.Timeline.Messages) - if len(g.Timeline.Messages) > index { + if length > index { return true, g.Timeline.Messages[index], length } - return false, Message{}, len(g.Timeline.Messages) + return false, Message{}, length } // AddMessage takes a DecryptedGroupMessage and adds it to the Groups Timeline diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index bdf78ff..254a15b 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -249,6 +249,9 @@ type CwtchPeer interface { StartServerConnections() Shutdown() + // GetOnion is deprecated. If you find yourself needing to rely on this method it is time + // to consider replacing this with a GetAddress(es) function that can fully expand cwtch beyond the boundaries + // of tor v3 onion services. // Deprecated GetOnion() string diff --git a/storage/v1/profile_store_test.go b/storage/v1/profile_store_test.go index af7526e..6cae401 100644 --- a/storage/v1/profile_store_test.go +++ b/storage/v1/profile_store_test.go @@ -108,7 +108,7 @@ func TestProfileStoreChangePassword(t *testing.T) { event.TimestampReceived: time.Now().Format(time.RFC3339Nano), event.RemotePeer: profile.Onion, event.Data: testMessage, - event.Signature: base64.StdEncoding.EncodeToString([]byte{byte(i)}), + event.Signature: base64.StdEncoding.EncodeToString([]byte{byte(i)}), })) } @@ -131,7 +131,7 @@ func TestProfileStoreChangePassword(t *testing.T) { event.TimestampReceived: time.Now().Format(time.RFC3339Nano), event.RemotePeer: profile.Onion, event.Data: testMessage, - event.Signature: base64.StdEncoding.EncodeToString([]byte{0x01, byte(i)}), + event.Signature: base64.StdEncoding.EncodeToString([]byte{0x01, byte(i)}), })) } time.Sleep(3 * time.Second)