From 0296abdbeba6ab4d1e2395e944281e088055dc4c 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 13:04:18 +0800 Subject: [PATCH] set higher epoch threshold for pending crosslinks to be added to proposing block --- node/node_newblock.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/node_newblock.go b/node/node_newblock.go index 7d97e2a88..48c7bbcaa 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -1,6 +1,7 @@ package node import ( + "math/big" "sort" "strings" "time" @@ -226,12 +227,15 @@ func (node *Node) ProposeNewBlock(commitSigs chan []byte) (*types.Block, error) utils.AnalysisStart("proposeNewBlockVerifyCrossLinks") // Prepare cross links and slashing messages var crossLinksToPropose types.CrossLinks + ten := big.NewInt(10) + crossLinkEpochThreshold := new(big.Int).Sub(currentHeader.Epoch(), ten) if isBeaconchainInCrossLinkEra { allPending, err := node.Blockchain().ReadPendingCrossLinks() invalidToDelete := []types.CrossLink{} if err == nil { for _, pending := range allPending { - if pending.EpochF.Int64() < currentHeader.Epoch().Int64()-3 { + // if pending crosslink is older than 10 epochs, ignore it + if pending.EpochF.Cmp(crossLinkEpochThreshold) <= 0 { continue } // ReadCrossLink beacon chain usage.