diff options
author | Aaron Buchwald <[email protected]> | 2020-09-17 14:37:10 -0400 |
---|---|---|
committer | Aaron Buchwald <[email protected]> | 2020-09-17 14:37:10 -0400 |
commit | b0a75c03303fe22f31fe1e1f0fa29a1e1cd78253 (patch) | |
tree | 22c32abfd7dea90926100d4b85efda961d95ef14 | |
parent | 1a17fcec0e23aba017e3641c708e40e79be8e153 (diff) |
Defer wg Done call instead of calling before returnv0.3.0-rc.4v0.3.0-rc.2
-rw-r--r-- | plugin/evm/vm.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 92e51e6..c02b835 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -730,6 +730,7 @@ func (vm *VM) writeBackMetadata() { // expected block hash // Waits for signal to shutdown from txPoolStabilizedShutdownChan chan func (vm *VM) awaitTxPoolStabilized() { + defer vm.shutdownWg.Done() for { select { case e := <-vm.newTxPoolHeadChan.Chan(): @@ -744,13 +745,13 @@ func (vm *VM) awaitTxPoolStabilized() { default: } case <-vm.txPoolStabilizedShutdownChan: - vm.shutdownWg.Done() return } } } func (vm *VM) awaitSubmittedTxs() { + defer vm.shutdownWg.Done() vm.txSubmitChan = vm.chain.GetTxSubmitCh() for { select { @@ -763,7 +764,6 @@ func (vm *VM) awaitSubmittedTxs() { case <-time.After(5 * time.Second): vm.tryBlockGen() case <-vm.shutdownSubmitChan: - vm.shutdownWg.Done() return } } |