Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
rasom committed Dec 18, 2019
1 parent c5fd527 commit f3171fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion services/wallet/concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,25 @@ func downloadEthConcurrently(c *ConcurrentDownloader, client BalanceReader, down
}
if lb.Cmp(hb) == 0 {
log.Debug("balances are equal", "low", low, "high", high)
return nil
// In case if balances are equal but non zero we want to check if
// eth_getTransactionCount return different values, because there
// still might be transactions
if lb.Cmp(zero) != 0 {
return nil
}

ln, err := client.NonceAt(ctx, account, low)
if err != nil {
return err
}
hn, err := client.NonceAt(ctx, account, high)
if err != nil {
return err
}
if ln == hn {
log.Debug("transaction count is also equal", "low", low, "high", high)
return nil
}
}
if new(big.Int).Sub(high, low).Cmp(one) == 0 {
transfers, err := downloader.GetTransfersByNumber(ctx, high)
Expand Down
1 change: 1 addition & 0 deletions services/wallet/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type HeaderReader interface {
// BalanceReader interface for reading balance at a specifeid address.
type BalanceReader interface {
BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
}

type reactorClient interface {
Expand Down

0 comments on commit f3171fd

Please sign in to comment.