Skip to content

Commit

Permalink
stellar#4433: more verbose error message for missing ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Jul 8, 2022
1 parent dcc8953 commit ae5f81d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
10 changes: 0 additions & 10 deletions exp/lighthorizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@ package main

import (
"flag"
"fmt"
"net/http"
"os"

"github.com/go-chi/chi"
"github.com/stellar/go/exp/lighthorizon/actions"
"github.com/stellar/go/exp/lighthorizon/archive"
"github.com/stellar/go/exp/lighthorizon/index"
"github.com/stellar/go/exp/lighthorizon/services"
"github.com/stellar/go/toid"

"github.com/stellar/go/network"
"github.com/stellar/go/support/log"
)

func main() {

os.Args = append(os.Args, "-source=file:///Users/sreuland/workspace/txmeta-live-archive")
os.Args = append(os.Args, "-indexes=file:///Users/sreuland/workspace/txmeta-live-archive")

cursor := toid.New(1586111, 1, 1).ToInt64()
fmt.Printf("\nthe cursor %v\n", cursor)

sourceUrl := flag.String("source", "gcs://horizon-archive-poc", "history archive url to read txmeta files")
indexesUrl := flag.String("indexes", "file://indexes", "url of the indexes")
networkPassphrase := flag.String("network-passphrase", network.TestNetworkPassphrase, "network passphrase")
Expand Down
8 changes: 4 additions & 4 deletions exp/lighthorizon/services/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func (lh *LightHorizon) GetOperationsByAccount(ctx context.Context, cursor int64
ledgerSequence := startingCheckPointLedger

for (ledgerSequence - startingCheckPointLedger) < 64 {
ledger, findErr := lh.Archive.GetLedger(ctx, ledgerSequence)
if findErr != nil {
return nil, errors.Wrap(findErr, "indexing state is invalid, missing ledgers from checkpoint")
ledger, ledgerErr := lh.Archive.GetLedger(ctx, ledgerSequence)
if ledgerErr != nil {
return nil, errors.Wrapf(ledgerErr, "ledger export state is out of sync, missing ledger %v from checkpoint %v", ledgerSequence, ledgerSequence/64)
}

reader, readerErr := lh.Archive.NewLedgerTransactionReaderFromLedgerCloseMeta(lh.Passphrase, ledger)
Expand Down Expand Up @@ -120,7 +120,7 @@ func (lh *LightHorizon) GetTransactionsByAccount(ctx context.Context, cursor int
for (ledgerSequence - startingCheckPointLedger) < 64 {
ledger, ledgerErr := lh.Archive.GetLedger(ctx, ledgerSequence)
if ledgerErr != nil {
return nil, errors.Wrap(ledgerErr, "indexing state is invalid, missing ledgers from checkpoint")
return nil, errors.Wrapf(ledgerErr, "ledger export state is out of sync, missing ledger %v from checkpoint %v", ledgerSequence, ledgerSequence/64)
}

reader, readerErr := lh.Archive.NewLedgerTransactionReaderFromLedgerCloseMeta(lh.Passphrase, ledger)
Expand Down

0 comments on commit ae5f81d

Please sign in to comment.