mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 12:07:17 +00:00
393c9965ae
* fix `make grpc` on new checkouts * update proto files * add some stub * prototype with fake events * notifying about events * pass events * events are being sent * transfer headers to filters * create the “filters” struct * implement new heads * PoC of New Heads subscription * fix keep alive * fixups for the client * add “type” to the event * support header event type on client * better stage refactor * fixup for the eth backend * fixups * fix tests * fix tests * fix linters * address comments * remove unused log
37 lines
784 B
Go
37 lines
784 B
Go
package core
|
|
|
|
import (
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
"github.com/ledgerwatch/turbo-geth/core/types"
|
|
"github.com/ledgerwatch/turbo-geth/ethdb/remote"
|
|
"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)
|
|
}
|
|
|
|
func (back *EthBackend) Subscribe(func(*remote.SubscribeReply)) error {
|
|
// do nothing
|
|
return nil
|
|
}
|