|
|
@ -69,6 +69,7 @@ func (consensus *Consensus) prepare() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: this will not return immediatey, may block
|
|
|
|
// TODO: this will not return immediatey, may block
|
|
|
|
|
|
|
|
if consensus.current.Mode() != Listening { |
|
|
|
if err := consensus.msgSender.SendWithoutRetry( |
|
|
|
if err := consensus.msgSender.SendWithoutRetry( |
|
|
|
groupID, |
|
|
|
groupID, |
|
|
|
host.ConstructP2pMessage(byte(17), networkMessage.Bytes), |
|
|
|
host.ConstructP2pMessage(byte(17), networkMessage.Bytes), |
|
|
@ -80,6 +81,7 @@ func (consensus *Consensus) prepare() { |
|
|
|
Msg("[OnAnnounce] Sent Prepare Message!!") |
|
|
|
Msg("[OnAnnounce] Sent Prepare Message!!") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
consensus.getLogger().Debug(). |
|
|
|
consensus.getLogger().Debug(). |
|
|
|
Str("From", consensus.phase.String()). |
|
|
|
Str("From", consensus.phase.String()). |
|
|
|
Str("To", FBFTPrepare.String()). |
|
|
|
Str("To", FBFTPrepare.String()). |
|
|
@ -207,6 +209,7 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { |
|
|
|
time.Sleep(consensus.delayCommit) |
|
|
|
time.Sleep(consensus.delayCommit) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if consensus.current.Mode() != Listening { |
|
|
|
if err := consensus.msgSender.SendWithoutRetry( |
|
|
|
if err := consensus.msgSender.SendWithoutRetry( |
|
|
|
groupID, |
|
|
|
groupID, |
|
|
|
host.ConstructP2pMessage(byte(17), networkMessage.Bytes), |
|
|
|
host.ConstructP2pMessage(byte(17), networkMessage.Bytes), |
|
|
@ -219,6 +222,7 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { |
|
|
|
Msg("[OnPrepared] Sent Commit Message!!") |
|
|
|
Msg("[OnPrepared] Sent Commit Message!!") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
consensus.getLogger().Debug(). |
|
|
|
consensus.getLogger().Debug(). |
|
|
|
Str("From", consensus.phase.String()). |
|
|
|
Str("From", consensus.phase.String()). |
|
|
|
Str("To", FBFTCommit.String()). |
|
|
|
Str("To", FBFTCommit.String()). |
|
|
@ -277,7 +281,7 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) { |
|
|
|
consensus.getLogger().Debug().Uint64("MsgBlockNum", recvMsg.BlockNum).Msg("[OnCommitted] out of sync") |
|
|
|
consensus.getLogger().Debug().Uint64("MsgBlockNum", recvMsg.BlockNum).Msg("[OnCommitted] out of sync") |
|
|
|
go func() { |
|
|
|
go func() { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case consensus.blockNumLowChan <- struct{}{}: |
|
|
|
case consensus.BlockNumLowChan <- struct{}{}: |
|
|
|
consensus.current.SetMode(Syncing) |
|
|
|
consensus.current.SetMode(Syncing) |
|
|
|
for _, v := range consensus.consensusTimeout { |
|
|
|
for _, v := range consensus.consensusTimeout { |
|
|
|
v.Stop() |
|
|
|
v.Stop() |
|
|
|