Skip to content

Commit

Permalink
Merge pull request #111 from eqlabs/latenssi/fix-109-110
Browse files Browse the repository at this point in the history
Fix issues #109 and #110
  • Loading branch information
latenssi authored Jun 29, 2021
2 parents 694c151 + 5ed1bd3 commit 2f2817c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion templates/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func parseConfig() *config {
if len(ss) > 2 {
token.lcName = ss[2]
}
cachedConfig.enabledTokens[ss[0]] = token
// Use all lowercase as the key so we can do case insenstive matchig
// in URLs
key := strings.ToLower(ss[0])
cachedConfig.enabledTokens[key] = token
}
}

Expand Down
6 changes: 3 additions & 3 deletions templates/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ func EnabledTokens() map[string]Token {
}

func NewToken(name string) (*Token, error) {
// Assume the name is in declaration name format
token, ok := EnabledTokens()[name]
key := strings.ToLower(name)
token, ok := EnabledTokens()[key]
if !ok {
return nil, fmt.Errorf("token %s not enabled, make sure to use the declaration name format", name)
return nil, fmt.Errorf("token %s not enabled", name)
}
return &token, nil
}
Expand Down
5 changes: 5 additions & 0 deletions transactions/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ func New(
// Authorizers sign the payload
// TODO: support multiple keys per account?
for _, a := range authorizers {
// If account is also the payer, it must only sign the envelope
if a.Address == payer.Address {
continue
}

if err := builder.Tx.SignPayload(a.Address, a.Key.Index, a.Signer); err != nil {
return err
}
Expand Down

0 comments on commit 2f2817c

Please sign in to comment.