Skip to content

Commit

Permalink
Fix off-by-one in handshake, add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Oct 10, 2017
1 parent 98e6157 commit 724fb06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func (app *Basecoin) GetState() sm.SimpleDB {
// Info - ABCI
func (app *Basecoin) Info(req abci.RequestInfo) abci.ResponseInfo {
resp := app.state.Info()
app.logger.Debug("Info",
"height", resp.LastBlockHeight,
"hash", fmt.Sprintf("%X", resp.LastBlockAppHash))
app.height = resp.LastBlockHeight
return abci.ResponseInfo{
Data: fmt.Sprintf("Basecoin v%v", version.Version),
Expand All @@ -70,7 +73,6 @@ func (app *Basecoin) Info(req abci.RequestInfo) abci.ResponseInfo {
// InitState - used to setup state (was SetOption)
// to be used by InitChain later
func (app *Basecoin) InitState(key string, value string) string {

module, key := splitKey(key)
state := app.state.Append()

Expand Down
2 changes: 1 addition & 1 deletion app/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (s *Store) Info() abci.ResponseInfo {
"hash", fmt.Sprintf("%X", s.Hash()))
return abci.ResponseInfo{
Data: cmn.Fmt("size:%v", s.State.Size()),
LastBlockHeight: s.height - 1,
LastBlockHeight: s.height,
LastBlockAppHash: s.Hash(),
}
}
Expand Down

0 comments on commit 724fb06

Please sign in to comment.