Browse Source

Remove BeginBlock

pull/206/merge
Jae Kwon 9 years ago
parent
commit
18d0da4ea3
3 changed files with 4 additions and 21 deletions
  1. +1
    -2
      proxy/app_conn.go
  2. +2
    -11
      proxy/local_app_conn.go
  3. +1
    -8
      state/execution.go

+ 1
- 2
proxy/app_conn.go View File

@ -20,6 +20,5 @@ type AppConn interface {
FlushSync() error FlushSync() error
CommitSync() (hash []byte, log string, err error) CommitSync() (hash []byte, log string, err error)
InitChainSync(validators []*tmsp.Validator) (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)
} }

+ 2
- 11
proxy/local_app_conn.go View File

@ -109,19 +109,10 @@ func (app *localAppConn) InitChainSync(validators []*tmsp.Validator) (err error)
return nil return nil
} }
func (app *localAppConn) BeginBlockSync(height uint64) (err error) {
func (app *localAppConn) EndBlockSync(height uint64) (changedValidators []*tmsp.Validator, err error) {
app.mtx.Lock() app.mtx.Lock()
if bcApp, ok := app.Application.(tmsp.BlockchainAware); ok { 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() app.mtx.Unlock()
return changedValidators, nil return changedValidators, nil


+ 1
- 8
state/execution.go View File

@ -77,13 +77,6 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy
} }
proxyAppConn.SetResponseCallback(proxyCb) 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 // Run txs of block
for _, tx := range block.Txs { for _, tx := range block.Txs {
proxyAppConn.AppendTxAsync(tx) proxyAppConn.AppendTxAsync(tx)
@ -93,7 +86,7 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy
} }
// End block // End block
changedValidators, err := proxyAppConn.EndBlockSync()
changedValidators, err := proxyAppConn.EndBlockSync(uint64(block.Height))
if err != nil { if err != nil {
log.Warn("Error in proxyAppConn.EndBlock", "error", err) log.Warn("Error in proxyAppConn.EndBlock", "error", err)
return err return err


Loading…
Cancel
Save