multi: fix linter issues

This commit is contained in:
Oliver Gugger 2023-02-23 11:11:12 +01:00
parent 995b136149
commit 34af866ce9
No known key found for this signature in database
GPG key ID: 8E4256593F177720
10 changed files with 24 additions and 24 deletions

View file

@ -67,6 +67,12 @@ linters:
- golint
- maligned
- scopelint
- varcheck
- structcheck
- deadcode
# gRPC needs snake case notation.
- nosnakecase
# New linters that need a code adjustment first.
- wrapcheck
@ -103,6 +109,7 @@ linters:
- revive
- promlinter
- forbidigo
- interfacebloat
issues:
exclude-rules:

View file

@ -223,7 +223,7 @@ func (h *testHarness) expireAccount(account *Account) {
}
func (h *testHarness) closeAccount(account *Account, feeExpr FeeExpr,
bestHeight uint32) *wire.MsgTx {
bestHeight uint32) {
h.t.Helper()
@ -259,8 +259,6 @@ func (h *testHarness) closeAccount(account *Account, feeExpr FeeExpr,
account.State = StateClosed
account.HeightHint = spendHeight
h.assertAccountExists(account)
return closeTx
}
func (h *testHarness) assertSpendTxBroadcast(accountBeforeSpend *Account,
@ -1058,7 +1056,7 @@ func TestAccountWithdrawal(t *testing.T) {
// Finally, close the account to ensure we can process another
// spend after the withdrawal.
expr := defaultFeeExpr
_ = h.closeAccount(account, &expr, bestHeight)
h.closeAccount(account, &expr, bestHeight)
})
}
@ -1233,7 +1231,7 @@ func TestAccountDeposit(t *testing.T) {
// Finally, close the account to ensure we can process another
// spend after the withdrawal.
expr := defaultFeeExpr
_ = h.closeAccount(account, &expr, bestHeight)
h.closeAccount(account, &expr, bestHeight)
})
}

View file

