erigon-pulse/core/eth_backend.go
Evgeny Danilenko e4f495fa44
Get logs (#1028)
* it compiles

* after recent master

* fix linters warnings

* grpcV7

* go mod tidy

* unmarshall adresses or adress

* fix linters

* after cr

* after cr

* after cr

* after cr

* fix tests

* remove dev version

* it compiles

* mod tidy

* fix bin deps

* use stable version of grpc

* switch back to master constructor

* switch back to master constructor

* add a bit docs

* add a bit docs

Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2020-09-03 08:51:19 +01:00

36 lines
782 B
Go

package core
import (
"github.com/ledgerwatch/turbo-geth/common"
"github.com/ledgerwatch/turbo-geth/core/types"
"github.com/ledgerwatch/turbo-geth/rlp"
)
type EthBackend struct {
Backend
}
type Backend interface {
TxPool() *TxPool
Etherbase() (common.Address, error)
NetVersion() (uint64, error)
BloomIndexer() *ChainIndexer
}
func NewEthBackend(eth Backend) *EthBackend {
return &EthBackend{eth}
}
func (back *EthBackend) AddLocal(signedtx []byte) ([]byte, error) {
tx := new(types.Transaction)
if err := rlp.DecodeBytes(signedtx, tx); err != nil {
return common.Hash{}.Bytes(), err
}
return tx.Hash().Bytes(), back.TxPool().AddLocal(tx)
}
func (back *EthBackend) BloomStatus() (uint64, uint64, common.Hash) {
return back.Backend.BloomIndexer().Sections()
}