Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/imporve makefile #99

Merged
merged 4 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Go

on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:

build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: install deps
run: sudo apt-get install make ftp git bzr curl hwloc libhwloc-dev mesa-opencl-icd ocl-icd-opencl-dev wget -y && sudo apt upgrade -y

- name: Build
env:
GOPROXY: "https://proxy.golang.org,direct"
GO111MODULE: "on"
run: |
make

- name: Test
run: go test -v ./...
26 changes: 26 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: golangci-lint

on:
push:
branches:
- master
pull_request:
branches:
- "**"

jobs:
golangci:
name: lint
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: install deps
run: sudo apt-get install make ftp git bzr curl hwloc libhwloc-dev mesa-opencl-icd ocl-icd-opencl-dev wget -y && sudo apt upgrade -y

- name: Make dep
run: make deps

- uses: dominikh/staticcheck-action@v1.1.0
with:
version: "2021.1.1"
2 changes: 1 addition & 1 deletion .github/workflows/tag-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
run: sudo apt-get install make ncftp mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y
- name: Build
run: |
go clean --modcache && make deps && make
go clean --modcache && make
mkdir ./release && mv ./market-client ./venus-market ./release

- name: Zip Release
Expand Down
12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,15 @@ build-dep/.update-modules: build-dep;
git submodule update --init --recursive
touch $@

ffi-version-check:
@[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo "FFI version mismatch, update submodules"; exit 1)
BUILD_DEPS+=ffi-version-check

.PHONY: ffi-version-check


## build

test:
rm -rf models/test_sqlite_db*
go test -race ./...

lint: $(BUILD_DEPS)
go run github.com/golangci/golangci-lint/cmd/golangci-lint run
staticcheck ./...

deps: $(BUILD_DEPS)

