From 9f67782a9cfb6712873342c64a4e5eef1f4af465 Mon Sep 17 00:00:00 2001 From: joshemb <josh@elixxir.io> Date: Fri, 23 Sep 2022 13:50:50 -0700 Subject: [PATCH] Add some debug prints --- backup/backup.go | 7 +++++++ ud/lookup.go | 24 ------------------------ ud/store/facts.go | 5 +++++ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/backup/backup.go b/backup/backup.go index d4cc92a40..81115823b 100644 --- a/backup/backup.go +++ b/backup/backup.go @@ -93,6 +93,9 @@ type UpdateBackupFn func(encryptedBackup []byte) func InitializeBackup(backupPassphrase string, updateBackupCb UpdateBackupFn, container *xxdk.Container, e2e E2e, session Session, ud UserDiscovery, kv *versioned.KV, rng *fastRNG.StreamGenerator) (*Backup, error) { + + jww.INFO.Print("USERNAME BACKUP DEBUG (InitializeBackup): ud passed in is %+v", ud) + b := &Backup{ updateBackupCb: updateBackupCb, container: container, @@ -143,6 +146,8 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container, return nil, err } + jww.INFO.Print("USERNAME BACKUP DEBUG (resume backup): ud passed in is %+v", ud) + b := &Backup{ updateBackupCb: updateBackupCb, container: container, @@ -303,8 +308,10 @@ func (b *Backup) assembleBackup() backup.Backup { // Get facts if b.ud != nil { + jww.INFO.Print("USERNAME BACKUP DEBUG (assembleBackup): Getting facts from UD: %v", b.ud.GetFacts()) bu.UserDiscoveryRegistration.FactList = b.ud.GetFacts() } else { + jww.INFO.Print("USERNAME BACKUP DEBUG (assembleBackup): ud is nil, putting empty list") bu.UserDiscoveryRegistration.FactList = fact.FactList{} } diff --git a/ud/lookup.go b/ud/lookup.go index 569dc5b99..867c2900c 100644 --- a/ud/lookup.go +++ b/ud/lookup.go @@ -44,30 +44,6 @@ func Lookup(user udE2e, return lookup(net, rng, uid, grp, udContact, callback, p) } -// BatchLookup performs a Lookup operation on a list of user IDs. -// The lookup performs a callback on each lookup on the returned contact object -// constructed from the response. -func BatchLookup(udContact contact.Contact, - net udCmix, callback lookupCallback, - rng csprng.Source, - uids []*id.ID, grp *cyclic.Group, - p single.RequestParams) { - jww.INFO.Printf("ud.BatchLookup(%s, %s)", uids, p.Timeout) - - for _, uid := range uids { - go func(localUid *id.ID) { - _, _, err := lookup(net, rng, localUid, grp, - udContact, callback, p) - if err != nil { - jww.WARN.Printf("Failed batch lookup on user %s: %v", - localUid, err) - } - }(uid) - } - - return -} - // lookup is a helper function which sends a lookup request to the user discovery // service. It will construct a contact object off of the returned public key. // The callback will be called on that contact object. diff --git a/ud/store/facts.go b/ud/store/facts.go index 4721b864e..56cdc6197 100644 --- a/ud/store/facts.go +++ b/ud/store/facts.go @@ -10,6 +10,7 @@ package ud import ( "fmt" "github.com/pkg/errors" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/primitives/fact" ) @@ -48,6 +49,7 @@ func (s *Store) RestoreFromBackUp(backupData fact.FactList) error { func (s *Store) StoreUsername(f fact.Fact) error { s.mux.Lock() defer s.mux.Unlock() + jww.INFO.Printf("USERNAME BACKUP DEBUG (StoreUsername): storing username: %+v", f) if f.T != fact.Username { return errors.Errorf("Fact (%s) is not of type username", f.Stringify()) @@ -210,12 +212,15 @@ func (s *Store) GetFacts() []fact.Fact { s.mux.RLock() defer s.mux.RUnlock() + jww.INFO.Printf("USERNAME BACKUP DEBUG (getFacts): all the facts in the map: %+v", s.confirmedFacts) // Flatten the facts into a slice facts := make([]fact.Fact, 0, len(s.confirmedFacts)) for f := range s.confirmedFacts { facts = append(facts, f) } + jww.INFO.Printf("USERNAME BACKUP DEBUG (getFacts): returned facts: %+v", facts) + return facts } -- GitLab