Skip to content

Commit

Permalink
Merge pull request #602 from wavesplatform/node-275-fix-blockv3-activ…
Browse files Browse the repository at this point in the history
…ation

Correct value for BlockV3 activation
  • Loading branch information
alexeykiselev authored Oct 16, 2017
2 parents eb508c2 + 1ac2840 commit 4d6060e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/it/resources/template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ waves {
reset-effective-balances-at-height = 0
allow-leased-balance-transfer-until = 0
enable-microblocks-after-height = 0
block-version-3-after = 0
block-version-3-after-height = 0
pre-activated-features = {
2 = 0
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ waves {
# allow-unissued-assets-until = 0
# require-payment-unique-id-after = 0
# allow-leased-balance-transfer-until = 0
# block-version-3-after = 0
# block-version-3-after-height = 0
# pre-activated-features {
# 1 = 100
# 2 = 200
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/wavesplatform/Coordinator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ object Coordinator extends ScorexLogging with Instrumented {

(for {
height <- history.heightOf(block.reference).toRight(s"history does not contain parent ${block.reference}")
_ <- Either.cond(height > fs.blockVersion3After
_ <- Either.cond(height > fs.blockVersion3AfterHeight
|| block.version == Block.GenesisBlockVersion
|| block.version == Block.PlainBlockVersion,
(), s"Block Version 3 can only appear at height greater than ${fs.blockVersion3After}")
(), s"Block Version 3 can only appear at height greater than ${fs.blockVersion3AfterHeight}")
_ <- Either.cond(blockTime - currentTs < MaxTimeDrift, (), s"timestamp $blockTime is from future")
_ <- Either.cond(blockTime < fs.requireSortedTransactionsAfter
|| height > fs.dontRequireSortedTransactionsAfter
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/wavesplatform/mining/Miner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MinerImpl(
history.read { implicit l =>
// should take last block right at the time of mining since microblocks might have been added
val height = history.height()
val version = if (height <= blockchainSettings.functionalitySettings.blockVersion3After) PlainBlockVersion else NgBlockVersion
val version = if (height <= blockchainSettings.functionalitySettings.blockVersion3AfterHeight) PlainBlockVersion else NgBlockVersion
val lastBlock = history.lastBlock.get
val greatGrandParentTimestamp = history.parent(lastBlock, 2).map(_.timestamp)
val referencedBlockInfo = history.bestLastBlockInfo(System.currentTimeMillis() - minMicroBlockDurationMills).get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ case class FunctionalitySettings(featureCheckBlocksPeriod: Int,
allowMultipleLeaseCancelTransactionUntilTimestamp: Long,
resetEffectiveBalancesAtHeight: Long,
allowLeasedBalanceTransferUntil: Long,
blockVersion3After: Long,
blockVersion3AfterHeight: Long,
preActivatedFeatures: Map[Short, Int]) {
val dontRequireSortedTransactionsAfter: Long = blockVersion3After
val dontRequireSortedTransactionsAfter: Long = blockVersion3AfterHeight

require(featureCheckBlocksPeriod > 0, "featureCheckBlocksPeriod must be greater than 0")
require((blocksForFeatureActivation > 0) && (blocksForFeatureActivation <= featureCheckBlocksPeriod), s"blocksForFeatureActivation must be in range 1 to $featureCheckBlocksPeriod")
Expand All @@ -48,7 +48,7 @@ object FunctionalitySettings {
allowMultipleLeaseCancelTransactionUntilTimestamp = 1492768800000L,
resetEffectiveBalancesAtHeight = 462000,
allowLeasedBalanceTransferUntil = Long.MaxValue,
blockVersion3After = Long.MaxValue,
blockVersion3AfterHeight = Long.MaxValue,
preActivatedFeatures = Map.empty)

val TESTNET = apply(
Expand All @@ -66,7 +66,7 @@ object FunctionalitySettings {
allowMultipleLeaseCancelTransactionUntilTimestamp = 1492560000000L,
resetEffectiveBalancesAtHeight = 51500,
allowLeasedBalanceTransferUntil = 1495238400000L,
blockVersion3After = 1508144400000L,
blockVersion3AfterHeight = 161700,
preActivatedFeatures = Map.empty)

val configPath = "waves.blockchain.custom.functionality"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BlockchainSettingsSpecification extends FlatSpec with Matchers {
| allow-multiple-lease-cancel-transaction-until-timestamp = 14
| reset-effective-balances-at-height = 15
| allow-leased-balance-transfer-until = 17
| block-version-3-after = 18
| block-version-3-after-height = 18
| pre-activated-features {
| 19 = 100
| 20 = 200
Expand Down Expand Up @@ -75,7 +75,7 @@ class BlockchainSettingsSpecification extends FlatSpec with Matchers {
settings.functionalitySettings.allowMultipleLeaseCancelTransactionUntilTimestamp should be(14)
settings.functionalitySettings.resetEffectiveBalancesAtHeight should be(15)
settings.functionalitySettings.allowLeasedBalanceTransferUntil should be(17)
settings.functionalitySettings.blockVersion3After should be(18)
settings.functionalitySettings.blockVersion3AfterHeight should be(18)
settings.functionalitySettings.preActivatedFeatures should be(Map(19 -> 100, 20 -> 200))
settings.genesisSettings.blockTimestamp should be(1460678400000L)
settings.genesisSettings.timestamp should be(1460678400000L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object TestFunctionalitySettings {
allowInvalidReissueInSameBlockUntilTimestamp = 0L,
allowMultipleLeaseCancelTransactionUntilTimestamp = 0L, resetEffectiveBalancesAtHeight = 0,
allowLeasedBalanceTransferUntil = 0L,
blockVersion3After = 0L,
blockVersion3AfterHeight = 0L,
preActivatedFeatures = Map.empty
)

Expand Down
2 changes: 1 addition & 1 deletion waves-devnet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ waves {
allow-multiple-lease-cancel-transaction-until-timestamp: 1492128000000
reset-effective-balances-at-height: 4650
allow-leased-balance-transfer-until: 0
block-version-3-after: 0
block-version-3-after-height: 0
pre-activated-features {}
}
genesis {
Expand Down

0 comments on commit 4d6060e

Please sign in to comment.