golinted up to and incl modules

This commit is contained in:
rigel rozanski
2017-07-06 05:30:03 -04:00
parent 35845a958f
commit 0303f2aaaa
11 changed files with 56 additions and 35 deletions
+8 -4
View File
@@ -7,10 +7,10 @@ import (
"github.com/tendermint/basecoin/types"
)
const (
NameFee = "fee"
)
// NameFee - namespace for the fee module
const NameFee = "fee"
// AccountChecker - interface used by SimpleFeeHandler
type AccountChecker interface {
// Get amount checks the current amount
GetAmount(store types.KVStore, addr basecoin.Actor) (types.Coins, error)
@@ -20,13 +20,15 @@ type AccountChecker interface {
ChangeAmount(store types.KVStore, addr basecoin.Actor, coins types.Coins) (types.Coins, error)
}
// SimpleFeeHandler - checker object for fee checking
type SimpleFeeHandler struct {
AccountChecker
MinFee types.Coins
stack.PassOption
}
func (_ SimpleFeeHandler) Name() string {
// Name - return the namespace for the fee module
func (SimpleFeeHandler) Name() string {
return NameFee
}
@@ -34,6 +36,7 @@ var _ stack.Middleware = SimpleFeeHandler{}
// Yes, I know refactor a bit... really too late already
// CheckTx - check the transaction
func (h SimpleFeeHandler) CheckTx(ctx basecoin.Context, store types.KVStore, tx basecoin.Tx, next basecoin.Checker) (res basecoin.Result, err error) {
feeTx, ok := tx.Unwrap().(*Fee)
if !ok {
@@ -57,6 +60,7 @@ func (h SimpleFeeHandler) CheckTx(ctx basecoin.Context, store types.KVStore, tx
return basecoin.Result{Log: "Valid tx"}, nil
}
// DeliverTx - send the fee handler transaction
func (h SimpleFeeHandler) DeliverTx(ctx basecoin.Context, store types.KVStore, tx basecoin.Tx, next basecoin.Deliver) (res basecoin.Result, err error) {
feeTx, ok := tx.Unwrap().(*Fee)
if !ok {