Skip to content

Commit

Permalink
Restore seen accounts from storage
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed May 13, 2020
1 parent 6f8449f commit faad287
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ func runCheckCmd(cmd *cobra.Command, args []string) {
}
}

// Get all previously seen accounts
seenAccounts, err := blockStorage.GetAllAccountCurrency(ctx)
if err != nil {
log.Fatal(fmt.Errorf("%w: unable to get previously seen accounts", err))
}

reconcilerHelper := processor.NewReconcilerHelper(
blockStorage,
)
Expand All @@ -373,6 +379,7 @@ func runCheckCmd(cmd *cobra.Command, args []string) {
reconciler.WithReconcilerConcurrency(int(ReconcilerConcurrency)),
reconciler.WithLookupBalanceByBlock(LookupBalanceByBlock),
reconciler.WithInterestingAccounts(interestingAccounts),
reconciler.WithSeenAccounts(seenAccounts),
)

syncerHandler := processor.NewSyncerHandler(
Expand Down
6 changes: 2 additions & 4 deletions internal/processor/reconciler_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package processor
import (
"context"
"errors"
"fmt"

"github.com/coinbase/rosetta-cli/internal/logger"

Expand Down Expand Up @@ -108,8 +107,7 @@ func (h *ReconcilerHandler) NewAccountSeen(
account *types.AccountIdentifier,
currency *types.Currency,
) error {
fmt.Printf("New Account Seen: %s\n", types.PrettyPrintStruct(account))
// TODO: store somewhere...should be append only otherwise we will need to
// load arbitrarily large structures into memory for each addition.
// We don't persist new accounts here because we are already storing
// them when we set their balance in the internal/storage package.
return nil
}

0 comments on commit faad287

Please sign in to comment.