add buffer channel to unlock deadlock (#766)

* add buffer channel to unlock deadlock

* add buffer channel to unlock deadlock

* close channel

---------

Co-authored-by: liam.lai <liam.lai@us>
This commit is contained in:
benjamin202410 2024-12-19 01:18:13 -08:00 committed by GitHub
parent 78331172f3
commit e1ab3e03d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -277,12 +277,15 @@ func (self *worker) update() {
MinePeriodCh := self.engine.(*XDPoS.XDPoS).MinePeriodCh
defer close(MinePeriodCh)
NewRoundCh := self.engine.(*XDPoS.XDPoS).NewRoundCh
defer close(NewRoundCh)
timeout := time.NewTimer(time.Duration(minePeriod) * time.Second)
c := make(chan struct{})
defer timeout.Stop()
c := make(chan struct{}, 1)
defer close(c)
finish := make(chan struct{})
defer close(finish)
defer timeout.Stop()
go func() {
for {
// A real event arrived, process interesting content

View file

@ -23,7 +23,7 @@ import (
const (
VersionMajor = 2 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release
VersionPatch = 3 // Patch version component of the current release
VersionPatch = 4 // Patch version component of the current release
VersionMeta = "beta1" // Version metadata to append to the version string
)