core: swap transfer and MPT GC

It doesn't change anything logically, but transfer GC needs to have current
block timestamp for its logic and if we're delaying it with MPT GC it can
more often fail to obtain it:

    2025-01-13T16:15:18.311+0300    ERROR   failed to get block timestamp transfer GC       {"time": "1.022µs", "index": 20000}

It's not critical, this garbage can still be collected on the next run, but
we better avoid this anyway.

Refs. #3783.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2025-01-13 19:22:06 +03:00
parent 4d2b88dd9d
commit 1f83f472c7

View file

@ -1159,8 +1159,8 @@ func (bc *Blockchain) tryRunGC(oldHeight uint32) time.Duration {
oldHeight /= bc.config.Ledger.GarbageCollectionPeriod oldHeight /= bc.config.Ledger.GarbageCollectionPeriod
newHeight /= bc.config.Ledger.GarbageCollectionPeriod newHeight /= bc.config.Ledger.GarbageCollectionPeriod
if tgtBlock > int64(bc.config.Ledger.GarbageCollectionPeriod) && newHeight != oldHeight { if tgtBlock > int64(bc.config.Ledger.GarbageCollectionPeriod) && newHeight != oldHeight {
dur = bc.stateRoot.GC(uint32(tgtBlock), bc.store) dur = bc.removeOldTransfers(uint32(tgtBlock))
dur += bc.removeOldTransfers(uint32(tgtBlock)) dur += bc.stateRoot.GC(uint32(tgtBlock), bc.store)
} }
return dur return dur
} }