Skip to content

Commit

Permalink
stellar#4483: fixed the continue vs start value checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Aug 3, 2022
1 parent 0222139 commit 23e5302
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions exp/services/ledgerexporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,23 @@ func main() {
// Build the appropriate range for the given backend state.
startLedger := uint32(*startingLedger)
endLedger := uint32(*endingLedger)
if startLedger < 2 {
logger.Fatalf("-start-ledger must be >= 2")
}
if endLedger != 0 && endLedger < startLedger {
logger.Fatalf("-end-ledger must be >= -start-ledger")
}

logger.Infof("processing requested range of -start-ledger=%v, -end-ledger=%v", startLedger, endLedger)
if *continueFromLatestLedger {
if startLedger != 0 {
logger.Fatalf("-start-ledger and -continue cannot both be set")
}
startLedger = readLatestLedger(target)
logger.Infof("continue flag was enabled, next ledger found was %v", startLedger)
}

if startLedger < 2 {
logger.Fatalf("-start-ledger must be >= 2")
}
if endLedger != 0 && endLedger < startLedger {
logger.Fatalf("-end-ledger must be >= -start-ledger")
}

var ledgerRange ledgerbackend.Range
if endLedger == 0 {
ledgerRange = ledgerbackend.UnboundedRange(startLedger)
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/docker/ledgerexporter/ledgerexporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data:
# when using core 'on disk', the earliest ledger to get streamed out after catchup to 2, is 3
# whereas on in-memory it streas out 2, adjusted here, otherwise horizon ingest will abort
# and stop process with error that ledger 3 is not <= expected ledger of 2.
#START: "3"
START: "0"
END: "0"

# can only have CONTINUE or START set, not both.
Expand Down

0 comments on commit 23e5302

Please sign in to comment.