fix possible race condition

This commit is contained in:
i-norden 2022-01-31 13:20:25 -06:00
parent d2711b0104
commit 13686ad80c
2 changed files with 5 additions and 3 deletions

View File

@ -24,7 +24,7 @@ const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 10 // Minor version component of the current release
VersionPatch = 15 // Patch version component of the current release
VersionMeta = "statediff-3.0.0" // Version metadata to append to the version string
VersionMeta = "statediff-3.0.1" // Version metadata to append to the version string
)
// Version holds the textual version string.

View File

@ -150,8 +150,10 @@ func (sdi *StateDiffIndexer) PushBlock(block *types.Block, receipts types.Receip
dbtx: tx,
// handle transaction commit or rollback for any return case
submit: func(self *BatchTx, err error) error {
close(self.quit)
close(self.iplds)
defer func() {
close(self.quit)
close(self.iplds)
}()
if p := recover(); p != nil {
rollback(sdi.ctx, tx)
panic(p)