func (t *TrackingState) View(cb func(transaction csmt.TreeTransactionAccess) error) error {
	t.lock.RLock()

	tsa := &TrackingStateAccess{
		verificationWitnesses: t.verificationWitnesses[:],
		updateWitnesses:       t.updateWitnesses[:],
	}

	t.lock.RUnlock()

	err := t.fullState.Update(func(a csmt.TreeTransactionAccess) error {
		nonTracking := newFullShardStateAccess(a.(*csmt.TreeTransaction))
		tsa.fullState = *nonTracking
		return cb(tsa)
	})
	if err != nil {
		return err
	}

	return nil
}
// View gives a consistent view of the underlying state and tracks changes.
View gives a consistent view of the underlying state and tracks changes.
// View gives a consistent view of the underlying state and tracks changes .
func (t *TrackingState) View(cb func(transaction csmt.TreeTransactionAccess) error) error {
	t.lock.RLock()
	tsa := &TrackingStateAccess{
		verificationWitnesses: t.verificationWitnesses[:],
		updateWitnesses:       t.updateWitnesses[:],
	}
	t.lock.RUnlock()
	err := t.fullState.Update(func(a csmt.TreeTransactionAccess) error {
		nonTracking := newFullShardStateAccess(a.(*csmt.TreeTransaction))
		tsa.fullState = *nonTracking
		return cb(tsa)
	})
	if err != nil {
		return err
	}
	return nil
}
func ( t * TrackingState ) View ( cb func ( transaction csmt . TreeTransactionAccess ) error ) error { t . lock . RLock ( ) tsa := & TrackingStateAccess { verificationWitnesses : t . verificationWitnesses [ : ] , updateWitnesses : t . updateWitnesses [ : ] , } t . lock . RUnlock ( ) err := t . fullState . Update ( func ( a csmt . TreeTransactionAccess ) error { nonTracking := newFullShardStateAccess ( a . ( * csmt . TreeTransaction ) ) tsa . fullState = * nonTracking return cb ( tsa ) } ) if err != nil { return err } return nil }
View gives a consistent view of the underlying state and tracks changes.
View gives a consistent view of the underlying state and tracks changes .