mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-25 02:31:46 +00:00
s/ExecBlock/ValExecBlock/g; s/sm.ApplyBlock/sm.ExecCommitBlock/g
This commit is contained in:
@ -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.
|
// App is further behind than it should be, so we need to replay blocks.
|
||||||
// We replay all blocks from appBlockHeight+1.
|
// We replay all blocks from appBlockHeight+1.
|
||||||
// Note that we don't have an old version of the state,
|
// 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
|
// If mutateState == true, stop short of the last block
|
||||||
// so it can be replayed with a real state.ApplyBlock
|
// 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++ {
|
for i := appBlockHeight + 1; i <= finalBlock; i++ {
|
||||||
log.Info("Applying block", "height", i)
|
log.Info("Applying block", "height", i)
|
||||||
block := h.store.LoadBlock(i)
|
block := h.store.LoadBlock(i)
|
||||||
appHash, err = sm.ApplyBlock(proxyApp.Consensus(), block)
|
appHash, err = sm.ExecCommitBlock(proxyApp.Consensus(), block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ import (
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Execute the block
|
// Execute the block
|
||||||
|
|
||||||
// ExecBlock executes the block, but does NOT mutate State.
|
// ValExecBlock executes the block, but does NOT mutate State.
|
||||||
// + validates the block
|
// + validates the block
|
||||||
// + executes block.Txs on the proxyAppConn
|
// + 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.
|
// Validate the block.
|
||||||
if err := s.validateBlock(block); err != nil {
|
if err := s.validateBlock(block); err != nil {
|
||||||
return nil, ErrInvalidBlock(err)
|
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.
|
// then commits and updates the mempool atomically, then saves state.
|
||||||
// Transaction results are optionally indexed.
|
// 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,
|
func (s *State) ApplyBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus,
|
||||||
block *types.Block, partsHeader types.PartSetHeader, mempool types.Mempool) error {
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("Exec failed for application: %v", err)
|
return fmt.Errorf("Exec failed for application: %v", err)
|
||||||
}
|
}
|
||||||
@ -285,9 +285,9 @@ func (s *State) indexTxs(abciResponses *ABCIResponses) {
|
|||||||
s.TxIndexer.Batch(batch)
|
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)
|
// 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
|
var eventCache types.Fireable // nil
|
||||||
_, err := execBlockOnProxyApp(eventCache, appConnConsensus, block)
|
_, err := execBlockOnProxyApp(eventCache, appConnConsensus, block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user