set higher epoch threshold for pending crosslinks to be added to proposing block

fix/crosslink_processing
“GheisMohammadi” 9 months ago
parent 29512cb70d
commit 0296abdbeb
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 6
      node/node_newblock.go

@ -1,6 +1,7 @@
package node package node
import ( import (
"math/big"
"sort" "sort"
"strings" "strings"
"time" "time"
@ -226,12 +227,15 @@ func (node *Node) ProposeNewBlock(commitSigs chan []byte) (*types.Block, error)
utils.AnalysisStart("proposeNewBlockVerifyCrossLinks") utils.AnalysisStart("proposeNewBlockVerifyCrossLinks")
// Prepare cross links and slashing messages // Prepare cross links and slashing messages
var crossLinksToPropose types.CrossLinks var crossLinksToPropose types.CrossLinks
ten := big.NewInt(10)
crossLinkEpochThreshold := new(big.Int).Sub(currentHeader.Epoch(), ten)
if isBeaconchainInCrossLinkEra { if isBeaconchainInCrossLinkEra {
allPending, err := node.Blockchain().ReadPendingCrossLinks() allPending, err := node.Blockchain().ReadPendingCrossLinks()
invalidToDelete := []types.CrossLink{} invalidToDelete := []types.CrossLink{}
if err == nil { if err == nil {
for _, pending := range allPending { 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 continue
} }
// ReadCrossLink beacon chain usage. // ReadCrossLink beacon chain usage.

Loading…
Cancel
Save