@ -3,7 +3,7 @@ package pool
import "time"
const (
// maxBackOff is the maximum amount of that that we'll wait to retry to
// maxBackOff is the maximum amount of that we'll wait to retry to
// w/e operation we're wanting to back off.
maxBackOff = time.Minute

View file

@ -269,7 +269,7 @@ func getMinChanAmount(ctx *cli.Context, orderAmt uint64,
return 0
}
// validateMinChanAmount checks that the the minimum channel amount parameter
// validateMinChanAmount checks that the minimum channel amount parameter
// has been properly set.
func validateMinChanAmount(ctx *cli.Context,
orderAmt, minChanAmt btcutil.Amount, orderType order.Type) error {

View file

@ -429,7 +429,7 @@ type Kit struct {
// has been formally validated.
MultiSigKeyLocator keychain.KeyLocator
// MaxBatchFeeRate is is the maximum fee rate the trader is willing to
// MaxBatchFeeRate is the maximum fee rate the trader is willing to
// pay for the batch transaction, in sat/kW.
MaxBatchFeeRate chainfee.SatPerKWeight

View file

@ -102,7 +102,7 @@ func ParseRPCOrder(version, leaseDuration uint32,
// Default value, trader didn't specify a channel type.
case auctioneerrpc.OrderChannelType_ORDER_CHANNEL_TYPE_UNKNOWN:
// If we have a chan type selector, we'll use that, otherwise
// we'll just use peer dependent channels as as default.
// we'll just use peer dependent channels as default.
if opts.chanTypeSelector != nil {
kit.ChannelType = opts.chanTypeSelector()
} else {

View file

@ -3024,7 +3024,7 @@ func (s *rpcServer) setTicketStateForOrder(newState sidecar.State,
// determineAccountVersion parses the RPC version and makes sure it can actually
// be used.
func (s *rpcServer) determineAccountVersion(
newVersion poolrpc.AccountVersion) (account.Version, error) {
newVersion poolrpc.AccountVersion) (account.Version, error) { //nolint
// Now we can do the account version validation.
switch newVersion {

View file

@ -30,7 +30,7 @@ func getAccountKey(acctKey []byte) *btcec.PublicKey {
return res
}
func genRenewAccountReq(accountKey []byte, absolute, relative uint32,
func genRenewAccountReq(accountKey []byte, relative uint32,
feerate uint64, version uint32) *poolrpc.RenewAccountRequest {
req := &poolrpc.RenewAccountRequest{
@ -41,14 +41,8 @@ func genRenewAccountReq(accountKey []byte, absolute, relative uint32,
req.AccountKey = accountKey
req.FeeRateSatPerKw = feerate
if absolute != 0 {
req.AccountExpiry = &poolrpc.RenewAccountRequest_AbsoluteExpiry{
AbsoluteExpiry: absolute,
}
} else {
req.AccountExpiry = &poolrpc.RenewAccountRequest_RelativeExpiry{
RelativeExpiry: relative,
}
req.AccountExpiry = &poolrpc.RenewAccountRequest_RelativeExpiry{
RelativeExpiry: relative,
}
return req
@ -70,7 +64,7 @@ var renewAccountTestCases = []struct {
AppPatch: 3,
},
getReq: func() *poolrpc.RenewAccountRequest {
return genRenewAccountReq(traderKeyRaw, 0, 10, 1000, 1)
return genRenewAccountReq(traderKeyRaw, 10, 1000, 1)
},
mockSetter: func(req *poolrpc.RenewAccountRequest,
accMgr *account.MockManager, marshalerMock *MockMarshaler) {
@ -105,7 +99,7 @@ var renewAccountTestCases = []struct {
name: "we are able to successfully renew an account",
lndVer: minimalCompatibleVersion,
getReq: func() *poolrpc.RenewAccountRequest {
return genRenewAccountReq(traderKeyRaw, 0, 10, 1000, 0)
return genRenewAccountReq(traderKeyRaw, 10, 1000, 0)
},
mockSetter: func(req *poolrpc.RenewAccountRequest,
accMgr *account.MockManager, marshalerMock *MockMarshaler) {
@ -155,7 +149,7 @@ var renewAccountTestCases = []struct {
name: "req should specify absolute/relative expiry",
lndVer: minimalCompatibleVersion,
getReq: func() *poolrpc.RenewAccountRequest {
return genRenewAccountReq(traderKeyRaw, 0, 0, 1000, 0)
return genRenewAccountReq(traderKeyRaw, 0, 1000, 0)
},
expectedError: "either relative or absolute height must be specified",
mockSetter: func(req *poolrpc.RenewAccountRequest,
@ -168,7 +162,7 @@ var renewAccountTestCases = []struct {
name: "req should specify a valid fee rate",
lndVer: minimalCompatibleVersion,
getReq: func() *poolrpc.RenewAccountRequest {
return genRenewAccountReq(traderKeyRaw, 0, 100, 0, 0)
return genRenewAccountReq(traderKeyRaw, 100, 0, 0)
},
expectedError: "fee rate of 0 sat/kw is too low, minimum is 253 sat/kw",
mockSetter: func(req *poolrpc.RenewAccountRequest,

1
run.go
View file

@ -50,6 +50,7 @@ func Run(cfg *Config) error {
"/debug/pprof", http.StatusSeeOther,
)
http.Handle("/", profileRedirect)
//nolint:gosec
fmt.Println(http.ListenAndServe(cfg.Profile, nil))
}()
}

View file

@ -287,7 +287,7 @@ func (s *Server) Start() error {
s.restListener = tls.NewListener(s.restListener, serverTLSCfg)
shutdownFuncs["restListener"] = s.restListener.Close
s.restProxy = &http.Server{Handler: mux}
s.restProxy = &http.Server{Handler: mux} //nolint:gosec
s.wg.Add(1)
go func() {
defer s.wg.Done()