aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Laine <daniel.laine@avalabs.org>2020-12-17 16:53:56 -0500
committerDan Laine <daniel.laine@avalabs.org>2020-12-17 16:53:56 -0500
commitf20fd5437ec5144a926589395cece29f2052994d (patch)
treef3d33fa99fc7d46dd2836bef500d8a1cf445e094
parent7a3492c26c2605840d57fb5efdd5761f44deaaff (diff)
rename mayBuildBlockStatus values
-rw-r--r--plugin/evm/vm.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 231db2a..9335b51 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -105,9 +105,9 @@ var (
type mayBuildBlockStatus uint8
const (
- wait mayBuildBlockStatus = iota
- conditionalWait
- build
+ waitToBuild mayBuildBlockStatus = iota
+ conditionalWaitToBuild
+ mayBuild
)
func maxDuration(x, y time.Duration) time.Duration {
@@ -361,13 +361,13 @@ func (vm *VM) Initialize(
vm.buildBlockTimer = timer.NewTimer(func() {
vm.buildBlockLock.Lock()
switch vm.mayBuildBlock {
- case wait:
+ case waitToBuild:
// Some time has passed. Allow block to be built if it has enough txs in it.
- vm.mayBuildBlock = conditionalWait
+ vm.mayBuildBlock = conditionalWaitToBuild
vm.buildBlockTimer.SetTimeoutIn(maxDuration(maxBlockTime-minBlockTime, 0))
- case conditionalWait:
+ case conditionalWaitToBuild:
// More time has passed. Allow block to be built regardless of tx count.
- vm.mayBuildBlock = build
+ vm.mayBuildBlock = mayBuild
}
tryBuildBlock := vm.tryToBuildBlock
vm.buildBlockLock.Unlock()
@@ -377,7 +377,7 @@ func (vm *VM) Initialize(
})
go ctx.Log.RecoverAndPanic(vm.buildBlockTimer.Dispatch)
- vm.mayBuildBlock = build
+ vm.mayBuildBlock = mayBuild
vm.tryToBuildBlock = true
vm.txPoolStabilizedOk = make(chan struct{}, 1)
// TODO: read size from options
@@ -455,7 +455,7 @@ func (vm *VM) BuildBlock() (snowman.Block, error) {
vm.buildBlockLock.Lock()
// Specify that we should wait before trying to build another block.
- vm.mayBuildBlock = wait
+ vm.mayBuildBlock = waitToBuild
vm.tryToBuildBlock = false
vm.awaitingBuildBlock = false
vm.buildBlockTimer.SetTimeoutIn(minBlockTime)
@@ -627,13 +627,13 @@ func (vm *VM) tryBlockGen() error {
}
switch vm.mayBuildBlock {
- case wait: // Wait more time before notifying engine to building a block
+ case waitToBuild: // Wait more time before notifying engine to building a block
return nil
- case conditionalWait: // Notify engine only if there are enough pending txs
+ case conditionalWaitToBuild: // Notify engine only if there are enough pending txs
if size < batchSize {
return nil
}
- case build: // Notify engine
+ case mayBuild: // Notify engine
default:
panic(fmt.Sprintf("mayBuildBlock has unexpected value %d", vm.mayBuildBlock))
}