Skip to content

Commit

Permalink
Add config-options for tx pagination limits
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1702 committed Apr 16, 2024
1 parent 0e8b9da commit 5156b9e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
22 changes: 22 additions & 0 deletions cmd/soroban-rpc/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,28 @@ func (cfg *Config) options() ConfigOptions {
return nil
},
},
{
Name: "max-transactions-limit",
Usage: "Maximum amount of transactions allowed in a single getTransactions response",
ConfigKey: &cfg.MaxTransactionsLimit,
DefaultValue: uint(10000),
},
{
Name: "default-transactions-limit",
Usage: "Default cap on the amount of transactions included in a single getTransactions response",
ConfigKey: &cfg.DefaultTransactionsLimit,
DefaultValue: uint(100),
Validate: func(co *ConfigOption) error {
if cfg.DefaultTransactionsLimit > cfg.MaxTransactionsLimit {
return fmt.Errorf(
"default-transactions-limit (%v) cannot exceed max-transactions-limit (%v)",
cfg.DefaultTransactionsLimit,
cfg.MaxTransactionsLimit,
)
}
return nil
},
},
{
Name: "max-healthy-ledger-latency",
Usage: "maximum ledger latency (i.e. time elapsed since the last known ledger closing time) considered to be healthy" +
Expand Down
8 changes: 0 additions & 8 deletions cmd/soroban-rpc/internal/methods/get_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ type TransactionsPaginationOptions struct {
Limit uint `json:"limit,omitempty"`
}

// Range defines a [Start, End] interval of ledgers.
type Range struct {
// Start defines the (inclusive) start of the range.
Start transactions.Cursor
// End defines the (inclusive) end of the range.
End transactions.Cursor
}

type GetTransactionsRequest struct {
StartLedger uint32 `json:"startLedger"`
EndLedger uint32 `json:"endLedger"`
Expand Down

0 comments on commit 5156b9e

Please sign in to comment.