Skip to content

Commit ff6b9b1

Browse files
committed
fix invalid executors config
1 parent e5013b5 commit ff6b9b1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stm.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package block_stm
33
import (
44
"context"
55
"errors"
6+
"fmt"
7+
"runtime"
68
"sync"
79

810
storetypes "cosmossdk.io/store/types"
@@ -16,6 +18,13 @@ func ExecuteBlock(
1618
executors int,
1719
txExecutor TxExecutor,
1820
) error {
21+
if executors < 0 {
22+
return fmt.Errorf("invalid number of executors: %d", executors)
23+
}
24+
if executors == 0 {
25+
executors = runtime.NumCPU()
26+
}
27+
1928
// Create a new scheduler
2029
scheduler := NewScheduler(blockSize)
2130
mvMemory := NewMVMemory(blockSize, stores)

0 commit comments

Comments
 (0)