mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
[erigon2] Fix history bug, optimise history search (#326)
* Another fix for DeleteAccount * Optimise bitmap search * Optimise bitmap search Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
79aa17d297
commit
1363859958
@ -2436,6 +2436,9 @@ func (w *Writer) DeleteAccount(addr []byte, trace bool) {
|
||||
key, _ := g.Next(nil)
|
||||
if bytes.HasPrefix(key, addr) {
|
||||
val, _ := g.Next(nil)
|
||||
if len(val) > 0 {
|
||||
val = val[1:]
|
||||
}
|
||||
heap.Push(&cp, &CursorItem{t: FILE_CURSOR, key: key, val: val, dg: g, endBlock: item.endBlock})
|
||||
}
|
||||
}
|
||||
|
@ -224,11 +224,17 @@ func (hr *HistoryReader) searchInHistory(bitmapType, historyType FileType, key [
|
||||
if _, err = bm.ReadFrom(bytes.NewReader(bitmapVal)); err != nil {
|
||||
return false
|
||||
}
|
||||
bm.RemoveRange(0, searchTx)
|
||||
if bm.IsEmpty() {
|
||||
if searchTx == 0 {
|
||||
foundTxNum = bm.Minimum()
|
||||
foundEndBlock = item.endBlock
|
||||
found = true
|
||||
return false
|
||||
}
|
||||
searchRank := bm.Rank(searchTx - 1)
|
||||
if searchRank >= bm.GetCardinality() {
|
||||
continue
|
||||
}
|
||||
foundTxNum = bm.Minimum()
|
||||
foundTxNum, _ = bm.Select(searchRank)
|
||||
foundEndBlock = item.endBlock
|
||||
found = true
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user