@@ -169,10 +169,6 @@ func MockSetMSPIDGetter(mspIDGetter func(string) []string) {
169
169
mockMSPIDGetter = mspIDGetter
170
170
}
171
171
172
- // validationWorkersSemaphore is the semaphore used to ensure that
173
- // there are not too many concurrent tx validation goroutines
174
- var validationWorkersSemaphore semaphore.Semaphore
175
-
176
172
func getCurrConfigBlockFromLedger (ledger ledger.PeerLedger ) (* common.Block , error ) {
177
173
peerLogger .Debugf ("Getting config block" )
178
174
@@ -424,6 +420,10 @@ type Peer struct {
424
420
StoreProvider transientstore.StoreProvider
425
421
storesMutex sync.RWMutex
426
422
stores map [string ]transientstore.Store
423
+
424
+ // validationWorkersSemaphore is used to limit the number of concurrent validation
425
+ // go routines.
426
+ validationWorkersSemaphore semaphore.Semaphore
427
427
}
428
428
429
429
// Default provides in implementation of the Peer interface that provides
@@ -584,7 +584,7 @@ func (p *Peer) createChain(
584
584
585
585
validator := txvalidator .NewTxValidator (
586
586
cid ,
587
- validationWorkersSemaphore ,
587
+ p . validationWorkersSemaphore ,
588
588
cs ,
589
589
& vir.ValidationInfoRetrieveShim {
590
590
New : newLifecycleValidation ,
@@ -816,7 +816,7 @@ func (p *Peer) Initialize(
816
816
nWorkers int ,
817
817
txProcessors customtx.Processors ,
818
818
) {
819
- validationWorkersSemaphore = semaphore .New (nWorkers )
819
+ p . validationWorkersSemaphore = semaphore .New (nWorkers )
820
820
821
821
pluginMapper = pm
822
822
chainInitializer = init
0 commit comments