Skip to content

Commit

Permalink
New Testnet and tail remove.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoslkz committed Jun 16, 2018
1 parent eb14465 commit 2504a9b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -5,7 +5,7 @@ import sbtcrossproject.CrossPlugin.autoImport.crossProject

enablePlugins(GitVersioning)
git.useGitDescribe := true
git.baseVersion := "0.0.5"
git.baseVersion := "0.0.6"
name := "LunesNode"
mainClass in Compile := Some("io.lunes.LunesNode")

Expand Down
8 changes: 7 additions & 1 deletion src/main/scala/io/lunes/LunesNode.scala
Expand Up @@ -5,6 +5,7 @@ package io.lunes
*
*/
import java.io.File
import java.security.Security
import java.util.concurrent._

import akka.actor.ActorSystem
Expand Down Expand Up @@ -340,7 +341,12 @@ object LunesNode extends ScorexLogging {
* @param args - Command Line arguments
*/
def main(args: Array[String]): Unit = {
fixNTP()
//fixNTP()

System.setProperty("sun.net.inetaddr.ttl", "0")
System.setProperty("sun.net.inetaddr.negative.ttl", "0")
Security.setProperty("networkaddress.cache.ttl", "0")
Security.setProperty("networkaddress.cache.negative.ttl", "0")

SLF4JBridgeHandler.removeHandlersForRootLogger()
SLF4JBridgeHandler.install()
Expand Down
17 changes: 9 additions & 8 deletions src/main/scala/io/lunes/settings/BlockchainSettings.scala
Expand Up @@ -66,19 +66,20 @@ object FunctionalitySettings {
preActivatedFeatures = Map.empty,
doubleFeaturesPeriodsAfterHeight = 810000)


val TESTNET = apply(
featureCheckBlocksPeriod = 3000,
blocksForFeatureActivation = 2700,
allowTemporaryNegativeUntil = 1477958400000L,
requireSortedTransactionsAfter = 1477958400000L,
allowTemporaryNegativeUntil = Constants.TestTimestamp,
requireSortedTransactionsAfter = Constants.TestTimestamp,
generationBalanceDepthFrom50To1000AfterHeight = 0,
minimalGeneratingBalanceAfter = 0,
allowTransactionsFromFutureUntil = 1478100000000L,
allowUnissuedAssetsUntil = 1479416400000L,
allowInvalidReissueInSameBlockUntilTimestamp = 1492560000000L,
allowMultipleLeaseCancelTransactionUntilTimestamp = 1492560000000L,
resetEffectiveBalancesAtHeight = 51500,
blockVersion3AfterHeight = 161700,
allowTransactionsFromFutureUntil = 0,
allowUnissuedAssetsUntil = 0,
allowInvalidReissueInSameBlockUntilTimestamp = 0,
allowMultipleLeaseCancelTransactionUntilTimestamp = 0,
resetEffectiveBalancesAtHeight = 1,
blockVersion3AfterHeight = 0,
preActivatedFeatures = Map.empty,
doubleFeaturesPeriodsAfterHeight = Int.MaxValue)

Expand Down
16 changes: 6 additions & 10 deletions src/main/scala/io/lunes/settings/Constants.scala
Expand Up @@ -5,13 +5,10 @@ import scorex.utils.ScorexLogging
/**
* System constants here.
*/
/**
*
*/
object Constants extends ScorexLogging {
val VersionStr = "0.0.5"
val VersionTuple = (0, 0, 5)
val MinimalVersion = (0, 0, 5)
val VersionStr = "0.0.6"
val VersionTuple = (0, 0, 6)
val MinimalVersion = (0, 0, 6)
val ApplicationName = "lunesnode"
val CoinName = "LUNES"
val CoinAbr = "LNS"
Expand All @@ -30,11 +27,10 @@ object Constants extends ScorexLogging {

val TestSchemeCharacter = '0'
val TestDelay = 60
val TestTimestamp = 1523145600000L
val TestSignature = ""
val TestTimestamp = 1528300800000L
val TestSignature = "3MHtECVRc3qTe9tmvds7aQBLzX879YTdq6iYDnXwKGXrzrYZdESoYokQMGcWWSVKKZDjfocMBFPk7vBc1t8iAkBc"

val TestTransactions = List(
GenesisTransactionSettings("3825YjBosdU7g2AWZjZNF5hN7VsRZg35RcA", 30000000000000000L),
GenesisTransactionSettings("37qcYthwDtBv1g9AbiWsG6o2nLE8nXxF2vr", 30000000000000000L)
GenesisTransactionSettings("37aF3eL4tsZ6YpqViXpYAmRQAi7ehtDdBmG", 15072853761500800L)
)
}
6 changes: 3 additions & 3 deletions src/main/scala/io/lunes/state2/package.scala
Expand Up @@ -7,7 +7,7 @@ import monix.eval.Coeval
import io.lunes.transaction.ValidationError.GenericError
import io.lunes.transaction.{Transaction, ValidationError}

import scala.annotation.tailrec
// import scala.annotation.tailrec
import scala.reflect.ClassTag
import scala.util.{Left, Right, Try}

Expand Down Expand Up @@ -44,14 +44,14 @@ package object state2 {
* @tparam A
* @return
*/
@tailrec // adicionado
//@tailrec // adicionado
def dropLeftIf[A](list: List[A])(cond: List[A] => Boolean): List[A] = list match {
case l@(x :: xs) => if (cond(l)) dropLeftIf(xs)(cond) else l
case Nil => Nil
}

def splitAfterThreshold[A](list: NEL[A], threshold: Int)(count: A => Int): (NEL[A], List[A]) = {
@tailrec
//@tailrec
def splitR(agg: NEL[A], aggCount: Int, rest: List[A]): (NEL[A], List[A]) =
if (aggCount >= threshold) (agg, rest)
else rest match {
Expand Down
Expand Up @@ -9,7 +9,7 @@ import io.lunes.transaction.assets.IssueTransaction
import io.lunes.transaction.lease.LeaseTransaction
import scorex.utils.{ScorexLogging, Synchronized}

import scala.annotation.tailrec
// import scala.annotation.tailrec
import scala.reflect.ClassTag
import scala.util.{Right, Try}

Expand Down Expand Up @@ -259,7 +259,7 @@ object SnapshotStateReader {
private def minBySnapshot(acc: Address, atHeight: Int, confirmations: Int)(extractor: Snapshot => Long): Long = s.read { _ =>
val bottomNotIncluded = atHeight - confirmations

@tailrec
// @tailrec
def loop(deeperHeight: Int, list: Seq[Snapshot]): Seq[Snapshot] = {
if (deeperHeight == 0) {
s.snapshotAtHeight(acc, 1) match {
Expand Down Expand Up @@ -322,7 +322,7 @@ object SnapshotStateReader {
* @return Returns the Balance.
*/
def balanceAtHeight(acc: Address, height: Int): Long = s.read { _ =>
@tailrec
// @tailrec
def loop(lookupHeight: Int): Long = s.snapshotAtHeight(acc, lookupHeight) match {
case None if lookupHeight == 0 => 0
case Some(snapshot) if lookupHeight <= height => snapshot.balance
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/scorex/utils/utils.scala
Expand Up @@ -2,14 +2,14 @@ package scorex

import java.security.SecureRandom

import scala.annotation.tailrec
// import scala.annotation.tailrec
import scala.concurrent.duration._
import scala.reflect.runtime.universe
import scala.util._

package object utils {

@tailrec
//@tailrec
final def untilTimeout[T](timeout: FiniteDuration,
delay: FiniteDuration = 100.milliseconds,
onFailure: => Unit = {})(fn: => T): T = {
Expand Down

0 comments on commit 2504a9b

Please sign in to comment.