Try to fix multiple head subscriptions (#1565)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2021-03-19 17:36:38 +00:00 committed by GitHub
parent bca9650834
commit a583f7f6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ func (e *Events) OnNewHeader(newHeader *types.Header) {
// remove subscription
if i == len(e.headerSubscriptions)-1 {
e.headerSubscriptions = e.headerSubscriptions[:i]
} else {
} else if i < len(e.headerSubscriptions)-1 {
e.headerSubscriptions = append(e.headerSubscriptions[:i], e.headerSubscriptions[i+1:]...)
}
}