diff options
Diffstat (limited to 'ledger/tracker.go')
-rw-r--r-- | ledger/tracker.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ledger/tracker.go b/ledger/tracker.go index 855995665..44a255b03 100644 --- a/ledger/tracker.go +++ b/ledger/tracker.go @@ -109,6 +109,11 @@ type ledgerTracker interface { // has completed. An optional context is provided for long-running operations. postCommit(context.Context, *deferredCommitContext) + // postCommitUnlocked is called only on a successful commitRound. In that case, each of the trackers have + // the chance to make changes that aren't state-dependent. + // An optional context is provided for long-running operations. + postCommitUnlocked(context.Context, *deferredCommitContext) + // handleUnorderedCommit is a special method for handling deferred commits that are out of order. // Tracker might update own state in this case. For example, account updates tracker cancels // scheduled catchpoint writing that deferred commit. @@ -323,6 +328,8 @@ func (tr *trackerRegistry) scheduleCommit(blockqRound, maxLookback basics.Round) } if cdr != nil { dcc.deferredCommitRange = *cdr + } else { + dcc = nil } tr.mu.RLock() @@ -472,6 +479,10 @@ func (tr *trackerRegistry) commitRound(dcc *deferredCommitContext) { tr.lastFlushTime = dcc.flushTime tr.mu.Unlock() + for _, lt := range tr.trackers { + lt.postCommitUnlocked(tr.ctx, dcc) + } + } // initializeTrackerCaches fills up the accountUpdates cache with the most recent ~320 blocks ( on normal execution ). |