diff --git a/app/cmd/rpc/mesh/fullnode.go b/app/cmd/rpc/mesh/fullnode.go index 64b100876..ad968bb3f 100644 --- a/app/cmd/rpc/mesh/fullnode.go +++ b/app/cmd/rpc/mesh/fullnode.go @@ -13,6 +13,7 @@ import ( "github.com/robfig/cron/v3" "io" log2 "log" + "math" "net/http" "net/url" "strings" @@ -49,11 +50,18 @@ func (node *fullNode) ShouldAssumeOptimisticSession(dispatcherSessionBlockHeight } func (node *fullNode) CanHandleRelayWithinTolerance(dispatcherSessionBlockHeight int64) bool { + // Reduce the amount in one to reduce the number of relays rejected by the node due to evidence sealed (code=90) + // if the servicer allows 1, mesh will allow 0, so mesh has 1 block to keep notifying servicer about relays on + // servicer queue. + // The best here is set the Servicer in 2 or 3 so mesh will receive slow session rotation from gateways up to 1 or 2 + // blocks + clientSessionSyncAllowance := math.Max(float64(0), float64(node.ClientSessionSyncAllowance-1)) + return pocketTypes.IsProofSessionHeightWithinTolerance( node.GetLatestSessionBlockHeight(), node.BlocksPerSession, dispatcherSessionBlockHeight, - node.ClientSessionSyncAllowance, + int64(clientSessionSyncAllowance), ) }