diff --git a/cmd/end2endtest/helpers.go b/cmd/end2endtest/helpers.go index 079195b42..6fd477e8c 100644 --- a/cmd/end2endtest/helpers.go +++ b/cmd/end2endtest/helpers.go @@ -182,15 +182,28 @@ func (t electionBase) generateProofs(root types.HexBytes, isAnonymousVoting bool } }() + apiClientMtx := &sync.Mutex{} addNaccounts := func(accounts []*ethereum.SignKeys, wg *sync.WaitGroup) { defer wg.Done() log.Infof("generating %d voting proofs", len(accounts)) for _, acc := range accounts { voterKey := acc.Address().Bytes() + if isAnonymousVoting { + apiClientMtx.Lock() + privKey := acc.PrivateKey() + if err := t.api.SetAccount(privKey.String()); err != nil { + apiClientMtx.Unlock() + log.Fatal(err) + return + } voterKey = t.api.MyZkAddress().Bytes() } + pr, err := t.api.CensusGenProof(root, voterKey) + if isAnonymousVoting { + apiClientMtx.Unlock() + } if err != nil { log.Fatal(err) } @@ -242,7 +255,6 @@ func getCensusParticipantKey(voterAccount *ethereum.SignKeys, censusType string) case vapi.CensusTypeWeighted: key = voterAccount.Address().Bytes() case vapi.CensusTypeZKWeighted: - fmt.Println("salito") zkAddr, err := zk.AddressFromSignKeys(voterAccount) if err != nil { return nil, err