From 85eb1b7a85a8eb327d1261978408c15149817f9e Mon Sep 17 00:00:00 2001 From: GheisMohammadi Date: Thu, 12 Sep 2024 16:26:10 +0800 Subject: [PATCH 1/2] not checking pending crosslinks for first ten epochs --- node/harmony/node.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/harmony/node.go b/node/harmony/node.go index 19778506a6..0e38ba5891 100644 --- a/node/harmony/node.go +++ b/node/harmony/node.go @@ -1107,8 +1107,8 @@ func New( node.serviceManager = service.NewManager() // delete old pending crosslinks - if node.Blockchain().ShardID() == shard.BeaconChainShardID { - ten := big.NewInt(10) + ten := big.NewInt(10) + if node.Blockchain().ShardID() == shard.BeaconChainShardID && node.Blockchain().CurrentBlock().Epoch().Cmp(ten) > 0 { crossLinkEpochThreshold := new(big.Int).Sub(node.Blockchain().CurrentHeader().Epoch(), ten) invalidToDelete := make([]types.CrossLink, 0, 1000) From 4d83810093e4a1abc92c2f7de26081617d3d8ffd Mon Sep 17 00:00:00 2001 From: GheisMohammadi Date: Mon, 23 Sep 2024 22:06:02 +0800 Subject: [PATCH 2/2] check crosslink epoch to delete old pending crosslinks --- node/harmony/node.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/node/harmony/node.go b/node/harmony/node.go index 0e38ba5891..1a12854fea 100644 --- a/node/harmony/node.go +++ b/node/harmony/node.go @@ -1108,8 +1108,9 @@ func New( // delete old pending crosslinks ten := big.NewInt(10) - if node.Blockchain().ShardID() == shard.BeaconChainShardID && node.Blockchain().CurrentBlock().Epoch().Cmp(ten) > 0 { - crossLinkEpochThreshold := new(big.Int).Sub(node.Blockchain().CurrentHeader().Epoch(), ten) + epoch := node.Blockchain().CurrentHeader().Epoch() + if node.Blockchain().ShardID() == shard.BeaconChainShardID && node.Blockchain().Config().IsCrossLink(epoch) { + crossLinkEpochThreshold := new(big.Int).Sub(epoch, ten) invalidToDelete := make([]types.CrossLink, 0, 1000) allPending, err := node.Blockchain().ReadPendingCrossLinks()