Fix off-by-one in handshake, add debug logging

This commit is contained in:
Ethan Frey 2017-10-10 17:10:10 +02:00
parent 98e615709a
commit 724fb065f2
2 changed files with 4 additions and 2 deletions

View File

@ -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),
@ -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()

View File

@ -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(),
}
}