2020-10-18 19:44:28 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/core/types"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/rpc"
|
|
|
|
)
|
|
|
|
|
2020-10-24 17:03:52 +00:00
|
|
|
// TgAPI TurboGeth specific routines
|
2020-10-18 19:44:28 +00:00
|
|
|
type TgAPI interface {
|
|
|
|
// System related (see ./tg_system.go)
|
|
|
|
Forks(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (Forks, error)
|
|
|
|
|
|
|
|
// Blocks related (see ./tg_blocks.go)
|
2020-10-20 21:16:28 +00:00
|
|
|
GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
|
2020-10-18 19:44:28 +00:00
|
|
|
GetHeaderByHash(_ context.Context, hash common.Hash) (*types.Header, error)
|
|
|
|
|
|
|
|
// Receipt related (see ./tg_receipts.go)
|
|
|
|
GetLogsByHash(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
|
2020-10-24 17:03:52 +00:00
|
|
|
//GetLogsByNumber(ctx context.Context, number rpc.BlockNumber) ([][]*types.Log, error)
|
2020-10-20 21:16:28 +00:00
|
|
|
|
|
|
|
// Issuance / reward related (see ./tg_issuance.go)
|
2020-10-24 17:03:52 +00:00
|
|
|
// BlockReward(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
|
|
|
// UncleReward(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
2020-10-20 21:16:28 +00:00
|
|
|
Issuance(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
2020-10-18 19:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TgImpl is implementation of the TgAPI interface
|
|
|
|
type TgImpl struct {
|
|
|
|
db ethdb.KV
|
|
|
|
dbReader ethdb.Database
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewTgAPI returns TgImpl instance
|
|
|
|
func NewTgAPI(db ethdb.KV, dbReader ethdb.Database) *TgImpl {
|
|
|
|
return &TgImpl{
|
|
|
|
db: db,
|
|
|
|
dbReader: dbReader,
|
|
|
|
}
|
|
|
|
}
|