Skip to content

Commit

Permalink
fix long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed Dec 7, 2020
1 parent ac005dd commit 6172863
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
3 changes: 2 additions & 1 deletion storage/encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ func (e *Encoder) EncodeAccountCurrency( // nolint:gocognit
return nil, fmt.Errorf("%w: %s", errors.ErrObjectEncodeFailed, err.Error())
}

if accountCurrency.Account.SubAccount != nil && accountCurrency.Account.SubAccount.Metadata != nil {
if accountCurrency.Account.SubAccount != nil &&
accountCurrency.Account.SubAccount.Metadata != nil {
if err := e.encodeAndWrite(output, accountCurrency.Account.SubAccount.Metadata); err != nil {
return nil, fmt.Errorf("%w: %s", errors.ErrObjectEncodeFailed, err.Error())
}
Expand Down
35 changes: 19 additions & 16 deletions storage/modules/balance_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,26 +475,29 @@ func (b *BalanceStorage) ReconciliationCoverage(
) (float64, error) {
seen := 0
validCoverage := 0
err := b.getAllAccountEntries(ctx, func(txn database.Transaction, entry *types.AccountCurrency) error {
seen++
err := b.getAllAccountEntries(
ctx,
func(txn database.Transaction, entry *types.AccountCurrency) error {
seen++

// Fetch last reconciliation index in same database.Transaction
key := GetAccountKey(reconciliationNamepace, entry.Account, entry.Currency)
exists, lastReconciled, err := BigIntGet(ctx, key, txn)
if err != nil {
return err
}
// Fetch last reconciliation index in same database.Transaction
key := GetAccountKey(reconciliationNamepace, entry.Account, entry.Currency)
exists, lastReconciled, err := BigIntGet(ctx, key, txn)
if err != nil {
return err
}

if !exists {
return nil
}
if !exists {
return nil
}

if lastReconciled.Int64() >= minimumIndex {
validCoverage++
}
if lastReconciled.Int64() >= minimumIndex {
validCoverage++
}

return nil
})
return nil
},
)
if err != nil {
return -1, fmt.Errorf("%w: unable to get all account entries", err)
}
Expand Down
5 changes: 2 additions & 3 deletions storage/modules/block_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,9 +1048,8 @@ func (b *BlockStorage) FindTransaction(
var newestTransaction *types.Transaction
for _, blockTransaction := range blockTransactions {
if newestBlock == nil || blockTransaction.BlockIdentifier.Index > newestBlock.Index {
// Now that we are optimistically storing data, there is a change
// we may fetch a transaction from an unfinalized block. In some cases (rosetta-bitcoin),
// we want this!
// Now that we are optimistically storing data, there is a chance
// we may fetch a transaction from a seen but unsequenced block.
if head != nil && blockTransaction.BlockIdentifier.Index > head.Index {
continue
}
Expand Down

0 comments on commit 6172863

Please sign in to comment.