Browse Source

s/ExecBlock/ValExecBlock/g; s/sm.ApplyBlock/sm.ExecCommitBlock/g

pull/449/head
Jae Kwon 8 years ago
committed by Ethan Buchman
parent
commit
cd9e9e9f45
2 changed files with 9 additions and 9 deletions
  1. +2
    -2
      consensus/replay.go
  2. +7
    -7
      state/execution.go

+ 2
- 2
consensus/replay.go View File

@ -318,7 +318,7 @@ func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, store
// App is further behind than it should be, so we need to replay blocks.
// We replay all blocks from appBlockHeight+1.
// Note that we don't have an old version of the state,
// so we by-pass state validation/mutation using sm.ApplyBlock.
// so we by-pass state validation/mutation using sm.ExecCommitBlock.
// If mutateState == true, stop short of the last block
// so it can be replayed with a real state.ApplyBlock
@ -331,7 +331,7 @@ func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, store
for i := appBlockHeight + 1; i <= finalBlock; i++ {
log.Info("Applying block", "height", i)
block := h.store.LoadBlock(i)
appHash, err = sm.ApplyBlock(proxyApp.Consensus(), block)
appHash, err = sm.ExecCommitBlock(proxyApp.Consensus(), block)
if err != nil {
return nil, err
}


+ 7
- 7
state/execution.go View File

@ -16,10 +16,10 @@ import (
//--------------------------------------------------
// Execute the block
// ExecBlock executes the block, but does NOT mutate State.
// ValExecBlock executes the block, but does NOT mutate State.
// + validates the block
// + executes block.Txs on the proxyAppConn
func (s *State) ExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) (*ABCIResponses, error) {
func (s *State) ValExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) (*ABCIResponses, error) {
// Validate the block.
if err := s.validateBlock(block); err != nil {
return nil, ErrInvalidBlock(err)
@ -201,15 +201,15 @@ func (s *State) validateBlock(block *types.Block) error {
}
//-----------------------------------------------------------------------------
// ApplyBlock executes the block, updates state w/ ABCI responses,
// ApplyBlock validates & executes the block, updates state w/ ABCI responses,
// then commits and updates the mempool atomically, then saves state.
// Transaction results are optionally indexed.
// Execute and commit block against app, save block and state
// Validate, execute, and commit block against app, save block and state
func (s *State) ApplyBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus,
block *types.Block, partsHeader types.PartSetHeader, mempool types.Mempool) error {
abciResponses, err := s.ExecBlock(eventCache, proxyAppConn, block)
abciResponses, err := s.ValExecBlock(eventCache, proxyAppConn, block)
if err != nil {
return fmt.Errorf("Exec failed for application: %v", err)
}
@ -285,9 +285,9 @@ func (s *State) indexTxs(abciResponses *ABCIResponses) {
s.TxIndexer.Batch(batch)
}
// Apply and commit a block on the proxyApp without validating or mutating the state
// Exec and commit a block on the proxyApp without validating or mutating the state
// Returns the application root hash (result of abci.Commit)
func ApplyBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error) {
func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error) {
var eventCache types.Fireable // nil
_, err := execBlockOnProxyApp(eventCache, appConnConsensus, block)
if err != nil {


Loading…
Cancel
Save