Skip to content

Commit

Permalink
Change LastLedger type to uint32
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekn committed Nov 28, 2019
1 parent 5d7318e commit 1df8d94
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ type FeeDistribution struct {
// To do: implement fee suggestions if agreement is reached in https://github.com/stellar/go/issues/926
type FeeStats struct {
// Action needed in release: horizon-v0.25.0
// Update type for LastLedger and LastLedgerBaseFee to int64
// Update type for LastLedger to uint32 and LastLedgerBaseFee to int64
LastLedger int `json:"last_ledger,string"`
LastLedgerBaseFee int `json:"last_ledger_base_fee,string"`

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/actions_operation_fee_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var _ actions.JSONer = (*FeeStatsAction)(nil)
// this struct is very similar to hProtocol.feeStats but drops the usage of int
// in favor of int64
type feeStats struct {
LastLedger int64 `json:"last_ledger,string"`
LastLedger uint32 `json:"last_ledger,string"`
LastLedgerBaseFee int64 `json:"last_ledger_base_fee,string"`
LedgerCapacityUsage float64 `json:"ledger_capacity_usage,string"`
MinAcceptedFee int64 `json:"min_accepted_fee,string"`
Expand Down
4 changes: 2 additions & 2 deletions services/horizon/internal/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ func (a *App) UpdateFeeStatsState() {
}

// finish early if no new ledgers
if cur.LastLedger == int64(latest.Sequence) {
if cur.LastLedger == uint32(latest.Sequence) {
return
}

next.LastBaseFee = int64(latest.BaseFee)
next.LastLedger = int64(latest.Sequence)
next.LastLedger = uint32(latest.Sequence)

err = a.HistoryQ().FeeStats(latest.Sequence, &feeStats)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/operationfeestats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type State struct {
MaxFeeP99 int64

LastBaseFee int64
LastLedger int64
LastLedger uint32
LedgerCapacityUsage string
}

Expand Down

0 comments on commit 1df8d94

Please sign in to comment.