Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
Signed-off-by: Angelo De Caro <[email protected]>
  • Loading branch information
adecaro committed Dec 3, 2024
1 parent 7087a52 commit ea9dfe4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions token/services/network/common/rws/translator/rwset.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type ExRWSet interface {
// StateMustNotExist adds a read dependency that enforces that the passed key does not exist
StateMustNotExist(key Key) error
// StateMustExist adds a read dependency that enforces that the passed key does exist
// When using VersionZero, this method should be called only for keys that are guaranteed to be used only once.
StateMustExist(key Key, version KeyVersion) error
}

Expand Down Expand Up @@ -109,6 +110,9 @@ func (w *RWSetWrapper) StateMustNotExist(key Key) error {
}

func (w *RWSetWrapper) StateMustExist(key Key, version KeyVersion) error {
// This wrapper assumes the following:
// When StateMustExist is called on VersionZero, Latest behaviour is used instead.
// This works under the assumption that keys are used only once.
h, err := w.RWSet.GetState(w.Namespace, key)
if err != nil {
return errors.Wrapf(err, "failed to read state [%s:%s] for [%s]", w.Namespace, key, w.TxID)
Expand Down

0 comments on commit ea9dfe4

Please sign in to comment.