From 29512cb70d746d12e977af7b3645dc16b9b0504a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CGheisMohammadi=E2=80=9D?= <36589218+GheisMohammadi@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:28:07 +0800 Subject: [PATCH] fix leader crosslink issue to not include old cross link in the proposing block --- consensus/view_change_construct.go | 2 +- node/node_newblock.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/consensus/view_change_construct.go b/consensus/view_change_construct.go index 061d2a795..de430694a 100644 --- a/consensus/view_change_construct.go +++ b/consensus/view_change_construct.go @@ -464,7 +464,7 @@ func (vc *viewChange) InitPayload( if !inited { viewIDBytes := make([]byte, 8) binary.LittleEndian.PutUint64(viewIDBytes, viewID) - vc.getLogger().Info().Uint64("viewID", viewID).Uint64("blockNum", blockNum).Msg("[InitPayload] add my M3 (ViewID) type messaage") + vc.getLogger().Info().Uint64("viewID", viewID).Uint64("blockNum", blockNum).Msg("[InitPayload] add my M3 (ViewID) type message") for _, key := range privKeys { if _, ok := vc.viewIDBitmap[viewID]; !ok { viewIDBitmap := bls_cosi.NewMask(members) diff --git a/node/node_newblock.go b/node/node_newblock.go index fdca8b741..7d97e2a88 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -231,6 +231,9 @@ func (node *Node) ProposeNewBlock(commitSigs chan []byte) (*types.Block, error) invalidToDelete := []types.CrossLink{} if err == nil { for _, pending := range allPending { + if pending.EpochF.Int64() < currentHeader.Epoch().Int64()-3 { + continue + } // ReadCrossLink beacon chain usage. exist, err := node.Blockchain().ReadCrossLink(pending.ShardID(), pending.BlockNum()) if err == nil || exist != nil {