erigon-pulse/core/eth_backend.go
Evgeny Danilenko 3b40819444
grpc regenerate (#936)
* grpc regenerate

* use string type for id in net_version
2020-08-18 20:22:49 +03:00

31 lines
632 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)
}
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)
}