Skip to content

Commit

Permalink
More refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-lashin committed Oct 22, 2018
1 parent f4f858e commit 2c53de1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
9 changes: 4 additions & 5 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package api
import (
"github.com/MinterTeam/minter-go-node/config"
"github.com/MinterTeam/minter-go-node/eventsdb"
"github.com/MinterTeam/minter-go-node/log"
"github.com/gorilla/mux"
"github.com/rs/cors"
"io"
"io/ioutil"
"log"
"net/http"

"github.com/gorilla/mux"
"github.com/rs/cors"

"github.com/MinterTeam/minter-go-node/core/minter"
"github.com/MinterTeam/minter-go-node/core/state"
"github.com/tendermint/go-amino"
Expand Down Expand Up @@ -70,7 +69,7 @@ func RunApi(b *minter.Blockchain, node *node.Node) {
// wait for tendermint to start
waitForTendermint()

log.Fatal(http.ListenAndServe(config.GetConfig().APIListenAddress, handler))
log.Error("Failed to start API", "err", http.ListenAndServe(config.GetConfig().APIListenAddress, handler))
}

func wrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
Expand Down
3 changes: 0 additions & 3 deletions cmd/minter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ import (
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/proxy"
"os"
"runtime"
)

var cfg = config.GetConfig()

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())

err := common.EnsureDir(utils.GetMinterHome()+"/config", 0777)

if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions core/minter/minter.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ func (app *Blockchain) Commit() abciTypes.ResponseCommit {
binary.BigEndian.PutUint64(height, uint64(app.height))
app.appDB.Set([]byte("height"), height)

// TODO: clear candidates list

app.updateCurrentRootHash()
app.updateCurrentState()

Expand Down
3 changes: 0 additions & 3 deletions eventsdb/eventsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ func (db *EventsDB) FlushEvents(height int64) error {
}

db.cache.Clear()

db.lock.Lock()
db.db.Set(getKeyForHeight(height), bytes)
db.lock.Unlock()

return nil
}
Expand Down

0 comments on commit 2c53de1

Please sign in to comment.