Skip to content

Commit 99e7a48

Browse files
committedJul 21, 2022
stellar#4433: pr feedback, cleanup up method docs
1 parent 7a358fc commit 99e7a48

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed
 

‎exp/lighthorizon/archive/main.go

+13-25
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,26 @@ type LedgerTransactionReader interface {
3131
// Archive here only has the methods LightHorizon cares about, to make caching/wrapping easier
3232
type Archive interface {
3333

34-
//GetLedger - retreive a ledger's meta data
35-
//
36-
//ctx - the caller's request context
37-
//ledgerCloseMeta - the sequence number of ledger to fetch
38-
//
39-
//returns error or meta data for requested ledger
34+
// GetLedger - takes a caller context and a sequence number and returns the meta data
35+
// for the ledger corresponding to the sequence number. If there is any error, it will
36+
// return nil and the error.
4037
GetLedger(ctx context.Context, sequence uint32) (xdr.LedgerCloseMeta, error)
4138

42-
// Close - releases any resources used for this archive instance.
39+
// Close - will release any resources used for this archive instance and should be
40+
// called at end of usage of archive.
4341
Close() error
4442

45-
// NewLedgerTransactionReaderFromLedgerCloseMeta - get a reader for ledger meta data
46-
//
47-
// networkPassphrase - the network passphrase
48-
// ledgerCloseMeta - the meta data for a ledger
49-
//
50-
// returns error or LedgerTransactionReader
43+
// NewLedgerTransactionReaderFromLedgerCloseMeta - takes the passphrase for the blockchain network
44+
// and the LedgerCloseMeta(meta data) and returns a reader that can be used to obtain a LedgerTransaction model
45+
// from the meta data. If there is any error, it will return nil and the error.
5146
NewLedgerTransactionReaderFromLedgerCloseMeta(networkPassphrase string, ledgerCloseMeta xdr.LedgerCloseMeta) (LedgerTransactionReader, error)
5247

53-
// GetTransactionParticipants - get set of all participants(accounts) in a transaction
54-
//
55-
// transaction - the ledger transaction
56-
//
57-
// returns error or map with keys of participant account id's and value of empty struct
48+
// GetTransactionParticipants - takes a LedgerTransaction and returns a set of all
49+
// participants(accounts) in the transaction. If there is any error, it will return nil and the error.
5850
GetTransactionParticipants(transaction LedgerTransaction) (map[string]struct{}, error)
5951

60-
// GetOperationParticipants - get set of all participants(accounts) in a operation
61-
//
62-
// transaction - the ledger transaction
63-
// operation - the operation within this transaction
64-
// opIndex - the 0 based index of the operation within the transaction
65-
//
66-
// returns error or map with keys of participant account id's and value of empty struct
52+
// GetOperationParticipants - takes a LedgerTransaction, the Operation within the transaction, and
53+
// the 0 based index of the operation within the transaction. It will return a set of all participants(accounts)
54+
// in the operation. If there is any error, it will return nil and the error.
6755
GetOperationParticipants(transaction LedgerTransaction, operation xdr.Operation, opIndex int) (map[string]struct{}, error)
6856
}

‎exp/lighthorizon/services/main.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ func (ts *TransactionsService) GetTransactionsByAccount(ctx context.Context, cur
9090
LedgerHeader: ledgerHeader,
9191
TxIndex: int32(tx.Index),
9292
})
93-
if uint64(len(txs)) == limit {
94-
return true, nil
95-
}
96-
return false, nil
93+
return (uint64(len(txs)) >= limit), nil
9794
}
9895

9996
if err := searchTxByAccount(ctx, cursor, accountId, ts.Config, txsCallback); err != nil {

0 commit comments

Comments
 (0)