mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +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)
|
key, _ := g.Next(nil)
|
||||||
if bytes.HasPrefix(key, addr) {
|
if bytes.HasPrefix(key, addr) {
|
||||||
val, _ := g.Next(nil)
|
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})
|
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 {
|
if _, err = bm.ReadFrom(bytes.NewReader(bitmapVal)); err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
bm.RemoveRange(0, searchTx)
|
if searchTx == 0 {
|
||||||
if bm.IsEmpty() {
|
foundTxNum = bm.Minimum()
|
||||||
|
foundEndBlock = item.endBlock
|
||||||
|
found = true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
searchRank := bm.Rank(searchTx - 1)
|
||||||
|
if searchRank >= bm.GetCardinality() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
foundTxNum = bm.Minimum()
|
foundTxNum, _ = bm.Select(searchRank)
|
||||||
foundEndBlock = item.endBlock
|
foundEndBlock = item.endBlock
|
||||||
found = true
|
found = true
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user