|
@ -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 { |
|
|