Skip to content

Commit

Permalink
[Chore] Prep for 0.18.1 (#474)
Browse files Browse the repository at this point in the history
* Update travis to use revive for linting

* Increase CFilter size limit

* Bump version to 0.18.1

* Update Dockerfile to go 1.16

* Remove regtest in ci for now, docker rate limits
  • Loading branch information
zquestz authored May 24, 2021
1 parent dc64324 commit 3bca12e
Show file tree
Hide file tree
Showing 15 changed files with 738 additions and 49 deletions.
15 changes: 6 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
language: go
go_import_path: github.com/gcash/bchd
go:
- "1.13.15"
- "1.14.12"
- "1.15.5"
- "1.16.4"

services:
- docker
Expand All @@ -19,7 +17,7 @@ env:
- GO111MODULE=on

before_install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0
- go get github.com/golangci/golangci-lint/cmd/golangci-lint

install:
- env GO111MODULE=on go build
Expand All @@ -28,10 +26,9 @@ install:
script:
- export PATH=$PATH:$HOME/gopath/bin
- ./goclean.sh
- sh -c 'cd ./bchrpc/regtest && ./test.sh'

after_script:
- if [ "$TRAVIS_GO_VERSION" = "1.15.5" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then go get github.com/inconshreveable/mousetrap; fi
- if [ "$TRAVIS_GO_VERSION" = "1.15.5" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then go get github.com/mitchellh/gox; fi
- if [ "$TRAVIS_GO_VERSION" = "1.15.5" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then go get github.com/tcnksm/ghr; fi
- if [ "$TRAVIS_GO_VERSION" = "1.15.5" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then make compile; ghr --username gcash --token $GITHUB_TOKEN --replace $TRAVIS_TAG pkg/; fi
- if [ "$TRAVIS_GO_VERSION" = "1.16.4" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then go get github.com/inconshreveable/mousetrap; fi
- if [ "$TRAVIS_GO_VERSION" = "1.16.4" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then go get github.com/mitchellh/gox; fi
- if [ "$TRAVIS_GO_VERSION" = "1.16.4" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then go get github.com/tcnksm/ghr; fi
- if [ "$TRAVIS_GO_VERSION" = "1.16.4" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_TAG" != "" ]; then make compile; ghr --username gcash --token $GITHUB_TOKEN --replace $TRAVIS_TAG pkg/; fi
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang:1.15
FROM golang:1.16

LABEL maintainer="Josh Ellithorpe <quest@mac.com>"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ that communicates with your running bchd instance via the API.

## Requirements

[Go](http://golang.org) 1.13.15 or newer.
[Go](http://golang.org) 1.16.4 or newer.

## Install

Expand Down
2 changes: 1 addition & 1 deletion bchrpc/proxy/gw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func TestGetTokenBalance(t *testing.T) {
}

// get token balance
var balance uint64 = 0
var balance uint64
for _, out := range outputs.Outputs {
if out.SlpToken == nil {
continue
Expand Down
2 changes: 1 addition & 1 deletion bchrpc/proxy/middlewares/cache_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
)

// Disables caching of our responses.
// NoCacheMiddleware disables caching of our responses.
// If caching of API responses is desired you should always explicitly enable it by setting
// the appropriate 'Cache-Control' header value.
// Sending no header defaults to 'private' which allows browsers to cache responses: https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524721(v=vs.90)?redirectedfrom=MSDN
Expand Down
2 changes: 1 addition & 1 deletion bchrpc/proxy/middlewares/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
)

// Overrides CORS headers per request.
// CorsMiddleware overrides CORS headers per request.
func CorsMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
Expand Down
4 changes: 2 additions & 2 deletions bchrpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ func (s *GrpcServer) GetSlpParsedScript(ctx context.Context, req *pb.GetSlpParse
return resp, nil
}

// GetSlpTrustedSlpValidation returns slp validity information about a specific token output
// GetSlpTrustedValidation returns slp validity information about a specific token output
func (s *GrpcServer) GetSlpTrustedValidation(ctx context.Context, req *pb.GetSlpTrustedValidationRequest) (*pb.GetSlpTrustedValidationResponse, error) {
if s.slpIndex == nil {
return nil, status.Error(codes.Unavailable, "slpindex required")
Expand Down Expand Up @@ -2832,7 +2832,7 @@ func (s *GrpcServer) getSlpToken(hash *chainhash.Hash, vout uint32, scriptPubKey
}

var (
isMintBaton bool = false
isMintBaton bool
slpAction pb.SlpAction
decimals int
)
Expand Down
13 changes: 4 additions & 9 deletions blockchain/indexers/slpindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ func dbPutSlpIndexEntry(idx *SlpIndex, dbTx database.Tx, entryInfo *dbSlpIndexEn
}

var (
tokenMetadataNeedsUpdated bool = false
mintBatonVout uint32 = 0
tokenMetadataNeedsUpdated = false
mintBatonVout uint32
mintBatonHash *chainhash.Hash
nft1GroupID *chainhash.Hash
)
Expand Down Expand Up @@ -637,7 +637,7 @@ func (idx *SlpIndex) ConnectBlock(dbTx database.Tx, block *bchutil.Block, stxos
return nil
}

// AddGraphSearchTxn
// AddGraphSearchTxn adds a transaction to graph search.
func (idx *SlpIndex) AddGraphSearchTxn(tx *wire.MsgTx) {
if idx.graphSearchDb == nil {
return
Expand Down Expand Up @@ -985,13 +985,8 @@ func CheckSlpTx(tx *wire.MsgTx, getSlpIndexEntry GetSlpIndexEntryHandler, putTxI
//
// This is part of the Indexer interface.
func (idx *SlpIndex) DisconnectBlock(dbTx database.Tx, block *bchutil.Block, stxos []blockchain.SpentTxOut) error {

// Remove all of the transactions in the block from the index.
if err := dbRemoveSlpIndexEntries(dbTx, block); err != nil {
return err
}

return nil
return dbRemoveSlpIndexEntries(dbTx, block)
}

// GetSlpIndexEntry returns a serialized slp index entry for the provided transaction hash
Expand Down
6 changes: 2 additions & 4 deletions blockchain/utxocache.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,8 @@ func (s *utxoCache) flush(bestState *BestState) error {
if err := dbPutUtxoEntries(dbTx, entriesPut); err != nil {
return err
}
if err := dbDeleteUtxoEntries(dbTx, entriesDelete); err != nil {
return err
}
return nil

return dbDeleteUtxoEntries(dbTx, entriesDelete)
}
s.flushInProgress = true
defer func() { s.flushInProgress = false }()
Expand Down
61 changes: 53 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,75 @@ module github.com/gcash/bchd
go 1.12

require (
4d63.com/gochecknoglobals v0.0.0-20210416044342-fb0abda3d9aa // indirect
github.com/ashanbrown/forbidigo v1.2.0 // indirect
github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde // indirect
github.com/bluele/gcache v0.0.2
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd
github.com/btcsuite/goleveldb v1.0.0
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
github.com/btcsuite/winsvc v1.0.0
github.com/charithe/durationcheck v0.0.7 // indirect
github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect
github.com/davecgh/go-spew v1.1.1
github.com/dchest/siphash v1.2.2
github.com/fatih/color v1.11.0 // indirect
github.com/gcash/bchlog v0.0.0-20180913005452-b4f036f92fa6
github.com/gcash/bchutil v0.0.0-20210113190856-6ea28dff4000
github.com/go-lintpack/lintpack v0.5.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.4.3
github.com/golang/protobuf v1.5.2
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect
github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c // indirect
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect
github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee // indirect
github.com/golangci/golangci-lint v1.40.1 // indirect
github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547 // indirect
github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc // indirect
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20210522101830-0589229737b2 // indirect
github.com/gorilla/mux v1.8.0
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.1.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.4.0
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/improbable-eng/grpc-web v0.13.0
github.com/jessevdk/go-flags v0.0.0-20181221193153-c0795c8afcf4
github.com/jingyugao/rowserrcheck v1.1.0 // indirect
github.com/jrick/logrotate v1.0.0
github.com/prometheus/client_golang v1.9.0
github.com/klauspost/cpuid v1.2.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/mgechev/revive v1.0.6 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/pelletier/go-toml v1.9.1 // indirect
github.com/polyfloyd/go-errorlint v0.0.0-20210510181950-ab96adb96fea // indirect
github.com/prometheus/client_golang v1.10.0
github.com/prometheus/common v0.25.0 // indirect
github.com/quasilyte/go-ruleguard v0.3.5 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20200805063351-8f842688393c // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7 // indirect
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
github.com/simpleledgerinc/goslp v0.0.0-20210310142058-5920ead5c7a0
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/tetafro/godot v1.4.7 // indirect
github.com/xeipuuv/gojsonschema v1.2.0
github.com/zquestz/grab v0.0.0-20190224022517-abcee96e61b1
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/net v0.0.0-20201024042810-be3efd7ff127
golang.org/x/text v0.3.4
google.golang.org/grpc v1.34.0
google.golang.org/protobuf v1.25.0
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
golang.org/x/net v0.0.0-20210521195947-fe42d452be8f
golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 // indirect
golang.org/x/text v0.3.6
google.golang.org/genproto v0.0.0-20210521181308-5ccab8a35a9a // indirect
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
mvdan.cc/unparam v0.0.0-20210520122750-2ac67f130a88 // indirect
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 // indirect
)
Loading

0 comments on commit 3bca12e

Please sign in to comment.