mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
maintain the cache
Signed-off-by: Delweng <delweng@gmail.com>
This commit is contained in:
parent
10aeeed669
commit
a259ae54e8
1 changed files with 6 additions and 0 deletions
|
|
@ -304,6 +304,9 @@ func (w *indexWriter) finish(batch ethdb.Batch) {
|
||||||
for _, desc := range descList {
|
for _, desc := range descList {
|
||||||
buf = append(buf, desc.encode()...)
|
buf = append(buf, desc.encode()...)
|
||||||
}
|
}
|
||||||
|
if key := w.state.String(); historyIndexCache.Contains(key) {
|
||||||
|
historyIndexCache.Add(key, buf)
|
||||||
|
}
|
||||||
if w.state.account {
|
if w.state.account {
|
||||||
rawdb.WriteAccountHistoryIndex(batch, w.state.addressHash, buf)
|
rawdb.WriteAccountHistoryIndex(batch, w.state.addressHash, buf)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -420,6 +423,9 @@ func (d *indexDeleter) pop(id uint64) error {
|
||||||
//
|
//
|
||||||
// This function is safe to be called multiple times.
|
// This function is safe to be called multiple times.
|
||||||
func (d *indexDeleter) finish(batch ethdb.Batch) {
|
func (d *indexDeleter) finish(batch ethdb.Batch) {
|
||||||
|
if key := d.state.String(); historyIndexCache.Contains(key) {
|
||||||
|
historyIndexCache.Remove(key)
|
||||||
|
}
|
||||||
for _, id := range d.dropped {
|
for _, id := range d.dropped {
|
||||||
if d.state.account {
|
if d.state.account {
|
||||||
rawdb.DeleteAccountHistoryIndexBlock(batch, d.state.addressHash, id)
|
rawdb.DeleteAccountHistoryIndexBlock(batch, d.state.addressHash, id)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue