Skip to content

Commit

Permalink
Remove unnecessary wallet finds (ethereum#341)
Browse files Browse the repository at this point in the history
* Remove unnecessary wallet finds

* Prevent repetitive finds

* Remove unused variable message

* Move var declarations to outside the loop
  • Loading branch information
tkporter authored and mergify[bot] committed Jul 12, 2019
1 parent 3c411b5 commit 5c02d77
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions abe/abe.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ func sendSms(phoneNumber string, message string, account common.Address, issuer

func SendAttestationMessages(receipts []*types.Receipt, block *types.Block, coinbase common.Address, accountManager *accounts.Manager, verificationServiceURL string) {
account := accounts.Account{Address: coinbase}
wallet, walletErr := accountManager.Find(account)

var wallet accounts.Wallet
var err error
for _, receipt := range receipts {
for _, request := range receipt.AttestationRequests {
if walletErr != nil {
log.Error("[Celo] Failed to get account for sms attestation", "err", walletErr)
return
if wallet == nil {
wallet, err = accountManager.Find(account)
if err != nil {
log.Error("[Celo] Failed to get account for sms attestation", "err", err)
return
}
}

if !bytes.Equal(coinbase.Bytes(), request.Verifier.Bytes()) {
Expand Down

0 comments on commit 5c02d77

Please sign in to comment.