|
|
|
@ -535,14 +535,14 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Construct committed message
|
|
|
|
|
consensus.mutex.Lock() |
|
|
|
|
network, err := consensus.construct(msg_pb.MessageType_COMMITTED, nil, []*bls.PrivateKeyWrapper{leaderPriKey}) |
|
|
|
|
consensus.mutex.Unlock() |
|
|
|
|
if err != nil { |
|
|
|
|
consensus.getLogger().Warn().Err(err). |
|
|
|
|
Msg("[preCommitAndPropose] Unable to construct Committed message") |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
go func() { |
|
|
|
|
msgToSend, FBFTMsg := |
|
|
|
|
network.Bytes, |
|
|
|
|
network.FBFTMsg |
|
|
|
@ -553,7 +553,6 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { |
|
|
|
|
|
|
|
|
|
if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, true); err != nil { |
|
|
|
|
consensus.getLogger().Error().Err(err).Msg("[preCommitAndPropose] Failed to add block to chain") |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if leader successfully finalizes the block, send committed message to validators
|
|
|
|
@ -576,6 +575,8 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { |
|
|
|
|
consensus.getLogger().Info().Msg("[preCommitAndPropose] sending block proposal signal") |
|
|
|
|
|
|
|
|
|
consensus.ReadySignal <- AsyncProposal |
|
|
|
|
}() |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|