Skip to content

Commit d113e4c

Browse files
committed
update comments
1 parent d7f4717 commit d113e4c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ledger/complete/payloadless_ledger.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,17 @@ func (l *PayloadlessLedger) Tries() ([]*payloadless.MTrie, error) {
248248
}
249249

250250
// Trie returns the trie stored in the forest with the given root hash.
251+
//
252+
// Expected error returns during normal operation:
253+
// - an error if no trie with the given root hash is stored in the forest
251254
func (l *PayloadlessLedger) Trie(rootHash ledger.RootHash) (*payloadless.MTrie, error) {
252255
return l.forest.GetTrie(rootHash)
253256
}
254257

255258
// MostRecentTouchedState returns the state most recently touched.
259+
//
260+
// Expected error returns during normal operation:
261+
// - an error if no trie is stored in the forest
256262
func (l *PayloadlessLedger) MostRecentTouchedState() (ledger.State, error) {
257263
root, err := l.forest.MostRecentTouchedRootHash()
258264
return ledger.State(root), err
@@ -279,6 +285,10 @@ func (l *PayloadlessLedger) StateCount() int {
279285
}
280286

281287
// StateByIndex returns the state at the given index. `-1` returns the last index.
288+
//
289+
// Expected error returns during normal operation:
290+
// - an error if no states are available in the forest
291+
// - an error if the given index is out of range
282292
func (l *PayloadlessLedger) StateByIndex(index int) (ledger.State, error) {
283293
tries, err := l.Tries()
284294
if err != nil {

0 commit comments

Comments
 (0)