erigon-pulse/core/raw_tx_pool.go
Evgeny Danilenko 3980fa7d45
Grps eth_sendTransaction (#882)
* implementation

* tidy gomod

* linters

* fix cmd test

* fix

* fix lint
2020-08-11 22:09:30 +01:00

27 lines
585 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 RawTxPool TxPool
func RawFromTxPool(pool *TxPool) *RawTxPool {
return (*RawTxPool)(pool)
}
func TxPoolFromRaw(pool *RawTxPool) *TxPool {
return (*TxPool)(pool)
}
func (pool *RawTxPool) 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(), TxPoolFromRaw(pool).AddLocal(tx)
}