2020-10-18 19:44:28 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-05-20 18:25:53 +00:00
|
|
|
"github.com/ledgerwatch/erigon/common"
|
|
|
|
"github.com/ledgerwatch/erigon/core/types"
|
|
|
|
"github.com/ledgerwatch/erigon/ethdb"
|
|
|
|
"github.com/ledgerwatch/erigon/rpc"
|
2020-10-18 19:44:28 +00:00
|
|
|
)
|
|
|
|
|
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)
|
2020-10-25 21:34:00 +00:00
|
|
|
Forks(ctx context.Context) (Forks, error)
|
2020-10-18 19:44:28 +00:00
|
|
|
|
|
|
|
// 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 {
|
2021-01-02 19:28:22 +00:00
|
|
|
*BaseAPI
|
2021-05-17 12:15:19 +00:00
|
|
|
db ethdb.RoKV
|
2020-10-18 19:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewTgAPI returns TgImpl instance
|
2021-05-17 12:15:19 +00:00
|
|
|
func NewTgAPI(base *BaseAPI, db ethdb.RoKV) *TgImpl {
|
2020-10-18 19:44:28 +00:00
|
|
|
return &TgImpl{
|
2021-05-17 12:15:19 +00:00
|
|
|
BaseAPI: base,
|
2021-02-21 08:38:00 +00:00
|
|
|
db: db,
|
2020-10-18 19:44:28 +00:00
|
|
|
}
|
|
|
|
}
|