mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
27 lines
585 B
Go
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)
|
||
|
}
|