From 18d0da4ea3a8fe1caf3a6b14ebafd1e6e8eb1386 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sun, 6 Mar 2016 18:02:29 -0800 Subject: [PATCH] Remove BeginBlock --- proxy/app_conn.go | 3 +-- proxy/local_app_conn.go | 13 ++----------- state/execution.go | 9 +-------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/proxy/app_conn.go b/proxy/app_conn.go index af20b7472..b371f6d28 100644 --- a/proxy/app_conn.go +++ b/proxy/app_conn.go @@ -20,6 +20,5 @@ type AppConn interface { FlushSync() error CommitSync() (hash []byte, log string, err error) InitChainSync(validators []*tmsp.Validator) (err error) - BeginBlockSync(height uint64) (err error) - EndBlockSync() (changedValidators []*tmsp.Validator, err error) + EndBlockSync(height uint64) (changedValidators []*tmsp.Validator, err error) } diff --git a/proxy/local_app_conn.go b/proxy/local_app_conn.go index 83b79069d..16edcaeb9 100644 --- a/proxy/local_app_conn.go +++ b/proxy/local_app_conn.go @@ -109,19 +109,10 @@ func (app *localAppConn) InitChainSync(validators []*tmsp.Validator) (err error) return nil } -func (app *localAppConn) BeginBlockSync(height uint64) (err error) { +func (app *localAppConn) EndBlockSync(height uint64) (changedValidators []*tmsp.Validator, err error) { app.mtx.Lock() if bcApp, ok := app.Application.(tmsp.BlockchainAware); ok { - bcApp.BeginBlock(height) - } - app.mtx.Unlock() - return nil -} - -func (app *localAppConn) EndBlockSync() (changedValidators []*tmsp.Validator, err error) { - app.mtx.Lock() - if bcApp, ok := app.Application.(tmsp.BlockchainAware); ok { - changedValidators = bcApp.EndBlock() + changedValidators = bcApp.EndBlock(height) } app.mtx.Unlock() return changedValidators, nil diff --git a/state/execution.go b/state/execution.go index 9cc8605bc..199cc8054 100644 --- a/state/execution.go +++ b/state/execution.go @@ -77,13 +77,6 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy } proxyAppConn.SetResponseCallback(proxyCb) - // Begin block - err := proxyAppConn.BeginBlockSync(uint64(block.Height)) - if err != nil { - log.Warn("Error in proxyAppConn.BeginBlock", "error", err) - return err - } - // Run txs of block for _, tx := range block.Txs { proxyAppConn.AppendTxAsync(tx) @@ -93,7 +86,7 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy } // End block - changedValidators, err := proxyAppConn.EndBlockSync() + changedValidators, err := proxyAppConn.EndBlockSync(uint64(block.Height)) if err != nil { log.Warn("Error in proxyAppConn.EndBlock", "error", err) return err