Skip to content

Commit

Permalink
Omit max_ledger when it's 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Apr 29, 2022
1 parent 05e2e57 commit 9d0eb3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ type TransactionPreconditionsTimebounds struct {

type TransactionPreconditionsLedgerbounds struct {
MinLedger uint32 `json:"min_ledger"`
MaxLedger uint32 `json:"max_ledger"`
MaxLedger uint32 `json:"max_ledger,omitempty"`
}

// FeeBumpTransaction contains information about a fee bump transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func formatLedgerBounds(ledgerBounds *xdr.LedgerBounds) LedgerBounds {

return LedgerBounds{
MinLedger: null.IntFrom(int64(ledgerBounds.MinLedger)),
MaxLedger: null.IntFrom(int64(ledgerBounds.MaxLedger)),
// elide max_ledger if it's 0 since that means no upper bound
MaxLedger: null.NewInt(
int64(ledgerBounds.MaxLedger),
ledgerBounds.MaxLedger > 0),
}
}

0 comments on commit 9d0eb3b

Please sign in to comment.