From dc58568a25e54ea601aefb8e97f427cae0814612 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Wed, 24 Jun 2015 14:56:53 +0200 Subject: added eth.resend --- rpc/api/eth.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'rpc/api/eth.go') diff --git a/rpc/api/eth.go b/rpc/api/eth.go index 77c710fb0..2bd7e4cdb 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -6,6 +6,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/shared" @@ -74,6 +75,7 @@ var ( "eth_hashrate": (*ethApi).Hashrate, "eth_getWork": (*ethApi).GetWork, "eth_submitWork": (*ethApi).SubmitWork, + "eth_resend": (*ethApi).Resend, "eth_pendingTransactions": (*ethApi).PendingTransactions, } ) @@ -561,6 +563,22 @@ func (self *ethApi) SubmitWork(req *shared.Request) (interface{}, error) { return self.xeth.RemoteMining().SubmitWork(args.Nonce, common.HexToHash(args.Digest), common.HexToHash(args.Header)), nil } +func (self *ethApi) Resend(req *shared.Request) (interface{}, error) { + args := new(ResendArgs) + if err := self.codec.Decode(req.Params, &args); err != nil { + return nil, shared.NewDecodeParamError(err.Error()) + } + + ret, err := self.xeth.Transact(args.Tx.From, args.Tx.To, args.Tx.Nonce, args.Tx.Value, args.GasLimit, args.GasPrice, args.Tx.Data) + if err != nil { + return nil, err + } + + self.ethereum.TxPool().RemoveTransactions(types.Transactions{args.Tx.tx}) + + return ret, nil +} + func (self *ethApi) PendingTransactions(req *shared.Request) (interface{}, error) { txs := self.ethereum.TxPool().GetTransactions() -- cgit v1.2.3