dist-clean:
git clean -xdff
Expand Down
47 changes: 23 additions & 24 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import (
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/discovery"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-fil-markets/storagemarket/network"
"github.com/filecoin-project/go-fil-markets/stores"
Expand Down Expand Up @@ -87,7 +86,7 @@ type API struct {

SMDealClient storagemarket.StorageClient
RetDiscovery discovery.PeerResolver
Retrieval rm.RetrievalClient
Retrieval retrievalmarket.RetrievalClient

// accessors for imports and retrievals.
Imports ClientImportMgr
Expand Down Expand Up @@ -438,12 +437,12 @@ func (a *API) ClientFindData(ctx context.Context, root cid.Cid, piece *cid.Cid)
if err != nil {
return nil, err
}
pp := rm.RetrievalPeer{
pp := retrievalmarket.RetrievalPeer{
Address: p.Address,
ID: *mi.PeerId,
}

out = append(out, a.makeRetrievalQuery(ctx, pp, root, piece, rm.QueryParams{}))
out = append(out, a.makeRetrievalQuery(ctx, pp, root, piece, retrievalmarket.QueryParams{}))
}

return out, nil
Expand All @@ -454,25 +453,25 @@ func (a *API) ClientMinerQueryOffer(ctx context.Context, miner address.Address,
if err != nil {
return types.QueryOffer{}, err
}
rp := rm.RetrievalPeer{
rp := retrievalmarket.RetrievalPeer{
Address: miner,
ID: *mi.PeerId,
}
return a.makeRetrievalQuery(ctx, rp, root, piece, rm.QueryParams{}), nil
return a.makeRetrievalQuery(ctx, rp, root, piece, retrievalmarket.QueryParams{}), nil
}

func (a *API) makeRetrievalQuery(ctx context.Context, rp rm.RetrievalPeer, payload cid.Cid, piece *cid.Cid, qp rm.QueryParams) types.QueryOffer {
func (a *API) makeRetrievalQuery(ctx context.Context, rp retrievalmarket.RetrievalPeer, payload cid.Cid, piece *cid.Cid, qp retrievalmarket.QueryParams) types.QueryOffer {
queryResponse, err := a.Retrieval.Query(ctx, rp, payload, qp)
if err != nil {
return types.QueryOffer{Err: err.Error(), Miner: rp.Address, MinerPeer: rp}
}
var errStr string
switch queryResponse.Status {
case rm.QueryResponseAvailable:
case retrievalmarket.QueryResponseAvailable:
errStr = ""
case rm.QueryResponseUnavailable:
case retrievalmarket.QueryResponseUnavailable:
errStr = fmt.Sprintf("retrieval query offer was unavailable: %s", queryResponse.Message)
case rm.QueryResponseError:
case retrievalmarket.QueryResponseError:
errStr = fmt.Sprintf("retrieval query offer errored: %s", queryResponse.Message)
}

Expand Down Expand Up @@ -773,14 +772,14 @@ func (a *API) ClientRetrieve(ctx context.Context, params types.RetrievalOrder) (
}, nil
}

func (a *API) doRetrieval(ctx context.Context, order types.RetrievalOrder, sel datamodel.Node) (rm.DealID, error) {
func (a *API) doRetrieval(ctx context.Context, order types.RetrievalOrder, sel datamodel.Node) (retrievalmarket.DealID, error) {
if order.MinerPeer == nil || order.MinerPeer.ID == "" {
mi, err := a.Full.StateMinerInfo(ctx, order.Miner, vTypes.EmptyTSK)
if err != nil {
return 0, err
}

order.MinerPeer = &rm.RetrievalPeer{
order.MinerPeer = &retrievalmarket.RetrievalPeer{
ID: *mi.PeerId,
Address: order.Miner,
}
Expand All @@ -796,7 +795,7 @@ func (a *API) doRetrieval(ctx context.Context, order types.RetrievalOrder, sel d

ppb := vTypes.BigDiv(order.Total, vTypes.NewInt(order.Size))

params, err := rm.NewParamsV1(ppb, order.PaymentInterval, order.PaymentIntervalIncrease, sel, order.Piece, order.UnsealPrice)
params, err := retrievalmarket.NewParamsV1(ppb, order.PaymentInterval, order.PaymentIntervalIncrease, sel, order.Piece, order.UnsealPrice)
if err != nil {
return 0, xerrors.Errorf("Error in retrieval params: %s", err)
}
Expand All @@ -820,13 +819,13 @@ func (a *API) doRetrieval(ctx context.Context, order types.RetrievalOrder, sel d
return id, nil
}

func (a *API) ClientRetrieveWait(ctx context.Context, deal rm.DealID) error {
func (a *API) ClientRetrieveWait(ctx context.Context, deal retrievalmarket.DealID) error {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

subscribeEvents := make(chan rm.ClientDealState, 1)
subscribeEvents := make(chan retrievalmarket.ClientDealState, 1)

unsubscribe := a.Retrieval.SubscribeToEvents(func(event rm.ClientEvent, state rm.ClientDealState) {
unsubscribe := a.Retrieval.SubscribeToEvents(func(event retrievalmarket.ClientEvent, state retrievalmarket.ClientDealState) {
// We'll check the deal IDs inside consumeAllEvents.
if state.ID != deal {
return
Expand Down Expand Up @@ -855,15 +854,15 @@ func (a *API) ClientRetrieveWait(ctx context.Context, deal rm.DealID) error {
return xerrors.New("Retrieval Timed Out")
case state := <-subscribeEvents:
switch state.Status {
case rm.DealStatusCompleted:
case retrievalmarket.DealStatusCompleted:
return nil
case rm.DealStatusRejected:
case retrievalmarket.DealStatusRejected:
return xerrors.Errorf("Retrieval Proposal Rejected: %s", state.Message)
case rm.DealStatusCancelled:
case retrievalmarket.DealStatusCancelled:
return xerrors.Errorf("Retrieval was cancelled externally: %s", state.Message)
case
rm.DealStatusDealNotFound,
rm.DealStatusErrored:
retrievalmarket.DealStatusDealNotFound,
retrievalmarket.DealStatusErrored:
return xerrors.Errorf("Retrieval Error: %s", state.Message)
}
}
Expand Down Expand Up @@ -1187,7 +1186,7 @@ func (a *API) ClientListRetrievals(ctx context.Context) ([]types.RetrievalInfo,
func (a *API) ClientGetRetrievalUpdates(ctx context.Context) (<-chan types.RetrievalInfo, error) {
updates := make(chan types.RetrievalInfo)

unsub := a.Retrieval.SubscribeToEvents(func(_ rm.ClientEvent, deal rm.ClientDealState) {
unsub := a.Retrieval.SubscribeToEvents(func(_ retrievalmarket.ClientEvent, deal retrievalmarket.ClientDealState) {
updates <- a.newRetrievalInfo(ctx, deal)
})

Expand All @@ -1199,7 +1198,7 @@ func (a *API) ClientGetRetrievalUpdates(ctx context.Context) (<-chan types.Retri
return updates, nil
}

func (a *API) newRetrievalInfoWithTransfer(ch *types2.DataTransferChannel, deal rm.ClientDealState) types.RetrievalInfo {
func (a *API) newRetrievalInfoWithTransfer(ch *types2.DataTransferChannel, deal retrievalmarket.ClientDealState) types.RetrievalInfo {
return types.RetrievalInfo{
PayloadCID: deal.PayloadCID,
ID: deal.ID,
Expand All @@ -1217,7 +1216,7 @@ func (a *API) newRetrievalInfoWithTransfer(ch *types2.DataTransferChannel, deal
}
}

func (a *API) newRetrievalInfo(ctx context.Context, v rm.ClientDealState) types.RetrievalInfo {
func (a *API) newRetrievalInfo(ctx context.Context, v retrievalmarket.ClientDealState) types.RetrievalInfo {
// Find the data transfer associated with this deal
var transferCh *types2.DataTransferChannel
if v.ChannelID != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/market-client/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var transferRestartCmd = &cli.Command{

transferUint, err := strconv.ParseUint(cctx.Args().First(), 10, 64)
if err != nil {
return fmt.Errorf("Error reading transfer ID: %w", err)
return fmt.Errorf("error reading transfer ID: %w", err)
}
transferID := datatransfer.TransferID(transferUint)
initiator := cctx.Bool("initiator")
Expand Down Expand Up @@ -209,7 +209,7 @@ var transferCancelCmd = &cli.Command{

transferUint, err := strconv.ParseUint(cctx.Args().First(), 10, 64)
if err != nil {
return fmt.Errorf("Error reading transfer ID: %w", err)
return fmt.Errorf("error reading transfer ID: %w", err)
}
transferID := datatransfer.TransferID(transferUint)
initiator := cctx.Bool("initiator")
Expand Down
3 changes: 2 additions & 1 deletion fundmgr/fundmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ func (a *fundedAddress) requestAndWait(ctx context.Context, wallet address.Addre
}

// Used by the tests
func (a *fundedAddress) onProcessStart(fn func() bool) { // nolint
//lint:ignore U1000 ingore this for now
func (a *fundedAddress) onProcessStart(fn func() bool) {
a.lk.Lock()
defer a.lk.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ require (
go.uber.org/multierr v1.7.0
go.uber.org/zap v1.19.1
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools v0.1.9 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
gorm.io/driver/mysql v1.1.1
gorm.io/gorm v1.21.12
Expand All @@ -101,5 +102,4 @@ require (
replace (
github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi
github.com/filecoin-project/go-jsonrpc => github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210721095535-a67dff16de21
github.com/ipfs/go-ipfs-cmds => github.com/ipfs-force-community/go-ipfs-cmds v0.6.1-0.20210521090123-4587df7fa0ab
)
11 changes: 8 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,6 @@ github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU=
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/intel/goresctrl v0.2.0/go.mod h1:+CZdzouYFn5EsxgqAQTEzMfwKwuc0fVdMrT9FCCAVRQ=
github.com/ipfs-force-community/go-ipfs-cmds v0.6.1-0.20210521090123-4587df7fa0ab/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk=
github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210721095535-a67dff16de21 h1:ht754GJKTx1uYy4gYUhJxxefhKqxReo/654URuB+Ksk=
github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210721095535-a67dff16de21/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/ipfs-force-community/metrics v1.0.0/go.mod h1:mn40SioMuKtjmRumHFy/fJ26Pn028XuDjUJE9dorjyw=
Expand Down Expand Up @@ -1130,6 +1129,7 @@ github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcB
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
github.com/ipfs/go-ipfs-cmdkit v0.0.1/go.mod h1:9FtbMdUabcSqv/G4/8WCxSLxkZxn/aZEFrxxqnVcRbg=
github.com/ipfs/go-ipfs-cmds v0.6.1-0.20220212012746-40b8fddb899f/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
Expand Down Expand Up @@ -2454,6 +2454,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
Expand Down Expand Up @@ -2670,8 +2671,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -2747,6 +2749,7 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand Down Expand Up @@ -2921,6 +2924,7 @@ golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
Expand Down Expand Up @@ -3067,8 +3071,9 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
20 changes: 8 additions & 12 deletions minermgr/minermgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,17 @@ func (m *UserMgrImpl) distAddress(ctx context.Context, addrs ...types.User) erro
func (m *UserMgrImpl) refreshUsers(ctx context.Context) {
tm := time.NewTicker(time.Minute)
defer tm.Stop()
for {
select {
case <-tm.C:
miners, err := m.getMinerFromVenusAuth(context.TODO(), 0, 0)
if err != nil {
log.Errorf("unable to get venus miner from venus auth %s", err)
}
for range tm.C {
miners, err := m.getMinerFromVenusAuth(context.TODO(), 0, 0)
if err != nil {
log.Errorf("unable to get venus miner from venus auth %s", err)
}

err = m.distAddress(ctx, miners...)
if err != nil {
log.Errorf("unable to append new user to address manager %s", err)
}
err = m.distAddress(ctx, miners...)
if err != nil {
log.Errorf("unable to append new user to address manager %s", err)
}
}

}
func convertConfigAddress(addrs []config.User) []types.User {
addrs2 := make([]types.User, len(addrs))
Expand Down
2 changes: 1 addition & 1 deletion piecestorage/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func ParserProtocol(pro string, cfg interface{}) error {

func lookupMethod(val reflect.Type, name string) (string, error) {
for i := 0; i < val.NumField(); i++ {
if strings.ToLower(val.Field(i).Name) == strings.ToLower(name) {
if strings.EqualFold(val.Field(i).Name, name) {
return val.Field(i).Name, nil
}
}
Expand Down
Loading