mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 23:33:37 +00:00
consensus: flush previous proposal on new block
Reusing proposals from previous blocks doesn't make sense. And reduce some code duplication along the way.
This commit is contained in:
parent
8c0a7225e5
commit
43bfc909eb
1 changed files with 8 additions and 5 deletions
|
@ -320,9 +320,7 @@ func (s *service) handleChainBlock(b *coreb.Block) {
|
|||
s.log.Debug("new block in the chain",
|
||||
zap.Uint32("dbft index", s.dbft.BlockIndex),
|
||||
zap.Uint32("chain index", s.Chain.BlockHeight()))
|
||||
if s.lastTimestamp < b.Timestamp {
|
||||
s.lastTimestamp = b.Timestamp
|
||||
}
|
||||
s.postBlock(b)
|
||||
s.dbft.InitializeConsensus(0)
|
||||
}
|
||||
}
|
||||
|
@ -527,9 +525,14 @@ func (s *service) processBlock(b block.Block) {
|
|||
s.log.Warn("error on add block", zap.Error(err))
|
||||
}
|
||||
}
|
||||
if s.lastTimestamp < bb.Timestamp {
|
||||
s.lastTimestamp = bb.Timestamp
|
||||
s.postBlock(bb)
|
||||
}
|
||||
|
||||
func (s *service) postBlock(b *coreb.Block) {
|
||||
if s.lastTimestamp < b.Timestamp {
|
||||
s.lastTimestamp = b.Timestamp
|
||||
}
|
||||
s.lastProposal = nil
|
||||
}
|
||||
|
||||
func (s *service) getBlockWitness(b *coreb.Block) *transaction.Witness {
|
||||
|
|
Loading…
Reference in a new issue