Skip to content

Commit 1ea0be7

Browse files
committed
update comments
1 parent a13dbcc commit 1ea0be7

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
@@ -382,11 +382,17 @@ func (l *PayloadlessLedger) Tries() ([]*payloadless.MTrie, error) {
382382
}
383383

384384
// Trie returns the trie stored in the forest with the given root hash.
385+
//
386+
// Expected error returns during normal operation:
387+
// - an error if no trie with the given root hash is stored in the forest
385388
func (l *PayloadlessLedger) Trie(rootHash ledger.RootHash) (*payloadless.MTrie, error) {
386389
return l.forest.GetTrie(rootHash)
387390
}
388391

389392
// MostRecentTouchedState returns the state most recently touched.
393+
//
394+
// Expected error returns during normal operation:
395+
// - an error if no trie is stored in the forest
390396
func (l *PayloadlessLedger) MostRecentTouchedState() (ledger.State, error) {
391397
root, err := l.forest.MostRecentTouchedRootHash()
392398
return ledger.State(root), err
@@ -413,6 +419,10 @@ func (l *PayloadlessLedger) StateCount() int {
413419
}
414420

415421
// StateByIndex returns the state at the given index. `-1` returns the last index.
422+
//
423+
// Expected error returns during normal operation:
424+
// - an error if no states are available in the forest
425+
// - an error if the given index is out of range
416426
func (l *PayloadlessLedger) StateByIndex(index int) (ledger.State, error) {
417427
tries, err := l.Tries()
418428
if err != nil {

0 commit comments

Comments
 (0)