Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
robdefeo committed Dec 17, 2019
1 parent dfaf43a commit 647ecb9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmd/indexer/internal/clients/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package clients

import "context"

// BlockByNumber is a client that gets the blocks by number
type BlockByNumber interface {
Get(ctx context.Context, blockNo uint64) (blk interface{}, err error)
}
1 change: 0 additions & 1 deletion cmd/indexer/internal/processor/process.go

This file was deleted.

7 changes: 3 additions & 4 deletions cmd/indexer/internal/processor/sequential.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
)

type Sequential struct {
syncStore datastore.SyncStore
protocol string
network string
protocol string
network string

syncStore datastore.SyncStore
blockProcessor Block
blockClient clients.BlockByNumber
}
Expand All @@ -23,7 +23,6 @@ func (s *Sequential) NextBlock(ctx context.Context) error {
}
nextBlockNo := blkNo + 1

// big.NewInt(int64(nextBlockNo))
blk, err := s.blockClient.Get(ctx, nextBlockNo)
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions cmd/indexer/internal/processor/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import (
"github.com/mailchain/mailchain/internal/encoding"
)

// Transaction processes transactions
type Transaction interface {
// Run the transaction processor
Run(ctx context.Context, protocol, network string, tx interface{}, txOpts TransactionOptions) error
}

// TransactionOptions related to different transactions
type TransactionOptions interface{}

// StoreTransaction saves the raw and processed transaction in the datastores.
func StoreTransaction(ctx context.Context, txStore datastore.TransactionStore, rawTxStore datastore.RawTransactionStore, protocol, network string, tx *datastore.Transaction, rawTx interface{}) error {
if bytes.HasPrefix(tx.Data, encoding.DataPrefix()) {
if err := rawTxStore.PutRawTransaction(ctx, protocol, network, tx.Hash, rawTx); err != nil {
Expand Down

0 comments on commit 647ecb9

Please sign in to comment.