func (t *TrackingState) Update(cb func(transaction csmt.TreeTransactionAccess) error) error {
	t.lock.Lock()
	defer t.lock.Unlock()

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

	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
	}

	t.updateWitnesses = tsa.updateWitnesses
	t.verificationWitnesses = tsa.verificationWitnesses

	return nil
}
// Update updates the underlying state and tracks changes.
Update updates the underlying state and tracks changes.
// Update updates the underlying state and tracks changes .
func (t *TrackingState) Update(cb func(transaction csmt.TreeTransactionAccess) error) error {
	t.lock.Lock()
	defer t.lock.Unlock()
	tsa := &TrackingStateAccess{
		verificationWitnesses: t.verificationWitnesses[:],
		updateWitnesses:       t.updateWitnesses[:],
	}
	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
	}
	t.updateWitnesses = tsa.updateWitnesses
	t.verificationWitnesses = tsa.verificationWitnesses
	return nil
}
func ( t * TrackingState ) Update ( cb func ( transaction csmt . TreeTransactionAccess ) error ) error { t . lock . Lock ( ) defer t . lock . Unlock ( ) tsa := & TrackingStateAccess { verificationWitnesses : t . verificationWitnesses [ : ] , updateWitnesses : t . updateWitnesses [ : ] , } 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 } t . updateWitnesses = tsa . updateWitnesses t . verificationWitnesses = tsa . verificationWitnesses return nil }
Update updates the underlying state and tracks changes.
Update updates the underlying state and tracks changes .