Add InitValidate method for setup
This commit is contained in:
@@ -13,7 +13,8 @@ const (
|
||||
|
||||
// Chain enforces that this tx was bound to the named chain
|
||||
type Chain struct {
|
||||
stack.PassOption
|
||||
stack.PassInitState
|
||||
stack.PassInitValidate
|
||||
}
|
||||
|
||||
// Name of the module - fulfills Middleware interface
|
||||
|
||||
@@ -3,6 +3,7 @@ package base
|
||||
import (
|
||||
"time"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/tmlibs/log"
|
||||
|
||||
"github.com/tendermint/basecoin"
|
||||
@@ -70,6 +71,15 @@ func (Logger) InitState(l log.Logger, store state.SimpleDB, module, key, value s
|
||||
return res, err
|
||||
}
|
||||
|
||||
// InitValidate logs time and result - fulfills Middlware interface
|
||||
func (Logger) InitValidate(l log.Logger, store state.SimpleDB, vals []*abci.Validator, next basecoin.InitValidater) {
|
||||
start := time.Now()
|
||||
next.InitValidate(l, store, vals)
|
||||
delta := time.Now().Sub(start)
|
||||
l = l.With("duration", micros(delta))
|
||||
l.Info("InitValidate")
|
||||
}
|
||||
|
||||
// micros returns how many microseconds passed in a call
|
||||
func micros(d time.Duration) int {
|
||||
return int(d.Seconds() * 1000000)
|
||||
|
||||
@@ -18,7 +18,7 @@ package base
|
||||
|
||||
// // Multiplexer grabs a MultiTx and sends them sequentially down the line
|
||||
// type Multiplexer struct {
|
||||
// stack.PassOption
|
||||
// stack.PassInitState
|
||||
// }
|
||||
|
||||
// // Name of the module - fulfills Middleware interface
|
||||
|
||||
Reference in New Issue
Block a user