From 741fa29cf8e5b0e37f6d3a1453ad2c2b5b9ece0b Mon Sep 17 00:00:00 2001
From: josh <josh@elixxir.io>
Date: Tue, 22 Mar 2022 15:16:30 -0700
Subject: [PATCH] Implmenet cleanup and constructor for triggers.go

---
 network/message/triggers.go | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/network/message/triggers.go b/network/message/triggers.go
index 6242f4909..2f0a8afea 100644
--- a/network/message/triggers.go
+++ b/network/message/triggers.go
@@ -48,7 +48,9 @@ type trigger struct {
 
 func NewTriggers() *TriggersManager {
 	// todo: implement me
-	return nil
+	return &TriggersManager{
+		tmap: make(map[id.ID]map[interfaces.Preimage][]trigger, 0),
+	}
 }
 
 // Lookup will see if a trigger exists for the given preimage and message
@@ -59,12 +61,6 @@ func NewTriggers() *TriggersManager {
 // that one or multiple triggers exist to process this message.
 // These triggers are returned to the caller along with the a true boolean.
 // If the map has been exhausted with no matches found, it returns nil and false.
-// TODO: reorganize this interface. Lookup needs to be called by handleMessage,
-//  which should not have access to the other state modifying methods below.
-//  Possible options include:
-//  - privatizing the state-changing methods
-//  - leaking lookup on this layer and migrating the state modification methods
-//    a layer down in a separate package
 func (t *TriggersManager) get(clientID *id.ID, receivedIdentityFp,
 	ecrMsgContents []byte) ([]trigger,
 	bool) {
-- 
GitLab