From 1ceb41d68c8cd56d4d4bbdf26dc16699877f5fc5 Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Tue, 21 Jun 2022 15:19:57 -0700 Subject: [PATCH] In cmd/ verify confirm sending on verify-send flag --- cmd/callbacks.go | 9 ++++++--- cmd/root.go | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cmd/callbacks.go b/cmd/callbacks.go index 66a6ba9f2..139006223 100644 --- a/cmd/callbacks.go +++ b/cmd/callbacks.go @@ -10,6 +10,7 @@ package cmd import ( "fmt" + "github.com/spf13/viper" "gitlab.com/elixxir/client/xxdk" jww "github.com/spf13/jwalterweatherman" @@ -46,10 +47,12 @@ func (a *authCallbacks) Request(requestor contact.Contact, if a.autoConfirm { jww.INFO.Printf("Channel Request: %s", requestor.ID) - _, err := a.client.GetAuth().Confirm(requestor) - if err != nil { - jww.FATAL.Panicf("%+v", err) + if viper.GetBool("verify-sends") { // Verify message sends were successful + acceptChannelVerified(a.client, requestor.ID) + } else { + acceptChannel(a.client, requestor.ID) } + a.confCh <- requestor.ID } diff --git a/cmd/root.go b/cmd/root.go index 2f0c0c013..bd49ab29c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -263,12 +263,11 @@ var rootCmd = &cobra.Command{ // Accept auth request for this recipient authConfirmed := false paramsE2E := e2e.GetDefaultParams() - roundTimeout := paramsE2E.CMIXParams.SendTimeout if viper.GetBool("accept-channel") { // Verify that the confirmation message makes it to the // original sender if viper.GetBool("verify-sends") { - acceptChannelVerified(client, recipientID, roundTimeout) + acceptChannelVerified(client, recipientID) } else { // Accept channel, agnostic of round result acceptChannel(client, recipientID) @@ -832,8 +831,10 @@ func resetAuthenticatedChannel(client *xxdk.E2e, recipientID *id.ID, } } -func acceptChannelVerified(client *xxdk.E2e, recipientID *id.ID, - roundTimeout time.Duration) { +func acceptChannelVerified(client *xxdk.E2e, recipientID *id.ID) { + paramsE2E := e2e.GetDefaultParams() + roundTimeout := paramsE2E.CMIXParams.SendTimeout + done := make(chan struct{}, 1) retryChan := make(chan struct{}, 1) for { -- GitLab