mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
Fixes for bor snapshots (#8270)
This commit is contained in:
parent
92446bfa66
commit
ef1729214d
@ -963,6 +963,9 @@ func (r *BlockReader) borBlockByEventHash(txnHash common.Hash, segments []*BorEv
|
|||||||
if sn.IdxBorTxnHash == nil {
|
if sn.IdxBorTxnHash == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if sn.IdxBorTxnHash.KeyCount() == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
reader := recsplit.NewIndexReader(sn.IdxBorTxnHash)
|
reader := recsplit.NewIndexReader(sn.IdxBorTxnHash)
|
||||||
blockEventId := reader.Lookup(txnHash[:])
|
blockEventId := reader.Lookup(txnHash[:])
|
||||||
offset := sn.IdxBorTxnHash.OrdinalLookup(blockEventId)
|
offset := sn.IdxBorTxnHash.OrdinalLookup(blockEventId)
|
||||||
@ -1041,6 +1044,9 @@ func (r *BlockReader) EventsByBlock(ctx context.Context, tx kv.Tx, hash common.H
|
|||||||
if sn.IdxBorTxnHash == nil {
|
if sn.IdxBorTxnHash == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if sn.IdxBorTxnHash.KeyCount() == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
reader := recsplit.NewIndexReader(sn.IdxBorTxnHash)
|
reader := recsplit.NewIndexReader(sn.IdxBorTxnHash)
|
||||||
blockEventId := reader.Lookup(borTxHash[:])
|
blockEventId := reader.Lookup(borTxHash[:])
|
||||||
offset := sn.IdxBorTxnHash.OrdinalLookup(blockEventId)
|
offset := sn.IdxBorTxnHash.OrdinalLookup(blockEventId)
|
||||||
|
@ -789,8 +789,8 @@ func (s *BorRoSnapshots) Files() (list []string) {
|
|||||||
func (s *BorRoSnapshots) ReopenList(fileNames []string, optimistic bool) error {
|
func (s *BorRoSnapshots) ReopenList(fileNames []string, optimistic bool) error {
|
||||||
s.Events.lock.Lock()
|
s.Events.lock.Lock()
|
||||||
defer s.Events.lock.Unlock()
|
defer s.Events.lock.Unlock()
|
||||||
s.Spans.lock.RLock()
|
s.Spans.lock.Lock()
|
||||||
defer s.Spans.lock.RUnlock()
|
defer s.Spans.lock.Unlock()
|
||||||
|
|
||||||
s.closeWhatNotInList(fileNames)
|
s.closeWhatNotInList(fileNames)
|
||||||
var segmentsMax uint64
|
var segmentsMax uint64
|
||||||
@ -948,6 +948,8 @@ func (s *BorRoSnapshots) ReopenWithDB(db kv.RoDB) error {
|
|||||||
func (s *BorRoSnapshots) Close() {
|
func (s *BorRoSnapshots) Close() {
|
||||||
s.Events.lock.Lock()
|
s.Events.lock.Lock()
|
||||||
defer s.Events.lock.Unlock()
|
defer s.Events.lock.Unlock()
|
||||||
|
s.Spans.lock.Lock()
|
||||||
|
defer s.Spans.lock.Unlock()
|
||||||
s.closeWhatNotInList(nil)
|
s.closeWhatNotInList(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user