Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bandprotocol/chain into c…
Browse files Browse the repository at this point in the history
…osmos-sdk-v0.47
  • Loading branch information
RogerKSI committed Sep 19, 2023
2 parents 6eda33c + eae1214 commit ef868be
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
2 changes: 0 additions & 2 deletions yoda/context.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package yoda

import (
"sync"
"sync/atomic"
"time"

Expand Down Expand Up @@ -45,7 +44,6 @@ type Context struct {
freeKeys chan int64
keyRoundRobinIndex int64 // Must use in conjunction with sync/atomic

dataSourceCache *sync.Map
pendingRequests map[types.RequestID]bool

metricsEnabled bool
Expand Down
8 changes: 1 addition & 7 deletions yoda/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ func GetExecutable(c *Context, l *Logger, hash string) ([]byte, error) {

// GetDataSourceHash fetches data source hash by id
func GetDataSourceHash(c *Context, l *Logger, id types.DataSourceID) (string, error) {
if hash, ok := c.dataSourceCache.Load(id); ok {
return hash.(string), nil
}

res, err := abciQuery(c, l, fmt.Sprintf("/store/%s/key", types.StoreKey), types.DataSourceStoreKey(id))
if err != nil {
l.Error(":skull: Failed to get data source with error: %s", c, err.Error())
Expand All @@ -247,9 +243,7 @@ func GetDataSourceHash(c *Context, l *Logger, id types.DataSourceID) (string, er
var d types.DataSource
cdc.MustUnmarshal(res.Response.Value, &d)

hash, _ := c.dataSourceCache.LoadOrStore(id, d.Filename)

return hash.(string), nil
return d.Filename, nil
}

// GetRequest fetches request by id
Expand Down
2 changes: 0 additions & 2 deletions yoda/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"path/filepath"
"sync"
"time"

"github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -157,7 +156,6 @@ func runCmd(c *Context) *cobra.Command {
c.pendingMsgs = make(chan ReportMsgWithKey)
c.freeKeys = make(chan int64, len(keys))
c.keyRoundRobinIndex = -1
c.dataSourceCache = new(sync.Map)
c.pendingRequests = make(map[types.RequestID]bool)
c.metricsEnabled = cfg.MetricsListenAddr != ""
return runImpl(c, l)
Expand Down

0 comments on commit ef868be

Please sign in to comment.