erigon-pulse/cmd/rpcdaemon/commands/send_transaction.go
Thomas Jay Rush 784bc9dc85 Fixes issue #1139 - crash when running chaindata mode (#1140)
* Fixes issue #1139 - crash when running chaindata mode

* Cleaning up error messages as per feedback
2020-09-27 12:11:05 -04:00

20 lines
573 B
Go

package commands
import (
"context"
"fmt"
"github.com/ledgerwatch/turbo-geth/common"
"github.com/ledgerwatch/turbo-geth/common/hexutil"
)
// SendRawTransaction send a raw transaction
func (api *APIImpl) SendRawTransaction(_ context.Context, encodedTx hexutil.Bytes) (common.Hash, error) {
if api.ethBackend == nil {
// We're running in --chaindata mode or otherwise cannot get the backend
return common.Hash{}, fmt.Errorf(NotAvailableChainData, "eth_sendRawTransaction")
}
res, err := api.ethBackend.AddLocal(encodedTx)
return common.BytesToHash(res), err
}