mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
update some comments
This commit is contained in:
parent
3d33226e80
commit
97c5533c35
@ -69,16 +69,18 @@ func (evpool *EvidencePool) State() sm.State {
|
|||||||
|
|
||||||
// Update loads the latest
|
// Update loads the latest
|
||||||
func (evpool *EvidencePool) Update(block *types.Block, state sm.State) {
|
func (evpool *EvidencePool) Update(block *types.Block, state sm.State) {
|
||||||
evpool.mtx.Lock()
|
|
||||||
defer evpool.mtx.Unlock()
|
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if state.LastBlockHeight != block.Height {
|
if state.LastBlockHeight != block.Height {
|
||||||
panic(fmt.Sprintf("Failed EvidencePool.Update sanity check: got state.Height=%d with block.Height=%d", state.LastBlockHeight, block.Height))
|
panic(fmt.Sprintf("Failed EvidencePool.Update sanity check: got state.Height=%d with block.Height=%d", state.LastBlockHeight, block.Height))
|
||||||
}
|
}
|
||||||
evpool.state = state
|
|
||||||
|
|
||||||
// NOTE: shouldn't need the mutex
|
// update the state
|
||||||
|
evpool.mtx.Lock()
|
||||||
|
evpool.state = state
|
||||||
|
evpool.mtx.Unlock()
|
||||||
|
|
||||||
|
// remove evidence from pending and mark committed
|
||||||
evpool.MarkEvidenceAsCommitted(block.Evidence.Evidence)
|
evpool.MarkEvidenceAsCommitted(block.Evidence.Evidence)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,6 @@ Impl:
|
|||||||
- First commit atomically in outqueue, pending, lookup.
|
- First commit atomically in outqueue, pending, lookup.
|
||||||
- Once broadcast, remove from outqueue. No need to sync
|
- Once broadcast, remove from outqueue. No need to sync
|
||||||
- Once committed, atomically remove from pending and update lookup.
|
- Once committed, atomically remove from pending and update lookup.
|
||||||
- TODO: If we crash after committed but before removing/updating,
|
|
||||||
we'll be stuck broadcasting evidence we never know we committed.
|
|
||||||
so either share the state db and atomically MarkCommitted
|
|
||||||
with ApplyBlock, or check all outqueue/pending on Start to see if its committed
|
|
||||||
|
|
||||||
Schema for indexing evidence (note you need both height and hash to find a piece of evidence):
|
Schema for indexing evidence (note you need both height and hash to find a piece of evidence):
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ func (blockExec *BlockExecutor) ApplyBlock(state State, blockID types.BlockID, b
|
|||||||
return state, fmt.Errorf("Commit failed for application: %v", err)
|
return state, fmt.Errorf("Commit failed for application: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock mempool, commit state, update mempoool
|
// lock mempool, commit app state, update mempoool
|
||||||
appHash, err := blockExec.Commit(block)
|
appHash, err := blockExec.Commit(block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return state, fmt.Errorf("Commit failed for application: %v", err)
|
return state, fmt.Errorf("Commit failed for application: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user