2022-05-26 03:31:06 +00:00
|
|
|
package services
|
2021-11-14 04:08:52 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
|
|
|
"github.com/ledgerwatch/erigon/common"
|
|
|
|
"github.com/ledgerwatch/erigon/core/types"
|
2021-12-14 10:13:17 +00:00
|
|
|
"github.com/ledgerwatch/erigon/rlp"
|
2021-11-14 04:08:52 +00:00
|
|
|
)
|
|
|
|
|
2022-05-26 03:31:06 +00:00
|
|
|
type All struct {
|
|
|
|
BlockReader FullBlockReader
|
|
|
|
}
|
|
|
|
|
2021-11-14 04:08:52 +00:00
|
|
|
type BlockReader interface {
|
2022-01-07 13:52:38 +00:00
|
|
|
BlockWithSenders(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (block *types.Block, senders []common.Address, err error)
|
2021-11-14 04:08:52 +00:00
|
|
|
}
|
2021-11-29 03:43:19 +00:00
|
|
|
|
2021-12-05 02:03:08 +00:00
|
|
|
type HeaderReader interface {
|
|
|
|
Header(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (*types.Header, error)
|
|
|
|
HeaderByNumber(ctx context.Context, tx kv.Getter, blockHeight uint64) (*types.Header, error)
|
2022-01-04 08:46:22 +00:00
|
|
|
HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (*types.Header, error)
|
2022-01-07 13:52:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type CanonicalReader interface {
|
2022-01-04 08:46:22 +00:00
|
|
|
CanonicalHash(ctx context.Context, tx kv.Getter, blockHeight uint64) (common.Hash, error)
|
2021-12-05 02:03:08 +00:00
|
|
|
}
|
|
|
|
|
2021-12-14 10:13:17 +00:00
|
|
|
type BodyReader interface {
|
2022-01-07 13:52:38 +00:00
|
|
|
BodyWithTransactions(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, err error)
|
|
|
|
BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bodyRlp rlp.RawValue, err error)
|
2022-08-04 11:49:53 +00:00
|
|
|
Body(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, txAmount uint32, err error)
|
2022-01-07 13:52:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type TxnReader interface {
|
|
|
|
TxnLookup(ctx context.Context, tx kv.Getter, txnHash common.Hash) (uint64, bool, error)
|
2022-06-12 11:44:01 +00:00
|
|
|
TxnByIdxInBlock(ctx context.Context, tx kv.Getter, blockNum uint64, i int) (txn types.Transaction, err error)
|
2022-01-07 13:52:38 +00:00
|
|
|
}
|
|
|
|
type HeaderAndCanonicalReader interface {
|
|
|
|
HeaderReader
|
|
|
|
CanonicalReader
|
|
|
|
}
|
|
|
|
|
|
|
|
type BlockAndTxnReader interface {
|
|
|
|
BlockReader
|
|
|
|
//HeaderReader
|
|
|
|
TxnReader
|
2021-12-14 10:13:17 +00:00
|
|
|
}
|
|
|
|
|
2021-11-29 03:43:19 +00:00
|
|
|
type FullBlockReader interface {
|
|
|
|
BlockReader
|
2021-12-14 10:13:17 +00:00
|
|
|
BodyReader
|
2021-12-05 02:03:08 +00:00
|
|
|
HeaderReader
|
2022-01-07 13:52:38 +00:00
|
|
|
TxnReader
|
|
|
|
CanonicalReader
|
2021-11-29 03:43:19 +00:00
|
|
|
}
|