relocate broadcast logic (#656)

Co-authored-by: 賴怡誠 <laiyicheng@makotos-MBP.lan>
This commit is contained in:
Liam 2024-09-30 20:20:23 -07:00 committed by GitHub
parent 9751e41dd5
commit ccbedce27b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ import (
const maxBlockDist = 7 // Maximum allowed backward distance from the chain head, 7 is just a magic number indicate very close block
//Define Boradcast Group functions
// Define Boradcast Group functions
type broadcastVoteFn func(*types.Vote)
type broadcastTimeoutFn func(*types.Timeout)
type broadcastSyncInfoFn func(*types.SyncInfo)
@ -126,8 +126,8 @@ func (b *Bfter) Timeout(peer string, timeout *types.Timeout) error {
return err
}
b.broadcastCh <- timeout
if verified {
b.broadcastCh <- timeout
err = b.consensus.timeoutHandler(b.blockChainReader, timeout)
if err != nil {
if _, ok := err.(*utils.ErrIncomingMessageRoundNotEqualCurrentRound); ok {
@ -156,9 +156,9 @@ func (b *Bfter) SyncInfo(peer string, syncInfo *types.SyncInfo) error {
return err
}
b.broadcastCh <- syncInfo
// Process only if verified and qualified
if verified {
b.broadcastCh <- syncInfo
err = b.consensus.syncInfoHandler(b.blockChainReader, syncInfo)
if err != nil {
log.Error("handle BFT SyncInfo", "error", err)

View file

@ -23,7 +23,7 @@ import (
const (
VersionMajor = 2 // Major version component of the current release
VersionMinor = 2 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionPatch = 1 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string
)