Robert
10/09/2019, 8:30 PMvar
or val
in an interface, do I always have to use override
to "implement" it? I tried using abstract
in the interface
, but that's no helpSam Schilling
10/09/2019, 8:36 PMoverride
keyword? You need that to indicate you are defining/initializing a value that comes from the interfaceRobert
10/09/2019, 8:37 PMRobert
10/09/2019, 8:38 PMRobert
10/09/2019, 8:38 PMabstract class testA {
abstract val test: Int
}
class testB: testA() {
override val test: Int = 1
}
Robert
10/09/2019, 8:38 PMSam Schilling
10/09/2019, 8:40 PMoverride
.Robert
10/09/2019, 8:42 PMSam Schilling
10/09/2019, 8:42 PMoverride
?Sam Schilling
10/09/2019, 8:42 PMRobert
10/09/2019, 8:59 PMoverride var
. Just would look cleaner without it, that's basically it.Sam Schilling
10/09/2019, 9:01 PMvar
, the override
just helps distinguish from other variables that aren’t from the interface. I don’t think it makes it look less clean, it makes it more explicit. I think the unclean aspect is moreso the fact that you have 20 vars to begin with, but that may be unavoidable depending on your use case.Robert
10/09/2019, 9:03 PMoverride val consensus by lazy {
object: Params {
override var nSubsidyHalvingInterval = 210000
override var BIP16Exception = SHA256("0x00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22");
override var BIP34Height = 227931u
override var BIP34Hash = SHA256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
override var BIP65Height = 388381u
override var BIP66Height = 363725u
override var CSVHeight = 419328u
override var SegwitHeight = 481824u
override var nMinerConfirmationWindow = 2016u // nPowTargetTimespan / nPowTargetSpacing
override var MinBIP9WarningHeight = this.SegwitHeight + this.nMinerConfirmationWindow;
override var powLimit = SHA256("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
override var nPowTargetTimespan = 14u * 24u * 60u * 60u
override var nPowTargetSpacing = 10u * 60u
override var fPowAllowMinDifficultyBlocks = false
override var fPowNoRetargeting = false
override var nRuleChangeActivationThreshold = 1916 // 95% of 2016
override val vDeployments = mapOf(
DeploymentPos.DEPLOYMENT_TESTDUMMY to BIP9Deployment(
28u,
1199145601u, // January 1, 2008
1230767999u // December 31, 2008
)
)
override var nMinimumChainWork = SHA256("0x000000000000000000000000000000000000000008ea3cf107ae0dec57f03fe8")
override var defaultAssumeValid = SHA256("0x00000000000000000005f8920febd3925f8272a6a71237563d78c2edfdd09ddf") // 597379
}
}
Robert
10/09/2019, 9:04 PMRobert
10/09/2019, 9:04 PMSam Schilling
10/09/2019, 9:05 PMSam Schilling
10/09/2019, 9:05 PMSam Schilling
10/09/2019, 9:05 PMRobert
10/09/2019, 9:05 PMSam Schilling
10/09/2019, 9:08 PMRobert
10/09/2019, 9:09 PMRobert
10/09/2019, 9:10 PM