mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
CommitSync() returns tmsp.Result
This commit is contained in:
parent
de6f76758d
commit
8183e3201b
@ -75,9 +75,9 @@ func TestSerialReap(t *testing.T) {
|
||||
res.Code, res.Data, res.Log)
|
||||
}
|
||||
}
|
||||
hash, log := appConnCon.Commit()
|
||||
if len(hash) != 8 {
|
||||
t.Errorf("Error committing. Hash:%X log:%v", hash, log)
|
||||
res := appConnCon.Commit()
|
||||
if len(res.Data) != 8 {
|
||||
t.Errorf("Error committing. Hash:%X log:%v", res.Data, res.Log)
|
||||
}
|
||||
}
|
||||
|
||||
|
10
node/node.go
10
node/node.go
@ -258,12 +258,12 @@ func getProxyApp(addr string, hash []byte) (proxyAppConn proxy.AppConn) {
|
||||
}
|
||||
|
||||
// Check the hash
|
||||
currentHash, _, err := proxyAppConn.CommitSync()
|
||||
if err != nil {
|
||||
PanicCrisis(Fmt("Error in getting proxyAppConn hash: %v", err))
|
||||
res := proxyAppConn.CommitSync()
|
||||
if res.IsErr() {
|
||||
PanicCrisis(Fmt("Error in getting proxyAppConn hash: %v", res))
|
||||
}
|
||||
if !bytes.Equal(hash, currentHash) {
|
||||
PanicCrisis(Fmt("ProxyApp hash does not match. Expected %X, got %X", hash, currentHash))
|
||||
if !bytes.Equal(hash, res.Data) {
|
||||
PanicCrisis(Fmt("ProxyApp hash does not match. Expected %X, got %X", hash, res.Data))
|
||||
}
|
||||
|
||||
return proxyAppConn
|
||||
|
@ -18,7 +18,7 @@ type AppConn interface {
|
||||
|
||||
InfoSync() (info string, err error)
|
||||
FlushSync() error
|
||||
CommitSync() (hash []byte, log string, err error)
|
||||
CommitSync() (res tmsp.Result)
|
||||
InitChainSync(validators []*tmsp.Validator) (err error)
|
||||
EndBlockSync(height uint64) (changedValidators []*tmsp.Validator, err error)
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ func (app *localAppConn) CheckTxAsync(tx []byte) *tmspcli.ReqRes {
|
||||
|
||||
func (app *localAppConn) CommitAsync() *tmspcli.ReqRes {
|
||||
app.mtx.Lock()
|
||||
hash, log := app.Application.Commit()
|
||||
res := app.Application.Commit()
|
||||
app.mtx.Unlock()
|
||||
return app.callback(
|
||||
tmsp.RequestCommit(),
|
||||
tmsp.ResponseCommit(hash, log),
|
||||
tmsp.ResponseCommit(res.Code, res.Data, res.Log),
|
||||
)
|
||||
}
|
||||
|
||||
@ -93,11 +93,11 @@ func (app *localAppConn) FlushSync() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (app *localAppConn) CommitSync() (hash []byte, log string, err error) {
|
||||
func (app *localAppConn) CommitSync() (res tmsp.Result) {
|
||||
app.mtx.Lock()
|
||||
hash, log = app.Application.Commit()
|
||||
res = app.Application.Commit()
|
||||
app.mtx.Unlock()
|
||||
return hash, log, nil
|
||||
return res
|
||||
}
|
||||
|
||||
func (app *localAppConn) InitChainSync(validators []*tmsp.Validator) (err error) {
|
||||
|
@ -95,18 +95,18 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy
|
||||
log.Info("TODO: Do something with changedValidators", changedValidators)
|
||||
|
||||
// Commit block, get hash back
|
||||
hash, logStr, err := proxyAppConn.CommitSync()
|
||||
if err != nil {
|
||||
log.Warn("Error in proxyAppConn.CommitSync", "error", err)
|
||||
return err
|
||||
res := proxyAppConn.CommitSync()
|
||||
if res.IsErr() {
|
||||
log.Warn("Error in proxyAppConn.CommitSync", "error", res)
|
||||
return res
|
||||
}
|
||||
if logStr != "" {
|
||||
log.Debug("Commit.Log: " + logStr)
|
||||
if res.Log != "" {
|
||||
log.Debug("Commit.Log: " + res.Log)
|
||||
}
|
||||
log.Info(Fmt("ExecBlock got %v valid txs and %v invalid txs", validTxs, invalidTxs))
|
||||
|
||||
// Set the state's new AppHash
|
||||
s.AppHash = hash
|
||||
s.AppHash = res.Data
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user