mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 12:37:16 +00:00
e4f495fa44
* 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>
36 lines
782 B
Go
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()
|
|
}
|