OSDN Git Service

set proposal have timeout (#444)
[bytom/vapor.git] / protocol / validation / tx.go
index 392c46e..af58cba 100644 (file)
@@ -3,6 +3,7 @@ package validation
 import (
        "fmt"
        "math"
+       "runtime"
        "sync"
 
        "github.com/vapor/common"
@@ -14,10 +15,6 @@ import (
        "github.com/vapor/protocol/vm"
 )
 
-const (
-       validateWorkerNum = 32
-)
-
 // validate transaction error
 var (
        ErrTxVersion                 = errors.New("invalid transaction version")
@@ -665,6 +662,7 @@ func validateTxWorker(workCh chan *validateTxWork, resultCh chan *ValidateTxResu
 // ValidateTxs validates txs in async mode
 func ValidateTxs(txs []*bc.Tx, block *bc.Block) []*ValidateTxResult {
        txSize := len(txs)
+       validateWorkerNum := runtime.NumCPU()
        //init the goroutine validate worker
        var wg sync.WaitGroup
        workCh := make(chan *validateTxWork, txSize)